mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-22 07:30:25 +00:00
update
This commit is contained in:
parent
76ab0a13c1
commit
0187704576
6 changed files with 23 additions and 10 deletions
Binary file not shown.
|
@ -3,6 +3,7 @@
|
|||
namespace Modules\LetsEncrypt\Filament\Clusters\LetsEncrypt\Pages;
|
||||
|
||||
use App\ApiClient;
|
||||
use App\Jobs\ApacheBuild;
|
||||
use App\MasterDomain;
|
||||
use App\Models\DomainSslCertificate;
|
||||
use App\Settings;
|
||||
|
@ -49,6 +50,13 @@ class WildcardDomain extends BaseSettings
|
|||
$masterDomain = new MasterDomain();
|
||||
$masterDomain->domain = setting('general.wildcard_domain');
|
||||
|
||||
$findWildcardSsl = DomainSslCertificate::where('domain', '*.'.$masterDomain->domain)->first();
|
||||
if ($findWildcardSsl) {
|
||||
return [
|
||||
'error' => 'Domain already secured'
|
||||
];
|
||||
}
|
||||
|
||||
if (file_exists($this->installLogFilePath)) {
|
||||
unlink($this->installLogFilePath);
|
||||
}
|
||||
|
@ -62,7 +70,7 @@ class WildcardDomain extends BaseSettings
|
|||
'locality' => $masterDomain->locality,
|
||||
'organization' => $masterDomain->organization
|
||||
])->render();
|
||||
|
||||
|
||||
$acmeConfigYaml = preg_replace('~(*ANY)\A\s*\R|\s*(?!\r\n)\s$~mu', '', $acmeConfigYaml);
|
||||
|
||||
file_put_contents($masterDomain->domainRoot.'/acme-wildcard-config.yaml', $acmeConfigYaml);
|
||||
|
@ -127,6 +135,8 @@ class WildcardDomain extends BaseSettings
|
|||
$mds = new MasterDomain();
|
||||
$mds->configureVirtualHost();
|
||||
|
||||
ApacheBuild::dispatchSync();
|
||||
|
||||
return [
|
||||
'success' => 'SSL certificate installed successfully.'
|
||||
];
|
||||
|
|
|
@ -56,6 +56,7 @@ Route::post('letsencrypt/secure', function () {
|
|||
$phyrePHP = ApiClient::getPhyrePHP();
|
||||
|
||||
$command = $phyrePHP.' '.$amePHPPharFile.' run '.$findDomain->domain_root.'/acme-config.yaml';
|
||||
|
||||
$execSSL = shell_exec($command);
|
||||
|
||||
$validateCertificates = [];
|
||||
|
|
|
@ -62,11 +62,10 @@ class RunRepair extends Command
|
|||
public function fixApacheErrors()
|
||||
{
|
||||
// Rebuild apache config
|
||||
$apacheBuild = new ApacheBuild();
|
||||
$apacheBuild->handle();
|
||||
// $apacheBuild = new ApacheBuild();
|
||||
// $apacheBuild->handle();
|
||||
|
||||
$checkApacheStatus = shell_exec('service apache2 status');
|
||||
|
||||
if (strpos($checkApacheStatus, 'Syntax error on line') !== false) {
|
||||
|
||||
$apacheErrorLine = null;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace app\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\ApiController;
|
||||
use App\Jobs\ApacheBuild;
|
||||
use App\Models\Domain;
|
||||
use App\Models\HostingSubscription;
|
||||
use Carbon\Carbon;
|
||||
|
@ -108,6 +109,8 @@ class DomainsController extends ApiController
|
|||
|
||||
$findDomain->save();
|
||||
|
||||
ApacheBuild::dispatchSync();
|
||||
|
||||
return response()->json([
|
||||
'status' => 'ok',
|
||||
'message' => 'Domain updated',
|
||||
|
|
|
@ -380,30 +380,30 @@ class Domain extends Model
|
|||
$sslCertificateChainFile = $this->home_root . '/certs/' . $this->domain . '/public/fullchain.pem';
|
||||
|
||||
if (!empty($findDomainSSLCertificate->certificate)) {
|
||||
if (!file_exists($sslCertificateFile)) {
|
||||
// if (!file_exists($sslCertificateFile)) {
|
||||
if (!is_dir($this->home_root . '/certs/' . $this->domain . '/public')) {
|
||||
mkdir($this->home_root . '/certs/' . $this->domain . '/public', 0755, true);
|
||||
}
|
||||
file_put_contents($sslCertificateFile, $findDomainSSLCertificate->certificate);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
if (!empty($findDomainSSLCertificate->private_key)) {
|
||||
if (!file_exists($sslCertificateKeyFile)) {
|
||||
// if (!file_exists($sslCertificateKeyFile)) {
|
||||
if (!is_dir($this->home_root . '/certs/' . $this->domain . '/private')) {
|
||||
mkdir($this->home_root . '/certs/' . $this->domain . '/private', 0755, true);
|
||||
}
|
||||
file_put_contents($sslCertificateKeyFile, $findDomainSSLCertificate->private_key);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
if (!empty($findDomainSSLCertificate->certificate_chain)) {
|
||||
if (!file_exists($sslCertificateChainFile)) {
|
||||
// if (!file_exists($sslCertificateChainFile)) {
|
||||
if (!is_dir($this->home_root . '/certs/' . $this->domain . '/public')) {
|
||||
mkdir($this->home_root . '/certs/' . $this->domain . '/public', 0755, true);
|
||||
}
|
||||
file_put_contents($sslCertificateChainFile, $findDomainSSLCertificate->certificate_chain);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
$apacheVirtualHostBuilder->setPort(443);
|
||||
|
|
Loading…
Reference in a new issue