From a73daf773a2b56730104247974d4e591511b86ac Mon Sep 17 00:00:00 2001 From: aptalca Date: Fri, 1 Oct 2021 11:18:12 -0400 Subject: [PATCH] detect old root cert and revoke/regen --- README.md | 1 + readme-vars.yml | 1 + root/etc/cont-init.d/50-config | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 62ea26e..ea71b50 100644 --- a/README.md +++ b/README.md @@ -331,6 +331,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **01.10.21:** - Check if the cert uses the old LE root cert, revoke and regenerate if necessary. [Here's more info](https://twitter.com/letsencrypt/status/1443621997288767491) on LE root cert expiration * **19.09.21:** - Add an optional header to opt out of Google FLoC in `ssl.conf`. * **17.09.21:** - Mark `SUBDOMAINS` var as optional. * **01.08.21:** - Add support for ionos dns validation. diff --git a/readme-vars.yml b/readme-vars.yml index 31b1bfd..9054d24 100755 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -155,6 +155,7 @@ app_setup_nginx_reverse_proxy_block: "" # changelog changelogs: + - { date: "01.10.21:", desc: "Check if the cert uses the old LE root cert, revoke and regenerate if necessary. [Here's more info](https://twitter.com/letsencrypt/status/1443621997288767491) on LE root cert expiration" } - { date: "19.09.21:", desc: "Add an optional header to opt out of Google FLoC in `ssl.conf`." } - { date: "17.09.21:", desc: "Mark `SUBDOMAINS` var as optional." } - { date: "01.08.21:", desc: "Add support for ionos dns validation." } diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 382cfcd..19e347a 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -312,6 +312,14 @@ else FILENAME="$DNSPLUGIN.ini" fi +# Check if the cert is using the old LE root cert, revoke and regen if necessary +if [ -f "/config/keys/letsencrypt/chain.pem" ] && ([ "${CERTPROVIDER}" == "letsencrypt" ] || [ "${CERTPROVIDER}" == "" ]) && ! openssl x509 -in /config/keys/letsencrypt/chain.pem -noout -issuer | grep -q "ISRG Root X"; then + echo "The cert seems to be using the old LE root cert, which is no longer valid. Deleting and revoking." + certbot revoke --non-interactive --cert-path /config/etc/letsencrypt/live/"$ORIGDOMAIN"/fullchain.pem --server $REV_ACMESERVER + rm -rf /config/etc/letsencrypt + mkdir -p /config/etc/letsencrypt +fi + # generating certs if necessary if [ ! -f "/config/keys/letsencrypt/fullchain.pem" ]; then if [ "$CERTPROVIDER" = "zerossl" ] && [ -n "$EMAIL" ]; then