Skip to content

Instantly share code, notes, and snippets.

@troyfontaine
Created January 5, 2020 06:14
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 troyfontaine/b8c165be951f12bced533d8bb4701007 to your computer and use it in GitHub Desktop.
Save troyfontaine/b8c165be951f12bced533d8bb4701007 to your computer and use it in GitHub Desktop.
Hackish Certbot HAProxy Script
#!/bin/bash
# This is intended to work with https://github.com/greenhost/certbot-haproxy
DOMAIN="my.supercool.domain" # Replace this with your actual domain that certbot will be using
# Force renewal of certificate
certbot renew --force-renewal
# Sleep for authorization to complete
sleep 5m
# Create new unified cert
cd /etc/letsencrypt/live/$DOMAIN/
cat fullchain.pem privkey.pem > $DOMAIN.pem
# Move certificate
mv $DOMAIN.pem /opt/certbot/haproxy_fullchains/
# In your HAProxy configuration, you can use crt /opt/certbot/haproxy_fullchains
# note the lack of following slash!
# Restart HAProxy
systemctl restart haproxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment