nginx-certbot/scripts/run_certbot.sh

23 lines
720 B
Bash
Raw Normal View History

2016-09-21 01:12:59 +00:00
for d in $DOMAINS
do
echo "Running certbot for $d"
certbot --standalone --standalone-supported-challenges\
2016-09-21 02:50:27 +00:00
http-01 --agree-tos --renew-by-default\
2016-09-21 12:22:55 +00:00
--text --server https://acme-v01.api.letsencrypt.org/directory\
2016-09-21 01:12:59 +00:00
--email $EMAIL -d $d certonly
ec=$?
echo "certbot exit code $ec"
if [ $ec -eq 0 ]
then
if $CONCAT
then
# concat the full chain with the private key (e.g. for haproxy)
cat /etc/letsencrypt/live/$d/fullchain.pem /etc/letsencrypt/live/$d/privkey.pem > /certs/$d.pem
else
# keep full chain and private key in separate files (e.g. for nginx and apache)
cp /etc/letsencrypt/live/$d/fullchain.pem /certs/$d.pem
cp /etc/letsencrypt/live/$d/privkey.pem /certs/$d.key
fi
fi
done