Auto create and renewal script
This script will create and automatically update Let's Encrypt certificates and put it in the right format for HAProxy. Script will be executed every day @ 2:30 am and HAProxy does an reload.
Install
- Install certbot
- Move script to /usr/local/bin/renew.sh
- chmod +x /usr/local/bin/renew.sh
- sudo crontab -e 30 2 * * * /usr/local/bin/renew.sh >> /var/log/le-renewal.log
Configure HAProxy
- Add the lines from haproxy.cfg without "..."
Create a new SSL Certificate and enable auto renewal
- nano /usr/local/bin/renew.sh
- Add domains with space in "SITES" eg. (domain1.com domain2.com domain3.com)
Remove Domain from HAproxy
- remove Domain from HAProxy
- remove Domain from /usr/local/bin/renew.sh
- remove Domain from /etc/haproxy/certs/
- run /usr/local/bin/renew.sh
Working perfectly.