From 118106cf745167db7e17654e0402721939631be7 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 10 Sep 2021 12:00:16 +0430 Subject: update --- .../haproxy/certbot/certbot-entrypoint.sh | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 terminaldweller.com/haproxy/certbot/certbot-entrypoint.sh (limited to 'terminaldweller.com/haproxy/certbot/certbot-entrypoint.sh') diff --git a/terminaldweller.com/haproxy/certbot/certbot-entrypoint.sh b/terminaldweller.com/haproxy/certbot/certbot-entrypoint.sh new file mode 100755 index 0000000..2be858f --- /dev/null +++ b/terminaldweller.com/haproxy/certbot/certbot-entrypoint.sh @@ -0,0 +1,30 @@ +#!/bin/sh +set -ex + +cat_cert() { + dir="/etc/letsencrypt/live/$1" + cat "$dir/privkey.pem" "$dir/fullchain.pem" > "/certs/$1.pem" +} + +while :;do + echo starting... + if [ -e /certs/$DOMAIN.pem ]; then + certbot \ + certonly \ + --test-cert \ + --webroot -w /webroot \ + -d $DOMAIN \ + --email $EMAIL \ + --non-interactive \ + --agree-tos + + cat_cert $DOMAIN + else + certbot renew -w /webroot + + for dir in /etc/letsencrypt/live/*/; do + cat_cert $(basename "$dir") + done + fi + sleep 12h +done -- cgit v1.2.3