Update LetsEncryptSecureDomain.php

This commit is contained in:
Bozhidar 2024-11-04 16:45:26 +02:00
parent e8dc629c9c
commit 1fd03997a5

View file

@ -39,6 +39,11 @@ class LetsEncryptSecureDomain
'organization' => $generalSettings['organization_name'], 'organization' => $generalSettings['organization_name'],
])->render(); ])->render();
$isCertbotInstalled = shell_exec('which certbot');
if (empty($isCertbotInstalled)) {
shell_exec('sudo apt install certbot -y');
}
$tmpFile = '/tmp/certbot-http-secure-command-'.$findDomain->id.'.sh'; $tmpFile = '/tmp/certbot-http-secure-command-'.$findDomain->id.'.sh';
file_put_contents($tmpFile, $certbotHttpSecureCommand); file_put_contents($tmpFile, $certbotHttpSecureCommand);
shell_exec('chmod +x '.$tmpFile); shell_exec('chmod +x '.$tmpFile);
@ -46,6 +51,8 @@ class LetsEncryptSecureDomain
shell_exec('chmod +x /usr/local/phyre/web/Modules/LetsEncrypt/shell/hooks/post/http-cleanup.sh'); shell_exec('chmod +x /usr/local/phyre/web/Modules/LetsEncrypt/shell/hooks/post/http-cleanup.sh');
$exec = shell_exec("bash $tmpFile"); $exec = shell_exec("bash $tmpFile");
sleep(10);
unlink($tmpFile); unlink($tmpFile);
$validateCertificates = []; $validateCertificates = [];