refactor(database): enhance SSL configuration handling for various databases

This commit is contained in:
Andras Bacsai
2025-03-26 17:24:46 +01:00
parent 5693b59874
commit d7ded7f8e5
18 changed files with 302 additions and 164 deletions

View File

@@ -60,10 +60,12 @@ class General extends Component
public function getListeners() public function getListeners()
{ {
$userId = Auth::id();
$teamId = Auth::user()->currentTeam()->id; $teamId = Auth::user()->currentTeam()->id;
return [ return [
"echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped', "echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped',
"echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
]; ];
} }

View File

@@ -31,8 +31,8 @@ class Heading extends Component
$this->database->update([ $this->database->update([
'started_at' => now(), 'started_at' => now(),
]); ]);
$this->dispatch('refresh');
$this->check_status(); $this->check_status();
if (is_null($this->database->config_hash) || $this->database->isConfigurationChanged()) { if (is_null($this->database->config_hash) || $this->database->isConfigurationChanged()) {
$this->database->isConfigurationChanged(true); $this->database->isConfigurationChanged(true);
$this->dispatch('configurationChanged'); $this->dispatch('configurationChanged');
@@ -44,7 +44,7 @@ class Heading extends Component
public function check_status($showNotification = false) public function check_status($showNotification = false)
{ {
if ($this->database->destination->server->isFunctional()) { if ($this->database->destination->server->isFunctional()) {
GetContainersStatus::dispatch($this->database->destination->server); GetContainersStatus::run($this->database->destination->server);
} }
if ($showNotification) { if ($showNotification) {
@@ -63,6 +63,7 @@ class Heading extends Component
$this->database->status = 'exited'; $this->database->status = 'exited';
$this->database->save(); $this->database->save();
$this->check_status(); $this->check_status();
$this->dispatch('refresh');
} }
public function restart() public function restart()

View File

@@ -63,10 +63,13 @@ class General extends Component
public function getListeners() public function getListeners()
{ {
$userId = Auth::id();
$teamId = Auth::user()->currentTeam()->id; $teamId = Auth::user()->currentTeam()->id;
return [ return [
"echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped', "echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped',
"echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
'refresh' => '$refresh',
]; ];
} }

View File

@@ -8,6 +8,7 @@ use App\Helpers\SslHelper;
use App\Models\Server; use App\Models\Server;
use App\Models\SslCertificate; use App\Models\SslCertificate;
use App\Models\StandaloneMariadb; use App\Models\StandaloneMariadb;
use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use Exception; use Exception;
use Livewire\Component; use Livewire\Component;
@@ -26,6 +27,16 @@ class General extends Component
public ?Carbon $certificateValidUntil = null; public ?Carbon $certificateValidUntil = null;
public function getListeners()
{
$userId = Auth::id();
return [
"echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
'refresh' => '$refresh',
];
}
protected $rules = [ protected $rules = [
'database.name' => 'required', 'database.name' => 'required',
'database.description' => 'nullable', 'database.description' => 'nullable',

View File

@@ -8,6 +8,7 @@ use App\Helpers\SslHelper;
use App\Models\Server; use App\Models\Server;
use App\Models\SslCertificate; use App\Models\SslCertificate;
use App\Models\StandaloneMongodb; use App\Models\StandaloneMongodb;
use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use Exception; use Exception;
use Livewire\Component; use Livewire\Component;
@@ -26,6 +27,16 @@ class General extends Component
public ?Carbon $certificateValidUntil = null; public ?Carbon $certificateValidUntil = null;
public function getListeners()
{
$userId = Auth::id();
return [
"echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
'refresh' => '$refresh',
];
}
protected $rules = [ protected $rules = [
'database.name' => 'required', 'database.name' => 'required',
'database.description' => 'nullable', 'database.description' => 'nullable',

View File

@@ -8,6 +8,7 @@ use App\Helpers\SslHelper;
use App\Models\Server; use App\Models\Server;
use App\Models\SslCertificate; use App\Models\SslCertificate;
use App\Models\StandaloneMysql; use App\Models\StandaloneMysql;
use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use Exception; use Exception;
use Livewire\Component; use Livewire\Component;
@@ -26,6 +27,16 @@ class General extends Component
public ?Carbon $certificateValidUntil = null; public ?Carbon $certificateValidUntil = null;
public function getListeners()
{
$userId = Auth::id();
return [
"echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
'refresh' => '$refresh',
];
}
protected $rules = [ protected $rules = [
'database.name' => 'required', 'database.name' => 'required',
'database.description' => 'nullable', 'database.description' => 'nullable',

View File

@@ -8,6 +8,7 @@ use App\Helpers\SslHelper;
use App\Models\Server; use App\Models\Server;
use App\Models\SslCertificate; use App\Models\SslCertificate;
use App\Models\StandalonePostgresql; use App\Models\StandalonePostgresql;
use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use Exception; use Exception;
use Livewire\Component; use Livewire\Component;
@@ -30,8 +31,11 @@ class General extends Component
public function getListeners() public function getListeners()
{ {
$userId = Auth::id();
return [ return [
'refresh', "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
'refresh' => '$refresh',
'save_init_script', 'save_init_script',
'delete_init_script', 'delete_init_script',
]; ];
@@ -204,7 +208,7 @@ class General extends Component
$delete_command = "rm -f $old_file_path"; $delete_command = "rm -f $old_file_path";
try { try {
instant_remote_process([$delete_command], $this->server); instant_remote_process([$delete_command], $this->server);
} catch (\Exception $e) { } catch (Exception $e) {
$this->dispatch('error', 'Failed to remove old init script from server: '.$e->getMessage()); $this->dispatch('error', 'Failed to remove old init script from server: '.$e->getMessage());
return; return;
@@ -245,7 +249,7 @@ class General extends Component
$command = "rm -f $file_path"; $command = "rm -f $file_path";
try { try {
instant_remote_process([$command], $this->server); instant_remote_process([$command], $this->server);
} catch (\Exception $e) { } catch (Exception $e) {
$this->dispatch('error', 'Failed to remove init script from server: '.$e->getMessage()); $this->dispatch('error', 'Failed to remove init script from server: '.$e->getMessage());
return; return;
@@ -262,16 +266,11 @@ class General extends Component
$this->database->init_scripts = $updatedScripts; $this->database->init_scripts = $updatedScripts;
$this->database->save(); $this->database->save();
$this->refresh(); $this->dispatch('refresh')->self();
$this->dispatch('success', 'Init script deleted from the database and the server.'); $this->dispatch('success', 'Init script deleted from the database and the server.');
} }
} }
public function refresh(): void
{
$this->database->refresh();
}
public function save_new_init_script() public function save_new_init_script()
{ {
$this->validate([ $this->validate([

View File

@@ -8,6 +8,7 @@ use App\Helpers\SslHelper;
use App\Models\Server; use App\Models\Server;
use App\Models\SslCertificate; use App\Models\SslCertificate;
use App\Models\StandaloneRedis; use App\Models\StandaloneRedis;
use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use Exception; use Exception;
use Livewire\Component; use Livewire\Component;
@@ -35,6 +36,16 @@ class General extends Component
public ?Carbon $certificateValidUntil = null; public ?Carbon $certificateValidUntil = null;
public function getListeners()
{
$userId = Auth::id();
return [
"echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
'refresh' => '$refresh',
];
}
protected $rules = [ protected $rules = [
'database.name' => 'required', 'database.name' => 'required',
'database.description' => 'nullable', 'database.description' => 'nullable',

View File

@@ -18,6 +18,7 @@ class Select extends Component
public ?string $label = null, public ?string $label = null,
public ?string $helper = null, public ?string $helper = null,
public bool $required = false, public bool $required = false,
public bool $disabled = false,
public string $defaultClass = 'select w-full' public string $defaultClass = 'select w-full'
) { ) {
// //

View File

@@ -46,7 +46,7 @@ body {
.input, .input,
.select { .select {
@apply text-black dark:bg-coolgray-100 dark:text-white ring-neutral-200 dark:ring-coolgray-300 block w-full py-1.5 rounded border-0 text-sm ring-1 ring-inset; @apply text-black dark:bg-coolgray-100 dark:text-white ring-neutral-200 dark:ring-coolgray-300 block w-full py-1.5 rounded border-0 text-sm ring-1 ring-inset disabled:dark:bg-coolgray-100/40 disabled:dark:ring-transparent disabled:bg-neutral-200 disabled:text-neutral-500;
} }
.select { .select {
@@ -97,6 +97,7 @@ label {
@apply dark:text-neutral-400; @apply dark:text-neutral-400;
} }
table { table {
@apply min-w-full divide-y dark:divide-coolgray-200 divide-neutral-300; @apply min-w-full divide-y dark:divide-coolgray-200 divide-neutral-300;
} }

View File

@@ -1,6 +1,7 @@
<div class="w-full"> <div class="w-full">
@if ($label) @if ($label)
<label class="flex gap-1 items-center mb-1 text-sm font-medium">{{ $label }} <label
class="flex gap-1 items-center mb-1 text-sm font-medium {{ $disabled ? 'text-neutral-600' : '' }}">{{ $label }}
@if ($required) @if ($required)
<x-highlighted text="*" /> <x-highlighted text="*" />
@endif @endif
@@ -9,7 +10,7 @@
@endif @endif
</label> </label>
@endif @endif
<select {{ $attributes->merge(['class' => $defaultClass]) }} @required($required) <select {{ $attributes->merge(['class' => $defaultClass]) }} @disabled($disabled) @required($required)
wire:dirty.class.remove='dark:focus:ring-coolgray-300 dark:ring-coolgray-300' wire:dirty.class.remove='dark:focus:ring-coolgray-300 dark:ring-coolgray-300'
wire:dirty.class="dark:focus:ring-warning dark:ring-warning" wire:loading.attr="disabled" name={{ $id }} wire:dirty.class="dark:focus:ring-warning dark:ring-warning" wire:loading.attr="disabled" name={{ $id }}
@if ($attributes->whereStartsWith('wire:model')->first()) {{ $attributes->whereStartsWith('wire:model')->first() }} @else wire:model={{ $id }} @endif> @if ($attributes->whereStartsWith('wire:model')->first()) {{ $attributes->whereStartsWith('wire:model')->first() }} @else wire:model={{ $id }} @endif>

View File

@@ -76,8 +76,16 @@
</span> </span>
@endif @endif
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<div class="w-64">
@if (str($database->status)->contains('exited'))
<x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl" <x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl"
instantSave="instantSaveSSL" /> instantSave="instantSaveSSL" />
@else
<x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl"
instantSave="instantSaveSSL" disabled
helper="Database should be stopped to change this settings." />
@endif
</div>
</div> </div>
</div> </div>
<div> <div>

View File

@@ -53,34 +53,39 @@
<div class="flex items-center justify-between py-2"> <div class="flex items-center justify-between py-2">
<div class="flex items-center justify-between w-full"> <div class="flex items-center justify-between w-full">
<h3>SSL Configuration</h3> <h3>SSL Configuration</h3>
@if($database->enable_ssl && $certificateValidUntil) @if ($database->enable_ssl && $certificateValidUntil)
<x-modal-confirmation <x-modal-confirmation title="Regenerate SSL Certificates"
title="Regenerate SSL Certificates" buttonTitle="Regenerate SSL Certificates" :actions="[
buttonTitle="Regenerate SSL Certificates"
:actions="[
'The SSL certificate of this database will be regenerated.', 'The SSL certificate of this database will be regenerated.',
'You must restart the database after regenerating the certificate to start using the new certificate.' 'You must restart the database after regenerating the certificate to start using the new certificate.',
]" ]"
submitAction="regenerateSslCertificate" submitAction="regenerateSslCertificate" :confirmWithText="false" :confirmWithPassword="false" />
:confirmWithText="false"
:confirmWithPassword="false"
/>
@endif @endif
</div> </div>
</div> </div>
@if($database->enable_ssl && $certificateValidUntil) @if ($database->enable_ssl && $certificateValidUntil)
<span class="text-sm">Valid until: <span class="text-sm">Valid until:
@if(now()->gt($certificateValidUntil)) @if (now()->gt($certificateValidUntil))
<span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span> <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>
@elseif(now()->addDays(30)->gt($certificateValidUntil)) @elseif(now()->addDays(30)->gt($certificateValidUntil))
<span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon</span> <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring
soon</span>
@else @else
<span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span> <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>
@endif @endif
</span> </span>
@endif @endif
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl" instantSave="instantSaveSSL" /> <div class="w-64">
@if (str($database->status)->contains('exited'))
<x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl"
instantSave="instantSaveSSL" />
@else
<x-forms.checkbox id="enable_ssl" label="Enable SSL" wire:model.live="enable_ssl"
instantSave="instantSaveSSL" disabled
helper="Database should be stopped to change this settings." />
@endif
</div>
</div> </div>
</div> </div>
<div> <div>

View File

@@ -70,24 +70,23 @@
<div class="flex items-center justify-between py-2"> <div class="flex items-center justify-between py-2">
<div class="flex items-center justify-between w-full"> <div class="flex items-center justify-between w-full">
<h3>SSL Configuration</h3> <h3>SSL Configuration</h3>
@if($database->enable_ssl && $certificateValidUntil) @if ($database->enable_ssl && $certificateValidUntil)
<x-modal-confirmation <x-modal-confirmation title="Regenerate SSL Certificates"
title="Regenerate SSL Certificates" buttonTitle="Regenerate SSL Certificates" :actions="[
buttonTitle="Regenerate SSL Certificates" 'The SSL certificate of this database will be regenerated.',
:actions="['The SSL certificate of this database will be regenerated.','You must restart the database after regenerating the certificate to start using the new certificate.']" 'You must restart the database after regenerating the certificate to start using the new certificate.',
submitAction="regenerateSslCertificate" ]"
:confirmWithText="false" submitAction="regenerateSslCertificate" :confirmWithText="false" :confirmWithPassword="false" />
:confirmWithPassword="false"
/>
@endif @endif
</div> </div>
</div> </div>
@if($database->enable_ssl && $certificateValidUntil) @if ($database->enable_ssl && $certificateValidUntil)
<span class="text-sm">Valid until: <span class="text-sm">Valid until:
@if(now()->gt($certificateValidUntil)) @if (now()->gt($certificateValidUntil))
<span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span> <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>
@elseif(now()->addDays(30)->gt($certificateValidUntil)) @elseif(now()->addDays(30)->gt($certificateValidUntil))
<span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon</span> <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring
soon</span>
@else @else
<span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span> <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>
@endif @endif
@@ -96,7 +95,16 @@
</div> </div>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" /> <div class="w-64">
@if (str($database->status)->contains('exited'))
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
@else
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" disabled
helper="Database should be stopped to change this settings." />
@endif
</div>
</div> </div>
</div> </div>

View File

@@ -85,21 +85,42 @@
</div> </div>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl" {{ $database->status }}
instantSave="instantSaveSSL" />
<div class="w-64">
@if (str($database->status)->contains('exited'))
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
@else
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" disabled
helper="Database should be stopped to change this settings." />
@endif
</div>
@if ($database->enable_ssl) @if ($database->enable_ssl)
<div class="mx-2"> <div class="mx-2">
@if (str($database->status)->contains('exited'))
<x-forms.select id="database.ssl_mode" label="SSL Mode" wire:model.live="database.ssl_mode" <x-forms.select id="database.ssl_mode" label="SSL Mode" wire:model.live="database.ssl_mode"
instantSave="instantSaveSSL" instantSave="instantSaveSSL"
helper="Choose the SSL verification mode for MongoDB connections"> helper="Choose the SSL verification mode for MongoDB connections">
<option value="allow" title="Allow insecure connections">allow (insecure)</option> <option value="allow" title="Allow insecure connections">allow (insecure)</option>
<option value="prefer" title="Prefer secure connections">prefer (secure)</option> <option value="prefer" title="Prefer secure connections">prefer (secure)</option>
<option value="require" title="Require secure connections">require (secure)</option> <option value="require" title="Require secure connections">require (secure)</option>
<option value="verify-full" title="Verify full certificate">verify-full (secure)</option> <option value="verify-full" title="Verify full certificate">verify-full (secure)
</option>
</x-forms.select>
@else
<x-forms.select id="database.ssl_mode" label="SSL Mode" instantSave="instantSaveSSL"
disabled helper="Database should be stopped to change this settings.">
<option value="allow" title="Allow insecure connections">allow (insecure)</option>
<option value="prefer" title="Prefer secure connections">prefer (secure)</option>
<option value="require" title="Require secure connections">require (secure)</option>
<option value="verify-full" title="Verify full certificate">verify-full (secure)
</option>
</x-forms.select> </x-forms.select>
</div>
@endif @endif
</div> </div>
@endif
</div> </div>
<div> <div>

View File

@@ -95,10 +95,19 @@
</div> </div>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl" <div class="w-64">
instantSave="instantSaveSSL" /> @if (str($database->status)->contains('exited'))
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
@else
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" disabled
helper="Database should be stopped to change this settings." />
@endif
</div>
@if ($database->enable_ssl) @if ($database->enable_ssl)
<div class="mx-2"> <div class="mx-2">
@if (str($database->status)->contains('exited'))
<x-forms.select id="database.ssl_mode" label="SSL Mode" wire:model.live="database.ssl_mode" <x-forms.select id="database.ssl_mode" label="SSL Mode" wire:model.live="database.ssl_mode"
instantSave="instantSaveSSL" instantSave="instantSaveSSL"
helper="Choose the SSL verification mode for MySQL connections"> helper="Choose the SSL verification mode for MySQL connections">
@@ -108,6 +117,16 @@
<option value="VERIFY_IDENTITY" title="Verify full certificate">Verify Full (secure) <option value="VERIFY_IDENTITY" title="Verify full certificate">Verify Full (secure)
</option> </option>
</x-forms.select> </x-forms.select>
@else
<x-forms.select id="database.ssl_mode" label="SSL Mode" instantSave="instantSaveSSL"
disabled helper="Database should be stopped to change this settings.">
<option value="PREFERRED" title="Prefer secure connections">Prefer (secure)</option>
<option value="REQUIRED" title="Require secure connections">Require (secure)</option>
<option value="VERIFY_CA" title="Verify CA certificate">Verify CA (secure)</option>
<option value="VERIFY_IDENTITY" title="Verify full certificate">Verify Full (secure)
</option>
</x-forms.select>
@endif
</div> </div>
@endif @endif
</div> </div>

View File

@@ -102,23 +102,42 @@
</div> </div>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl" <div class="w-64" wire:key='enable_ssl'>
instantSave="instantSaveSSL" /> @if ($database->isExited())
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
@else
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" disabled
helper="Database should be stopped to change this settings." />
@endif
</div>
@if ($database->enable_ssl) @if ($database->enable_ssl)
<div class="mx-2"> <div class="mx-2">
<x-forms.select id="database.ssl_mode" label="SSL Mode" wire:model.live="database.ssl_mode" @if ($database->isExited())
instantSave="instantSaveSSL" <x-forms.select id="database.ssl_mode" label="SSL Mode"
wire:model.live="database.ssl_mode" instantSave="instantSaveSSL"
helper="Choose the SSL verification mode for PostgreSQL connections"> helper="Choose the SSL verification mode for PostgreSQL connections">
<option value="allow" title="Allow insecure connections">allow (insecure)</option> <option value="allow" title="Allow insecure connections">allow (insecure)</option>
<option value="prefer" title="Prefer secure connections">prefer (secure)</option> <option value="prefer" title="Prefer secure connections">prefer (secure)</option>
<option value="require" title="Require secure connections">require (secure)</option> <option value="require" title="Require secure connections">require (secure)</option>
<option value="verify-ca" title="Verify CA certificate">verify-ca (secure)</option> <option value="verify-ca" title="Verify CA certificate">verify-ca (secure)</option>
<option value="verify-full" title="Verify full certificate">verify-full (secure)</option> <option value="verify-full" title="Verify full certificate">verify-full (secure)
</option>
</x-forms.select>
@else
<x-forms.select id="database.ssl_mode" label="SSL Mode" instantSave="instantSaveSSL"
disabled helper="Database should be stopped to change this settings.">
<option value="allow" title="Allow insecure connections">allow (insecure)</option>
<option value="prefer" title="Prefer secure connections">prefer (secure)</option>
<option value="require" title="Require secure connections">require (secure)</option>
<option value="verify-ca" title="Verify CA certificate">verify-ca (secure)</option>
<option value="verify-full" title="Verify full certificate">verify-full (secure)
</option>
</x-forms.select> </x-forms.select>
</div>
@endif @endif
</div> </div>
</div> @endif
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<div class="flex items-center justify-between py-2"> <div class="flex items-center justify-between py-2">
@@ -146,7 +165,8 @@
</div> </div>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<x-forms.textarea label="Custom PostgreSQL Configuration" rows="10" id="database.postgres_conf" /> <x-forms.textarea label="Custom PostgreSQL Configuration" rows="10"
id="database.postgres_conf" />
</div> </div>
</form> </form>

View File

@@ -53,34 +53,39 @@
<div class="flex items-center justify-between py-2"> <div class="flex items-center justify-between py-2">
<div class="flex items-center justify-between w-full"> <div class="flex items-center justify-between w-full">
<h3>SSL Configuration</h3> <h3>SSL Configuration</h3>
@if($database->enable_ssl && $certificateValidUntil) @if ($database->enable_ssl && $certificateValidUntil)
<x-modal-confirmation <x-modal-confirmation title="Regenerate SSL Certificates"
title="Regenerate SSL Certificates" buttonTitle="Regenerate SSL Certificates" :actions="[
buttonTitle="Regenerate SSL Certificates"
:actions="[
'The SSL certificate of this database will be regenerated.', 'The SSL certificate of this database will be regenerated.',
'You must restart the database after regenerating the certificate to start using the new certificate.' 'You must restart the database after regenerating the certificate to start using the new certificate.',
]" ]"
submitAction="regenerateSslCertificate" submitAction="regenerateSslCertificate" :confirmWithText="false" :confirmWithPassword="false" />
:confirmWithText="false"
:confirmWithPassword="false"
/>
@endif @endif
</div> </div>
</div> </div>
@if($database->enable_ssl && $certificateValidUntil) @if ($database->enable_ssl && $certificateValidUntil)
<span class="text-sm">Valid until: <span class="text-sm">Valid until:
@if(now()->gt($certificateValidUntil)) @if (now()->gt($certificateValidUntil))
<span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span> <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>
@elseif(now()->addDays(30)->gt($certificateValidUntil)) @elseif(now()->addDays(30)->gt($certificateValidUntil))
<span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon</span> <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring
soon</span>
@else @else
<span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span> <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>
@endif @endif
</span> </span>
@endif @endif
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" /> <div class="w-64" wire:key='enable_ssl'>
@if (str($database->status)->contains('exited'))
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
@else
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL"
wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" disabled
helper="Database should be stopped to change this settings." />
@endif
</div>
</div> </div>
</div> </div>
<div> <div>