2017-01-23 06:33:45 +00:00
|
|
|
#!/bin/sh
|
2017-01-20 02:17:56 +00:00
|
|
|
|
2017-01-23 06:33:45 +00:00
|
|
|
# Source in util.sh so we can have our nice tools
|
|
|
|
. $(cd $(dirname $0); pwd)/util.sh
|
|
|
|
|
|
|
|
# We require an email to register the ssl certificate for
|
|
|
|
if [ -z "$CERTBOT_EMAIL" ]; then
|
|
|
|
error "CERTBOT_EMAIL environment variable undefined; certbot will do nothing"
|
2017-01-20 02:17:56 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2016-11-19 21:22:07 +00:00
|
|
|
|
2017-01-20 02:17:56 +00:00
|
|
|
exit_code=0
|
2017-01-02 05:34:59 +00:00
|
|
|
set -x
|
2017-01-23 06:33:45 +00:00
|
|
|
# Loop over every domain we can find
|
|
|
|
for domain in $(parse_domains); do
|
|
|
|
if ! get_certificate $domain $CERTBOT_EMAIL; then
|
|
|
|
error "Cerbot failed for $domain. Check the logs for details."
|
2017-01-20 02:17:56 +00:00
|
|
|
exit_code=1
|
|
|
|
fi
|
2017-01-20 01:42:04 +00:00
|
|
|
done
|
2017-01-23 06:33:45 +00:00
|
|
|
|
|
|
|
# After trying to get all our certificates, auto enable any configs that we
|
|
|
|
# did indeed get certificates for
|
|
|
|
auto_enable_configs
|
|
|
|
|
|
|
|
# Finally, tell nginx to reload the configs
|
|
|
|
kill -HUP $NGINX_PID
|
|
|
|
|
|
|
|
set +x
|
2017-01-20 02:17:56 +00:00
|
|
|
exit $exit_code
|