Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-mw committed Nov 22, 2024
1 parent 925cb4e commit 0f1dd7a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/Modules/LetsEncrypt/Jobs/LetsEncryptSecureDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function handle(): void
//acme.sh --register-account -m [email protected] --server zerossl
$exec = shell_exec("bash /usr/local/phyre/web/Modules/LetsEncrypt/shell/acme.sh --register-account -m " . $generalSettings['master_email'] . " --server zerossl");

$tmpFile = '/tmp/certbot-zerossl-http-secure-command-' . $findDomain->id . '.sh';
$tmpFile = '/tmp/acme-sh-zerossl-http-secure-command-' . $findDomain->id . '.sh';
$certbotHttpSecureCommand = view('letsencrypt::actions.acme-sh-http-secure-command', [
'domain' => $domainName,
'domainNameWww' => $domainNameWww,
Expand All @@ -112,6 +112,7 @@ public function handle(): void
file_put_contents($tmpFile, $certbotHttpSecureCommand);
shell_exec('chmod +x ' . $tmpFile);
$exec = shell_exec("bash $tmpFile");
unlink($tmpFile);

//check file
$zerSslCert = '/root/.acme.sh/' . $domainName . '_ecc/' . $domainName . '.cer';
Expand Down
18 changes: 18 additions & 0 deletions web/app/Jobs/ApacheBuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,25 @@ public function handle(): void
$getAllDomains = Domain::whereNot('status','<=>', 'broken')->get();
$virtualHosts = [];
foreach ($getAllDomains as $domain) {

// check is valid domain
if (!filter_var($domain->domain, FILTER_VALIDATE_DOMAIN)) {
// mark domain as broken
$domain->status = 'broken';
$domain->save();
continue;
}


$virtualHostSettings = $domain->configureVirtualHost($this->fixPermissions);

if(!$virtualHostSettings){
// mark domain as broken
$domain->status = 'broken';
$domain->save();
continue;
}

if (isset($virtualHostSettings['virtualHostSettings'])) {
$virtualHosts[] = $virtualHostSettings['virtualHostSettings'];
}
Expand Down
4 changes: 4 additions & 0 deletions web/app/MasterDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ public function configureVirtualHost($fixPermissions = false)
shell_exec('chown -R www-data:www-data ' . $this->domainPublic);
shell_exec('chmod -R 755 ' . $this->domainPublic);
}
if(!is_dir($this->domainPublic)){
return false;
}


return [
'virtualHostSettings' => $virtualHostSettings,
Expand Down

0 comments on commit 0f1dd7a

Please sign in to comment.