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:
@@ -1619,6 +1619,9 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
|||||||
// remove domains DNS from powerDNS if used, #581
|
// remove domains DNS from powerDNS if used, #581
|
||||||
\Froxlor\System\Cronjob::inserttask('11', $result['domain']);
|
\Froxlor\System\Cronjob::inserttask('11', $result['domain']);
|
||||||
|
|
||||||
|
// remove domain from acme.sh / lets encrypt if used
|
||||||
|
\Froxlor\System\Cronjob::inserttask('12', $result['domain']);
|
||||||
|
|
||||||
$this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] deleted domain/subdomains (#" . $result['id'] . ")");
|
$this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] deleted domain/subdomains (#" . $result['id'] . ")");
|
||||||
\Froxlor\User::updateCounters();
|
\Froxlor\User::updateCounters();
|
||||||
\Froxlor\System\Cronjob::inserttask('1');
|
\Froxlor\System\Cronjob::inserttask('1');
|
||||||
|
|||||||
@@ -828,6 +828,8 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
\Froxlor\System\Cronjob::inserttask('4');
|
\Froxlor\System\Cronjob::inserttask('4');
|
||||||
// remove domains DNS from powerDNS if used, #581
|
// remove domains DNS from powerDNS if used, #581
|
||||||
\Froxlor\System\Cronjob::inserttask('11', $result['domain']);
|
\Froxlor\System\Cronjob::inserttask('11', $result['domain']);
|
||||||
|
// remove domain from acme.sh / lets encrypt if used
|
||||||
|
\Froxlor\System\Cronjob::inserttask('12', $result['domain']);
|
||||||
|
|
||||||
// reduce subdomain-usage-counter
|
// reduce subdomain-usage-counter
|
||||||
Customers::decreaseUsage($customer['customerid'], 'subdomains_used');
|
Customers::decreaseUsage($customer['customerid'], 'subdomains_used');
|
||||||
|
|||||||
@@ -92,6 +92,12 @@ class TasksCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
*/
|
*/
|
||||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_NOTICE, "Removing PowerDNS entries for domain " . $row['data']['domain']);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_NOTICE, "Removing PowerDNS entries for domain " . $row['data']['domain']);
|
||||||
\Froxlor\Dns\PowerDNS::cleanDomainZone($row['data']['domain']);
|
\Froxlor\Dns\PowerDNS::cleanDomainZone($row['data']['domain']);
|
||||||
|
} elseif ($row['type'] == '12') {
|
||||||
|
/**
|
||||||
|
* TYPE=12 domain has been deleted, remove from acme.sh/let's encrypt directory if used
|
||||||
|
*/
|
||||||
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_NOTICE, "Removing Let's Encrypt entries for domain " . $row['data']['domain']);
|
||||||
|
\Froxlor\Domain\Domain::doLetsEncryptCleanUp($row['data']['domain']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
* checks give path for security issues
|
||||||
* and returns a string that can be appended
|
* and returns a string that can be appended
|
||||||
|
|||||||
@@ -178,6 +178,14 @@ class Cronjob
|
|||||||
'type' => '11',
|
'type' => '11',
|
||||||
'data' => $data
|
'data' => $data
|
||||||
));
|
));
|
||||||
|
} elseif ($type == '12' && $param1 != '') {
|
||||||
|
$data = array();
|
||||||
|
$data['domain'] = $param1;
|
||||||
|
$data = json_encode($data);
|
||||||
|
Database::pexecute($ins_stmt, array(
|
||||||
|
'type' => '12',
|
||||||
|
'data' => $data
|
||||||
|
));
|
||||||
} elseif ($type == '20' && is_array($param1)) {
|
} elseif ($type == '20' && is_array($param1)) {
|
||||||
$data = json_encode($param1);
|
$data = json_encode($param1);
|
||||||
Database::pexecute($ins_stmt, array(
|
Database::pexecute($ins_stmt, array(
|
||||||
|
|||||||
Reference in New Issue
Block a user