This commit is contained in:
Peter Ivanov 2024-11-11 14:52:22 +02:00
parent 1fd03997a5
commit 89b94eb86c
2 changed files with 12 additions and 1 deletions

View file

@ -33,6 +33,9 @@ class LetsEncryptSecureDomain
'domain' => $findDomain->domain, 'domain' => $findDomain->domain,
'domainRoot' => $findDomain->domain_root, 'domainRoot' => $findDomain->domain_root,
'domainPublic' => $findDomain->domain_public, 'domainPublic' => $findDomain->domain_public,
'sslCertificateFilePath'=> $sslCertificateFilePath,
'sslCertificateKeyFilePath'=> $sslCertificateKeyFilePath,
'sslCertificateChainFilePath'=> $sslCertificateChainFilePath,
'email' => $generalSettings['master_email'], 'email' => $generalSettings['master_email'],
'country' => $generalSettings['master_country'], 'country' => $generalSettings['master_country'],
'locality' => $generalSettings['master_locality'], 'locality' => $generalSettings['master_locality'],
@ -43,7 +46,7 @@ class LetsEncryptSecureDomain
if (empty($isCertbotInstalled)) { if (empty($isCertbotInstalled)) {
shell_exec('sudo apt install certbot -y'); shell_exec('sudo apt install certbot -y');
} }
$output ='';
$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);
@ -52,6 +55,10 @@ class LetsEncryptSecureDomain
$exec = shell_exec("bash $tmpFile"); $exec = shell_exec("bash $tmpFile");
sleep(10); sleep(10);
shell_exec('chmod 0755 /etc/letsencrypt/live/'.$findDomain->domain.'/privkey.pem');
shell_exec('chmod 0755 /etc/letsencrypt/live/'.$findDomain->domain.'/fullchain.pem');
shell_exec('chmod 0755 /etc/letsencrypt/live/'.$findDomain->domain.'/cert.pem');
shell_exec('chmod 0755 /etc/letsencrypt/live/'.$findDomain->domain.'/chain.pem');
unlink($tmpFile); unlink($tmpFile);

View file

@ -4,6 +4,10 @@ sudo certbot certonly \
--manual \ --manual \
--preferred-challenges=http \ --preferred-challenges=http \
-d {{$domain}} \ -d {{$domain}} \
--cert-name {{$domain}} \
--email {{$email}} \ --email {{$email}} \
--cert-path {{$sslCertificateFilePath}} \
--key-path {{$sslCertificateKeyFilePath}} \
--fullchain-path {{$sslCertificateChainFilePath}} \
--manual-auth-hook /usr/local/phyre/web/Modules/LetsEncrypt/shell/hooks/pre/http-authenticator.sh \ --manual-auth-hook /usr/local/phyre/web/Modules/LetsEncrypt/shell/hooks/pre/http-authenticator.sh \
--force-renewal --force-renewal