Some scripts to create and renew all your certificates, and concatenate fullchain and privkey so haproxy is able to use it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

25 lines
669 B

#!/bin/bash
#Configuration variables
certbot_bin="/usr/bin/certbot"
haproxy_pem_path="/etc/haproxy/cert"
if [ $# -ne 1 ] ; then
echo "$(date +%c) Please give domain name as parameter"
exit 1
fi
echo "$(date +%c) Generate certificat for ${1}"
${certbot_bin} certonly --domains $1 --renew-by-default --http-01-port 63443 --agree-tos
if [ $? -eq 0 ]; then
echo "$(date +%c) Success ! Now creating ${1}.pem"
cat /etc/letsencrypt/live/$1/fullchain.pem /etc/letsencrypt/live/$1/privkey.pem > ${haproxy_pem_path}/$1.pem
systemctl reload haproxy
else
echo "$(date +%c) Error creating certificate with error code $?, exit script..."
exit 1
fi
exit 0