From 2ba4137e7da5917db676b674d412fe2f39ce0269 Mon Sep 17 00:00:00 2001 From: Daniel Reichelt Date: Tue, 5 Jun 2018 06:51:20 +0200 Subject: [PATCH] fix triggering an LE CSR when changing www on a main domain Prior to this, LE CSRs were triggered only when the wwwserveralias was changed on alias domains, but not on main domains. Fixes #526 --- admin_domains.php | 8 ++++++++ customer_domains.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/admin_domains.php b/admin_domains.php index b12ca648..00ab4143 100644 --- a/admin_domains.php +++ b/admin_domains.php @@ -2027,7 +2027,15 @@ if ($page == 'domains' || $page == 'overview') { } else if ($result['wwwserveralias'] != $wwwserveralias || $result['letsencrypt'] != $letsencrypt) { // or when wwwserveralias or letsencrypt was changed + triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log); + + if ($aliasdomain === 0) { + // in case the wwwserveralias is set on a main domain, $aliasdomain is 0 + // --> the call just above to triggerLetsEncryptCSRForAliasDestinationDomain + // is a noop...let's repeat it with the domain id of the main domain + triggerLetsEncryptCSRForAliasDestinationDomain($id, $log); + } } $log->logAction(ADM_ACTION, LOG_INFO, "edited domain #" . $id); diff --git a/customer_domains.php b/customer_domains.php index 23bbb07f..a84b2366 100644 --- a/customer_domains.php +++ b/customer_domains.php @@ -773,7 +773,15 @@ if ($page == 'overview') { triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log); } elseif ($result['wwwserveralias'] != $wwwserveralias || $result['letsencrypt'] != $letsencrypt) { // or when wwwserveralias or letsencrypt was changed + triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log); + + if ($aliasdomain === 0) { + // in case the wwwserveralias is set on a main domain, $aliasdomain is 0 + // --> the call just above to triggerLetsEncryptCSRForAliasDestinationDomain + // is a noop...let's repeat it with the domain id of the main domain + triggerLetsEncryptCSRForAliasDestinationDomain($id, $log); + } } // check whether LE has been disabled, so we remove the certificate