Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

letsencrypt-gencert 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # Call script like this:
  3. # letsencrypt-gencert foo.com bar.com baz.com
  4. # Build list of domains and subdomains we need a certificate for
  5. d=""
  6. for domain in "$@"; do
  7. # domain itself - foo.com
  8. # only add if the DNS entry for the domain does actually exist
  9. if (getent hosts $domain > /dev/null); then
  10. if [ -z "$d" ]; then
  11. d="$domain";
  12. else
  13. d="$d,$domain";
  14. fi
  15. fi
  16. # subdomains - www.foo.com mail.foo.com ...
  17. # TODO includes servername (eddie / stage)!
  18. for sub in stage www mail autoconfig stats news cloud git matrix status social comments iot wiki jitsi kanboard chat; do
  19. # only add if the DNS entry for the subdomain does actually exist
  20. if (getent hosts $sub.$domain > /dev/null); then
  21. if [ -z "$d" ]; then
  22. d="$sub.$domain";
  23. else
  24. d="$d,$sub.$domain";
  25. fi
  26. fi
  27. done
  28. done
  29. # We are using the "standalone" letsencrypt plugin, which runs its own
  30. # webserver, so we need to temporarily free up the HTTP(S) ports by stopping
  31. # our own Apache.
  32. service apache2 stop
  33. certbot certonly --standalone -c /etc/letsencrypt/cli.conf --domains $d
  34. service apache2 start