Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Moved terminal access settings to security page

ShadowArcanist299db159cb3e
diff --git a/app/Livewire/Server/Advanced.php b/app/Livewire/Server/Advanced.php
index 760c4df0d5..bbc3bd96a2 100644
--- a/app/Livewire/Server/Advanced.php
+++ b/app/Livewire/Server/Advanced.php
@@ -27,9 +27,6 @@ class Advanced extends Component
#[Validate(['integer', 'min:1'])]
public int $dynamicTimeout = 1;
- #[Validate(['boolean'])]
- public bool $isTerminalEnabled = false;
-
public function mount(string $server_uuid)
{
try {
@@ -42,36 +39,7 @@ class Advanced extends Component
}
}
- public function toggleTerminal($password)
- {
- try {
- // Check if user is admin or owner
- if (! auth()->user()->isAdmin()) {
- throw new \Exception('Only team administrators and owners can modify terminal access.');
- }
-
- // Verify password unless two-step confirmation is disabled
- if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
- if (! Hash::check($password, Auth::user()->password)) {
- $this->addError('password', 'The provided password is incorrect.');
-
- return;
- }
- }
-
- // Toggle the terminal setting
- $this->server->settings->is_terminal_enabled = ! $this->server->settings->is_terminal_enabled;
- $this->server->settings->save();
-
- // Update the local property
- $this->isTerminalEnabled = $this->server->settings->is_terminal_enabled;
- $status = $this->isTerminalEnabled ? 'enabled' : 'disabled';
- $this->dispatch('success', "Terminal access has been {$status}.");
- } catch (\Throwable $e) {
- return handleError($e, $this);
- }
- }
public function syncData(bool $toModel = false)
{
@@ -88,7 +56,6 @@ class Advanced extends Component
$this->dynamicTimeout = $this->server->settings->dynamic_timeout;
$this->serverDiskUsageNotificationThreshold = $this->server->settings->server_disk_usage_notification_threshold;
$this->serverDiskUsageCheckFrequency = $this->server->settings->server_disk_usage_check_frequency;
- $this->isTerminalEnabled = $this->server->settings->is_terminal_enabled;
}
}
diff --git a/app/Livewire/Server/Security/TerminalAccess.php b/app/Livewire/Server/Security/TerminalAccess.php
new file mode 100644
index 0000000000..c5898314bc
--- /dev/null
+++ b/app/Livewire/Server/Security/TerminalAccess.php
@@ -0,0 +1,79 @@
+<?php
+
+namespace App\Livewire\Server\Security;
+
+use App\Models\InstanceSettings;
+use App\Models\Server;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
+use Livewire\Attributes\Validate;
+use Livewire\Component;
+
+class TerminalAccess extends Component
+{
+ public Server $server;
+
+ public array $parameters = [];
+
+ #[Validate(['boolean'])]
+ public bool $isTerminalEnabled = false;
+
+ public function mount(string $server_uuid)
+ {
+ try {
+ $this->server = Server::ownedByCurrentTeam()->whereUuid($server_uuid)->firstOrFail();
+ $this->parameters = get_route_parameters();
+ $this->syncData();
+
+ } catch (\Throwable) {
+ return redirect()->route('server.index');
+ }
+ }
+
+ public function toggleTerminal($password)
+ {
+ try {
+ // Check if user is admin or owner
+ if (! auth()->user()->isAdmin()) {
+ throw new \Exception('Only team administrators and owners can modify terminal access.');
+ }
+
+ // Verify password unless two-step confirmation is disabled
+ if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
+ if (! Hash::check($password, Auth::user()->password)) {
+ $this->addError('password', 'The provided password is incorrect.');
+
+ return;
+ }
+ }
+
+ // Toggle the terminal setting
+ $this->server->settings->is_terminal_enabled = ! $this->server->settings->is_terminal_enabled;
+ $this->server->settings->save();
+
+ // Update the local property
+ $this->isTerminalEnabled = $this->server->settings->is_terminal_enabled;
+
+ $status = $this->isTerminalEnabled ? 'enabled' : 'disabled';
+ $this->dispatch('success', "Terminal access has been {$status}.");
+ } catch (\Throwable $e) {
+ return handleError($e, $this);
+ }
+ }
+
+ public function syncData(bool $toModel = false)
+ {
+ if ($toModel) {
+ $this->authorize('update', $this->server);
+ $this->validate();
+ // No other fields to sync for terminal access
+ } else {
+ $this->isTerminalEnabled = $this->server->settings->is_terminal_enabled;
+ }
+ }
+
+ public function render()
+ {
+ return view('livewire.server.security.terminal-access');
+ }
+}
\ No newline at end of file
diff --git a/resources/views/components/server/sidebar-security.blade.php b/resources/views/components/server/sidebar-security.blade.php
index 6f6d9d8a09..141d32f3b3 100644
--- a/resources/views/components/server/sidebar-security.blade.php
+++ b/resources/views/components/server/sidebar-security.blade.php
@@ -3,4 +3,8 @@
href="{{ route('server.security.patches', $parameters) }}">
Server Patching
</a>
+ <a class="{{ request()->routeIs('server.security.terminal-access') ? 'menu-item menu-item-active' : 'menu-item' }}"
+ href="{{ route('server.security.terminal-access', $parameters) }}">
+ Terminal Access
+ </a>
</div>
diff --git a/resources/views/livewire/server/advanced.blade.php b/resources/views/livewire/server/advanced.blade.php
index 308a9eed22..6622961c5c 100644
--- a/resources/views/livewire/server/advanced.blade.php
+++ b/resources/views/livewire/server/advanced.blade.php
@@ -14,47 +14,6 @@
<div class="mb-4">Advanced configuration for your server.</div>
</div>
- <div class="flex items-center gap-2">
- <h3>Terminal Access</h3>
- <x-helper
- helper="Control whether terminal access is available for this server and its containers.<br/>Only team
- administrators and owners can modify this setting." />
- @if ($isTerminalEnabled)
- <span
- class="px-2 py-1 text-xs font-semibold text-green-800 bg-green-100 rounded dark:text-green-100 dark:bg-green-800">
- Enabled
- </span>
- @else
- <span
- class="px-2 py-1 text-xs font-semibold text-red-800 bg-red-100 rounded dark:text-red-100 dark:bg-red-800">
- Disabled
- </span>
- @endif
- </div>
- <div class="flex flex-col gap-4">
- <div class="flex items-center gap-4 pt-4">
- @if (auth()->user()->isAdmin())
- <div wire:key="terminal-access-change-{{ $isTerminalEnabled }}" class="pb-4">
- <x-modal-confirmation title="Confirm Terminal Access Change?"
- temporaryDisableTwoStepConfirmation
- buttonTitle="{{ $isTerminalEnabled ? 'Disable Terminal' : 'Enable Terminal' }}"
- submitAction="toggleTerminal" :actions="[
- $isTerminalEnabled
- ? 'This will disable terminal access for this server and all its containers.'
- : 'This will enable terminal access for this server and all its containers.',
- $isTerminalEnabled
- ? 'Users will no longer be able to access terminal views from the UI.'
- : 'Users will be able to access terminal views from the UI.',
- 'This change will take effect immediately.',
- ]" confirmationText="{{ $server->name }}"
- shortConfirmationLabel="Server Name"
- step3ButtonText="{{ $isTerminalEnabled ? 'Disable Terminal' : 'Enable Terminal' }}">
- </x-modal-confirmation>
- </div>
- @endif
- </div>
- </div>
-
<h3>Disk Usage</h3>
<div class="flex flex-col gap-6">
<div class="flex flex-col">
diff --git a/resources/views/livewire/server/security/terminal-access.blade.php b/resources/views/livewire/server/security/terminal-access.blade.php
new file mode 100644
index 0000000000..81e9482f18
--- /dev/null
+++ b/resources/views/livewire/server/security/terminal-access.blade.php
@@ -0,0 +1,58 @@
+<div>
+ <x-slot:title>
+ {{ data_get_str($server, 'name')->limit(10) }} > Terminal Access | Coolify
+ </x-slot>
+ <livewire:server.navbar :server="$server" />
+ <div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'general' }" class="flex flex-col h-full gap-8 sm:flex-row">
+ <x-server.sidebar-security :server="$server" :parameters="$parameters" />
+ <div class="w-full">
+ <div>
+ <div class="flex items-center gap-2">
+ <h2>Terminal Access</h2>
+ </div>
+ <div class="mb-4">Control terminal access for this server and its containers.</div>
+ </div>
+
+ <div class="flex items-center gap-2">
+ <h3>Terminal Access</h3>
+ <x-helper
+ helper="Control whether terminal access is available for this server and its containers.<br/>Only team
+ administrators and owners can modify this setting." />
+ @if ($isTerminalEnabled)
+ <span
+ class="px-2 py-1 text-xs font-semibold text-green-800 bg-green-100 rounded dark:text-green-100 dark:bg-green-800">
+ Enabled
+ </span>
+ @else
+ <span
+ class="px-2 py-1 text-xs font-semibold text-red-800 bg-red-100 rounded dark:text-red-100 dark:bg-red-800">
+ Disabled
+ </span>
+ @endif
+ </div>
+ <div class="flex flex-col gap-4">
+ <div class="flex items-center gap-4 pt-4">
+ @if (auth()->user()->isAdmin())
+ <div wire:key="terminal-access-change-{{ $isTerminalEnabled }}" class="pb-4">
+ <x-modal-confirmation title="Confirm Terminal Access Change?"
+ temporaryDisableTwoStepConfirmation
+ buttonTitle="{{ $isTerminalEnabled ? 'Disable Terminal' : 'Enable Terminal' }}"
+ submitAction="toggleTerminal" :actions="[
+ $isTerminalEnabled
+ ? 'This will disable terminal access for this server and all its containers.'
+ : 'This will enable terminal access for this server and all its containers.',
+ $isTerminalEnabled
+ ? 'Users will no longer be able to access terminal views from the UI.'
+ : 'Users will be able to access terminal views from the UI.',
+ 'This change will take effect immediately.',
+ ]" confirmationText="{{ $server->name }}"
+ shortConfirmationLabel="Server Name"
+ step3ButtonText="{{ $isTerminalEnabled ? 'Disable Terminal' : 'Enable Terminal' }}">
+ </x-modal-confirmation>
+ </div>
+ @endif
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/routes/web.php b/routes/web.php
index e6567daadf..fd2ed87306 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -51,6 +51,7 @@ use App\Livewire\Server\Proxy\Logs as ProxyLogs;
use App\Livewire\Server\Proxy\Show as ProxyShow;
use App\Livewire\Server\Resources as ResourcesShow;
use App\Livewire\Server\Security\Patches;
+use App\Livewire\Server\Security\TerminalAccess;
use App\Livewire\Server\Show as ServerShow;
use App\Livewire\Settings\Advanced as SettingsAdvanced;
use App\Livewire\Settings\Index as SettingsIndex;
@@ -260,6 +261,7 @@ Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/docker-cleanup', DockerCleanup::class)->name('server.docker-cleanup');
Route::get('/security', fn () => redirect(route('dashboard')))->name('server.security')->middleware('can.update.resource');
Route::get('/security/patches', Patches::class)->name('server.security.patches')->middleware('can.update.resource');
+ Route::get('/security/terminal-access', TerminalAccess::class)->name('server.security.terminal-access')->middleware('can.update.resource');
});
Route::get('/destinations', DestinationIndex::class)->name('destination.index');
Route::get('/destination/{destination_uuid}', DestinationShow::class)->name('destination.show');