fix(ssl): remove caCert even if it is a folder by accident
This commit is contained in:
@@ -20,10 +20,10 @@ class InstallDocker
|
||||
throw new \Exception('Server OS type is not supported for automated installation. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://coolify.io/docs/installation#manually">documentation</a>.');
|
||||
}
|
||||
|
||||
if (! SslCertificate::where('server_id', $server->id)->exists()) {
|
||||
if (! SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->exists()) {
|
||||
$serverCert = SslHelper::generateSslCertificate(
|
||||
commonName: 'Coolify CA Certificate',
|
||||
serverId: $server->id,
|
||||
serverId: $server->server_id,
|
||||
isCaCertificate: true,
|
||||
validityDays: 15 * 365
|
||||
);
|
||||
@@ -33,6 +33,7 @@ class InstallDocker
|
||||
"mkdir -p $caCertPath",
|
||||
"chown -R 9999:root $caCertPath",
|
||||
"chmod -R 700 $caCertPath",
|
||||
"rm -rf $caCertPath/coolify-ca.crt",
|
||||
"echo '{$serverCert->ssl_certificate}' > $caCertPath/coolify-ca.crt",
|
||||
"chmod 644 $caCertPath/coolify-ca.crt",
|
||||
]);
|
||||
|
@@ -49,10 +49,7 @@ class Advanced extends Component
|
||||
|
||||
public function loadCaCertificate()
|
||||
{
|
||||
$this->caCertificate = SslCertificate::where('server_id', $this->server->id)
|
||||
->where('resource_type', null)
|
||||
->where('resource_id', null)
|
||||
->first();
|
||||
$this->caCertificate = SslCertificate::where('server_id', $this->server->server_id)->where('is_ca_certificate', true)->first();
|
||||
|
||||
if ($this->caCertificate) {
|
||||
$this->certificateContent = $this->caCertificate->ssl_certificate;
|
||||
@@ -129,7 +126,7 @@ class Advanced extends Component
|
||||
"mkdir -p $caCertPath",
|
||||
"chown -R 9999:root $caCertPath",
|
||||
"chmod -R 700 $caCertPath",
|
||||
"rm -f $caCertPath/coolify-ca.crt",
|
||||
"rm -rf $caCertPath/coolify-ca.crt",
|
||||
"echo '{$this->certificateContent}' > $caCertPath/coolify-ca.crt",
|
||||
"chmod 644 $caCertPath/coolify-ca.crt",
|
||||
]);
|
||||
|
@@ -13,9 +13,9 @@ class CaSslCertSeeder extends Seeder
|
||||
{
|
||||
Server::chunk(200, function ($servers) {
|
||||
foreach ($servers as $server) {
|
||||
$existingCert = SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->first();
|
||||
$existingCaCert = SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->first();
|
||||
|
||||
if (! $existingCert) {
|
||||
if (! $existingCaCert) {
|
||||
$caCert = SslHelper::generateSslCertificate(
|
||||
commonName: 'Coolify CA Certificate',
|
||||
serverId: $server->id,
|
||||
@@ -23,7 +23,7 @@ class CaSslCertSeeder extends Seeder
|
||||
validityDays: 15 * 365
|
||||
);
|
||||
} else {
|
||||
$caCert = $existingCert;
|
||||
$caCert = $existingCaCert;
|
||||
}
|
||||
$caCertPath = config('constants.coolify.base_config_path').'/ssl/';
|
||||
|
||||
@@ -31,7 +31,7 @@ class CaSslCertSeeder extends Seeder
|
||||
"mkdir -p $caCertPath",
|
||||
"chown -R 9999:root $caCertPath",
|
||||
"chmod -R 700 $caCertPath",
|
||||
"rm -f $caCertPath/coolify-ca.crt",
|
||||
"rm -rf $caCertPath/coolify-ca.crt",
|
||||
"echo '{$caCert->ssl_certificate}' > $caCertPath/coolify-ca.crt",
|
||||
"chmod 644 $caCertPath/coolify-ca.crt",
|
||||
]);
|
||||
|
Reference in New Issue
Block a user