Skip to content

Instantly share code, notes, and snippets.

@cyanide-burnout
Created August 10, 2026 11:18
Show Gist options
  • Select an option

  • Save cyanide-burnout/87091bb8ad95d08e13777d3762fc41a6 to your computer and use it in GitHub Desktop.

Select an option

Save cyanide-burnout/87091bb8ad95d08e13777d3762fc41a6 to your computer and use it in GitHub Desktop.
Let’s Encrypt / haproxy certificate deployment hook
#!/bin/bash
# cp hook.sh /etc/letsencrypt/renewal-hooks/deploy/hook.sh
# echo "show ssl cert" | socat stdio /run/haproxy/admin.sock
# https://www.haproxy.com/blog/dynamic-ssl-certificate-storage-in-haproxy
NAME=$(basename ${RENEWED_LINEAGE})
TARGET=/etc/ssl/haproxy/${NAME}.pem
cat $RENEWED_LINEAGE/fullchain.pem $RENEWED_LINEAGE/privkey.pem > $TARGET
echo -e "set ssl cert $TARGET <<\n$(sed '/^[[:space:]]*$/d' $TARGET)\n" | socat stdio /run/haproxy/admin.sock
echo "commit ssl cert $TARGET" | socat stdio /run/haproxy/admin.sock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment