From adbbc0416f7188a027d749e24e904b8e089737cb Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Thu, 31 Oct 2024 15:23:47 +0200 Subject: [PATCH] update --- .../Clusters/LetsEncrypt/Pages/WildcardDomain.php | 10 ++++++---- web/app/Models/DomainSslCertificate.php | 11 +++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/web/Modules/LetsEncrypt/Filament/Clusters/LetsEncrypt/Pages/WildcardDomain.php b/web/Modules/LetsEncrypt/Filament/Clusters/LetsEncrypt/Pages/WildcardDomain.php index 2c42875..d6ab84a 100644 --- a/web/Modules/LetsEncrypt/Filament/Clusters/LetsEncrypt/Pages/WildcardDomain.php +++ b/web/Modules/LetsEncrypt/Filament/Clusters/LetsEncrypt/Pages/WildcardDomain.php @@ -52,14 +52,16 @@ class WildcardDomain extends BaseSettings $sslCertificateKeyFilePath = '/root/.acmephp/master/certs/*.'.$domain.'/private/key.private.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) && file_exists($sslCertificateKeyFilePath) && file_exists($sslCertificateChainFilePath)) { + + $sslCertificateFileContent = file_get_contents($sslCertificateFilePath); + $sslCertificateKeyFileContent = file_get_contents($sslCertificateKeyFilePath); + $sslCertificateChainFileContent = file_get_contents($sslCertificateChainFilePath); + + return [ 'sslFiles' => [ 'certificate' => $sslCertificateFilePath, diff --git a/web/app/Models/DomainSslCertificate.php b/web/app/Models/DomainSslCertificate.php index b3dcdf7..89b7009 100644 --- a/web/app/Models/DomainSslCertificate.php +++ b/web/app/Models/DomainSslCertificate.php @@ -23,6 +23,17 @@ class DomainSslCertificate extends Model 'renewed_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() {