From cefd9226bd4ad8f2e0ec0f70e432dd2a1f42cac2 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 2 Nov 2023 11:33:08 +0100 Subject: [PATCH] fix possible missing _ecc suffix of let's encrypt folder when cleaning up after deleting a domain Signed-off-by: Michael Kaufmann --- lib/Froxlor/Domain/Domain.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/Froxlor/Domain/Domain.php b/lib/Froxlor/Domain/Domain.php index 0f7a300b55..82616d37e3 100644 --- a/lib/Froxlor/Domain/Domain.php +++ b/lib/Froxlor/Domain/Domain.php @@ -320,12 +320,15 @@ public static function isCustomerStdSubdomain(int $did): bool * @throws \Exception */ public static function triggerLetsEncryptCSRForAliasDestinationDomain( - int $aliasDestinationDomainID, + int $aliasDestinationDomainID, FroxlorLogger $log ) { if ($aliasDestinationDomainID > 0) { - $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, - "LetsEncrypt CSR triggered for domain ID " . $aliasDestinationDomainID); + $log->logAction( + FroxlorLogger::ADM_ACTION, + LOG_INFO, + "LetsEncrypt CSR triggered for domain ID " . $aliasDestinationDomainID + ); $upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` SET @@ -349,15 +352,20 @@ public static function doLetsEncryptCleanUp(string $domainname): bool $acmesh = AcmeSh::getAcmeSh(); if (file_exists($acmesh)) { $certificate_folder = AcmeSh::getWorkingDirFromEnv($domainname); - if (file_exists($certificate_folder)) { + $certificate_ecc_folder = AcmeSh::getWorkingDirFromEnv($domainname, true); + if (file_exists($certificate_folder) || file_exists($certificate_ecc_folder)) { $params = " --remove -d " . $domainname; - if (Settings::Get('system.leecc') > 0) { + if (file_exists($certificate_ecc_folder)) { $params .= " --ecc"; } // run remove command FileDir::safe_exec($acmesh . $params); // remove certificates directory - FileDir::safe_exec('rm -rf ' . $certificate_folder); + if (file_exists($certificate_folder)) { + FileDir::safe_exec('rm -rf ' . $certificate_folder); + } elseif (file_exists($certificate_ecc_folder)) { + FileDir::safe_exec('rm -rf ' . $certificate_ecc_folder); + } } } return true;