Skip to content

Instantly share code, notes, and snippets.

@askz
Created November 7, 2017 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save askz/334acc6736eafc78473eed3c7d1bffc0 to your computer and use it in GitHub Desktop.
Save askz/334acc6736eafc78473eed3c7d1bffc0 to your computer and use it in GitHub Desktop.
Renew Let's Encrypt certificates and put them in HAProxy ssl folder
#!/bin/bash
# Let's encrypt: renew certificates and put them in haproxy ssl folder for reloading.
# Maxime Saddok <maxime@businessagile.eu>
# put in /etc/cron.weekly/le-renew && chmod +x /etc/cron.weekly/le-renew
set -x
set -e
/opt/letsencrypt/letsencrypt-auto --standalone --standalone-supported-challenges http-01 --http-01-port 9999 renew;
LE_OUTPUT=/etc/letsencrypt/live;
for i in ls /etc/letsencrypt/live/*; do
domain=`basename $i`;
cat $LE_OUTPUT/$domain/{fullchain.pem,privkey.pem} > /etc/haproxy/ssl/${domain}.pem;
done
systemctl reload haproxy;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment