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

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