Created
March 27, 2019 06:31
-
-
Save muhx/5384337e2021ead257aab7055535ba4b to your computer and use it in GitHub Desktop.
Update HAProxy Lets Encrypt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cert_name="generic_cert" | |
haproxy_cert_dir="/etc/haproxy/certs" | |
email="<your_email>" | |
domains="" | |
for domain in "$@" | |
do | |
domains+="-d $domain " | |
done | |
certbot certonly --standalone --agree-tos --non-interactive \ | |
-m $email --preferred-challenges http \ | |
--http-01-port 9785 --cert-name $cert_name \ | |
--renew-with-new-domains --keep-until-expiring $domains | |
# Combine the certificate chain and private key and put it | |
# into the correct HAProxy directory | |
cd /etc/letsencrypt/live/$cert_name | |
cat fullchain.pem privkey.pem > "$haproxy_cert_dir/cert.pem" | |
echo "Reloading haproxy" | |
sudo systemctl reload haproxy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment