mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
- Regenerate SSL Certificates now writes server.crt/server.key for every engine except MongoDB, which keeps the combined server.pem. Before, the button always wrote server.pem, so Postgres, MySQL, MariaDB, Redis, KeyDB and Dragonfly failed to start after a regenerate. - The certificate renewal job uses the same rule, so MongoDB no longer switches to server.crt/server.key on renewal and fails on restart. - Starting an SSL database writes the CA that signs its certificate to /data/coolify/ssl/coolify-ca.crt, so a stale CA file (for example one written by another server entry for the same host) no longer causes "certificate signature failure". - Saving a custom CA certificate that does not match the stored CA private key is rejected. - The CA file write commands live in SslHelper::caCertificateFileCommands(). Fixes #10388 Fixes #6771 Fixes #11926
63 lines
1.3 KiB
PHP
63 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class SslCertificate extends Model
|
|
{
|
|
protected $fillable = [
|
|
'ssl_certificate',
|
|
'ssl_private_key',
|
|
'configuration_dir',
|
|
'mount_path',
|
|
'resource_type',
|
|
'resource_id',
|
|
'server_id',
|
|
'common_name',
|
|
'subject_alternative_names',
|
|
'valid_until',
|
|
'is_ca_certificate',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'ssl_private_key',
|
|
];
|
|
|
|
protected $casts = [
|
|
'ssl_certificate' => 'encrypted',
|
|
'ssl_private_key' => 'encrypted',
|
|
'subject_alternative_names' => 'array',
|
|
'valid_until' => 'datetime',
|
|
];
|
|
|
|
public function application()
|
|
{
|
|
return $this->morphTo('resource');
|
|
}
|
|
|
|
public function service()
|
|
{
|
|
return $this->morphTo('resource');
|
|
}
|
|
|
|
public function database()
|
|
{
|
|
return $this->morphTo('resource');
|
|
}
|
|
|
|
public function server()
|
|
{
|
|
return $this->belongsTo(Server::class);
|
|
}
|
|
|
|
/**
|
|
* Whether the database reads its certificate and key from one combined server.pem file
|
|
* instead of separate server.crt and server.key files.
|
|
*/
|
|
public function requiresPemKeyFile(): bool
|
|
{
|
|
return $this->resource_type === StandaloneMongodb::class;
|
|
}
|
|
}
|