remove domain ssl information from acme.sh and filesystem on deletion to avoid trying to renew certificates

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-07-01 20:32:13 +02:00
parent 2ce517e84a
commit 01bf814496
5 changed files with 43 additions and 0 deletions

View File

@@ -291,6 +291,30 @@ class Domain
}
}
public static function doLetsEncryptCleanUp($domainname = null)
{
// @ see \Froxlor\Cron\Http\LetsEncrypt\AcmeSh.php
$acmesh = "/root/.acme.sh/acme.sh";
if (file_exists($acmesh)) {
$certificate_folder = dirname($acmesh) . "/" . $domainname;
if (\Froxlor\Settings::Get('system.leecc') > 0) {
$certificate_folder .= "_ecc";
}
$certificate_folder = \Froxlor\FileDir::makeCorrectDir($certificate_folder);
if (file_exists($certificate_folder)) {
$params = " --remove -d " . $domainname;
if (\Froxlor\Settings::Get('system.leecc') > 0) {
$params .= " -ecc";
}
// run remove command
\Froxlor\FileDir::safe_exec($acmesh . $params);
// remove certificates directory
@unlink($certificate_folder);
}
}
return true;
}
/**
* checks give path for security issues
* and returns a string that can be appended