From 4039da90a91e76b2757c0cec47e641318aa76b75 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Tue, 21 Sep 2021 17:12:34 -0600 Subject: [PATCH] letsencrypt: take into account duplicate domains ending in -0001 Signed-off-by: nachoparker --- changelog.md | 53 +++++------------------------ etc/ncp-templates/nextcloud.conf.sh | 5 +++ 2 files changed, 13 insertions(+), 45 deletions(-) diff --git a/changelog.md b/changelog.md index 67b03b956..d803d97ff 100644 --- a/changelog.md +++ b/changelog.md @@ -1,52 +1,15 @@ -<<<<<<< HEAD -[v1.39.7](https://github.com/nextcloud/nextcloudpi/commit/5ba3e68) (2021-09-22) dont update config if Redis is not yet ready -======= -<<<<<<< HEAD -[v1.39.7](https://github.com/nextcloud/nextcloudpi/commit/ef88f48) (2021-09-22) dont update config if Redis is not yet ready ->>>>>>> 37f01dc (letsencrypt: fix active status check) +[v1.39.11](https://github.com/nextcloud/nextcloudpi/commit/43a6381) (2021-09-21) letsencrypt: take into account duplicate domains ending in -0001 -[v1.39.6 ](https://github.com/nextcloud/nextcloudpi/commit/534b9b5) (2021-09-19) ncp-update-nc: pre-check that NC is currently working fine -======= -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -[v1.39.7](https://github.com/nextcloud/nextcloudpi/commit/ef88f48) (2021-09-22) dont update config if Redis is not yet ready +[v1.39.10](https://github.com/nextcloud/nextcloudpi/commit/2b51476) (2021-09-21) fix inverted template logic for docker + +[v1.39.9 ](https://github.com/nextcloud/nextcloudpi/commit/a4851dc) (2021-09-21) letsencrypt: fix renewal with httpsonly enabled + +[v1.39.8 ](https://github.com/nextcloud/nextcloudpi/commit/1046a24) (2021-09-21) letsencrypt: fix active status check + +[v1.39.7](https://github.com/nextcloud/nextcloudpi/commit/98976c9) (2021-09-22) dont update config if Redis is not yet ready [v1.39.6 ](https://github.com/nextcloud/nextcloudpi/commit/534b9b5) (2021-09-19) ncp-update-nc: pre-check that NC is currently working fine -======= -======= ->>>>>>> 3c905ea (letsencrypt: fix active status check) -======= ->>>>>>> bac07b7 (letsencrypt: fix renewal with httpsonly enabled) -======= ->>>>>>> 2060cc8 (fix inverted template logic for docker) -[v1.39.7](https://github.com/nextcloud/nextcloudpi/commit/a6fd394) (2021-09-22) dont update config if Redis is not yet ready -======= -[v1.39.7](https://github.com/nextcloud/nextcloudpi/commit/c651cf8) (2021-09-21) letsencrypt: fix active status check ->>>>>>> a07ddd2 (letsencrypt: fix active status check) -======= -======= ->>>>>>> 9ece76e (fix inverted template logic for docker) -[v1.39.7](https://github.com/nextcloud/nextcloudpi/commit/c651cf8) (2021-09-21) letsencrypt: fix active status check -======= -[v1.39.9](https://github.com/nextcloud/nextcloudpi/commit/836d66d) (2021-09-21) letsencrypt: fix renewal with httpsonly enabled -======= -[v1.39.10](https://github.com/nextcloud/nextcloudpi/commit/27e7d06) (2021-09-21) fix inverted template logic for docker - -[v1.39.9 ](https://github.com/nextcloud/nextcloudpi/commit/afeb957) (2021-09-21) letsencrypt: fix renewal with httpsonly enabled ->>>>>>> 215574b (fix inverted template logic for docker) - -[v1.39.8](https://github.com/nextcloud/nextcloudpi/commit/6fca91c) (2021-09-21) letsencrypt: take into account duplicate domains ending in -0001 - -[v1.39.7 ](https://github.com/nextcloud/nextcloudpi/commit/a07ddd2) (2021-09-21) letsencrypt: fix active status check ->>>>>>> afeb957 (letsencrypt: fix renewal with httpsonly enabled) ->>>>>>> dd348b0 (letsencrypt: fix renewal with httpsonly enabled) - -[v1.39.6](https://github.com/nextcloud/nextcloudpi/commit/534b9b5) (2021-09-19) ncp-update-nc: pre-check that NC is currently working fine ->>>>>>> f289443 (dont update config if Redis is not yet ready) ->>>>>>> 6b852d2 (letsencrypt: fix active status check) [v1.39.5 ](https://github.com/nextcloud/nextcloudpi/commit/cb184d2) (2021-09-19) ncp-update-nc: dont keep notifying when there is nothing to upgrade diff --git a/etc/ncp-templates/nextcloud.conf.sh b/etc/ncp-templates/nextcloud.conf.sh index 6db58f16b..728217be2 100644 --- a/etc/ncp-templates/nextcloud.conf.sh +++ b/etc/ncp-templates/nextcloud.conf.sh @@ -34,8 +34,13 @@ EOF if [[ "$1" != "--defaults" ]] && [[ -n "$LETSENCRYPT_DOMAIN" ]]; then echo " ServerName ${LETSENCRYPT_DOMAIN}" LETSENCRYPT_CERT_BASE_PATH="/etc/letsencrypt/live/${LETSENCRYPT_DOMAIN,,}" + [[ -d "${LETSENCRYPT_CERT_BASE_PATH}" ]] || \ + LETSENCRYPT_CERT_BASE_PATH="$(find /etc/letsencrypt/live -name "${LETSENCRYPT_DOMAIN,,}*" | head -1)" LETSENCRYPT_CERT_PATH="${LETSENCRYPT_CERT_BASE_PATH}/fullchain.pem" LETSENCRYPT_KEY_PATH="${LETSENCRYPT_CERT_BASE_PATH}/privkey.pem" + + # fall back to self-signed snakeoil certs + [[ -d "${LETSENCRYPT_CERT_BASE_PATH}" ]] || unset LETSENCRYPT_CERT_BASE_PATH else # Make sure the default snakeoil cert exists [ -f /etc/ssl/certs/ssl-cert-snakeoil.pem ] || make-ssl-cert generate-default-snakeoil --force-overwrite