This commit is contained in:
Bozhidar 2024-10-31 15:23:47 +02:00
parent 145064f148
commit adbbc0416f
2 changed files with 17 additions and 4 deletions

View file

@ -52,14 +52,16 @@ class WildcardDomain extends BaseSettings
$sslCertificateKeyFilePath = '/root/.acmephp/master/certs/*.'.$domain.'/private/key.private.pem'; $sslCertificateKeyFilePath = '/root/.acmephp/master/certs/*.'.$domain.'/private/key.private.pem';
$sslCertificateChainFilePath = '/root/.acmephp/master/certs/*.'.$domain.'/public/fullchain.pem'; $sslCertificateChainFilePath = '/root/.acmephp/master/certs/*.'.$domain.'/public/fullchain.pem';
$sslCertificateFileContent = file_get_contents($sslCertificateFilePath);
$sslCertificateKeyFileContent = file_get_contents($sslCertificateKeyFilePath);
$sslCertificateChainFileContent = file_get_contents($sslCertificateChainFilePath);
if (file_exists($sslCertificateFilePath) if (file_exists($sslCertificateFilePath)
&& file_exists($sslCertificateKeyFilePath) && file_exists($sslCertificateKeyFilePath)
&& file_exists($sslCertificateChainFilePath)) { && file_exists($sslCertificateChainFilePath)) {
$sslCertificateFileContent = file_get_contents($sslCertificateFilePath);
$sslCertificateKeyFileContent = file_get_contents($sslCertificateKeyFilePath);
$sslCertificateChainFileContent = file_get_contents($sslCertificateChainFilePath);
return [ return [
'sslFiles' => [ 'sslFiles' => [
'certificate' => $sslCertificateFilePath, 'certificate' => $sslCertificateFilePath,

View file

@ -23,6 +23,17 @@ class DomainSslCertificate extends Model
'renewed_date', 'renewed_date',
'renewed_until_date', 'renewed_until_date',
]; ];
public static function boot()
{
parent::boot();
static::deleting(function ($model) {
shell_exec('rm -rf '.'/root/.acmephp/master/certs/'.$model->domain);
shell_exec('rm -rf '.'/etc/letsencrypt/live/'.$model->domain);
});
}
public function getSSLFiles() public function getSSLFiles()
{ {