From 118106cf745167db7e17654e0402721939631be7 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 10 Sep 2021 12:00:16 +0430 Subject: update --- terminaldweller.com/haproxy/certbot/Dockerfile | 2 ++ .../haproxy/certbot/certbot-entrypoint.sh | 30 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 terminaldweller.com/haproxy/certbot/Dockerfile create mode 100755 terminaldweller.com/haproxy/certbot/certbot-entrypoint.sh (limited to 'terminaldweller.com/haproxy/certbot') diff --git a/terminaldweller.com/haproxy/certbot/Dockerfile b/terminaldweller.com/haproxy/certbot/Dockerfile new file mode 100644 index 0000000..b6fb68a --- /dev/null +++ b/terminaldweller.com/haproxy/certbot/Dockerfile @@ -0,0 +1,2 @@ +FROM certbot/certbot +COPY ./certbot-entrypoint.sh /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