Skip to content

Commit

Permalink
fix possible missing _ecc suffix of let's encrypt folder when cleanin…
Browse files Browse the repository at this point in the history
…g up after deleting a domain

Signed-off-by: Michael Kaufmann <[email protected]>
  • Loading branch information
d00p committed Nov 2, 2023
1 parent 762f295 commit cefd922
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/Froxlor/Domain/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit cefd922

Please sign in to comment.