ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Run commands via privileged helpers; UI tweaks
Juan Denis7037ef345a20
diff --git a/backend/app/services/log_service.py b/backend/app/services/log_service.pyindex 441b4a90..4d318415 100644--- a/backend/app/services/log_service.py+++ b/backend/app/services/log_service.py@@ -7,6 +7,7 @@ import threadingimport queuefrom app import paths+from app.utils.system import run_privileged, privileged_cmd, is_command_availableclass LogService:@@ -81,22 +82,11 @@ class LogService:return {'success': False, 'error': 'Log file not found'}try:- if from_end:- # Use tail to get last N lines- result = subprocess.run(- ['sudo', 'tail', '-n', str(lines), filepath],- capture_output=True,- text=True,- timeout=30- )- else:- # Use head to get first N lines- result = subprocess.run(- ['sudo', 'head', '-n', str(lines), filepath],- capture_output=True,- text=True,- timeout=30- )+ tool = 'tail' if from_end else 'head'+ result = run_privileged(+ [tool, '-n', str(lines), filepath],+ timeout=30+ )if result.returncode == 0:log_lines = result.stdout.split('\n')@@ -109,6 +99,8 @@ class LogService:else:return {'success': False, 'error': result.stderr}+ except FileNotFoundError:+ return {'success': False, 'error': f'{tool} command not found'}except Exception as e:return {'success': False, 'error': str(e)}@@ -122,10 +114,8 @@ class LogService:return {'success': False, 'error': 'Log file not found'}try:- result = subprocess.run(- ['sudo', 'grep', '-i', '-m', str(lines), pattern, filepath],- capture_output=True,- text=True,+ result = run_privileged(+ ['grep', '-i', '-m', str(lines), pattern, filepath],timeout=60)@@ -141,6 +131,8 @@ class LogService:else:return {'success': False, 'error': result.stderr}+ except FileNotFoundError:+ return {'success': False, 'error': 'grep command not found'}except Exception as e:return {'success': False, 'error': str(e)}@@ -222,8 +214,11 @@ class LogService:def get_journalctl_logs(cls, unit: str = None, lines: int = 100,since: str = None, priority: str = None) -> Dict:"""Get logs from systemd journal."""+ if not is_command_available('journalctl'):+ return {'success': False, 'error': 'journalctl is not available on this system'}+try:- cmd = ['sudo', 'journalctl', '-n', str(lines), '--no-pager', '-o', 'short-iso']+ cmd = ['journalctl', '-n', str(lines), '--no-pager', '-o', 'short-iso']if unit:cmd.extend(['-u', unit])@@ -232,7 +227,7 @@ class LogService:if priority:cmd.extend(['-p', priority])- result = subprocess.run(cmd, capture_output=True, text=True, timeout=60)+ result = run_privileged(cmd, timeout=60)if result.returncode == 0:log_lines = result.stdout.split('\n')@@ -244,6 +239,8 @@ class LogService:else:return {'success': False, 'error': result.stderr}+ except FileNotFoundError:+ return {'success': False, 'error': 'journalctl command not found'}except Exception as e:return {'success': False, 'error': str(e)}@@ -257,10 +254,8 @@ class LogService:return {'success': False, 'error': 'Log file not found'}try:- result = subprocess.run(- ['sudo', 'truncate', '-s', '0', filepath],- capture_output=True,- text=True+ result = run_privileged(+ ['truncate', '-s', '0', filepath])if result.returncode == 0:@@ -268,6 +263,8 @@ class LogService:else:return {'success': False, 'error': result.stderr}+ except FileNotFoundError:+ return {'success': False, 'error': 'truncate command not found'}except Exception as e:return {'success': False, 'error': str(e)}@@ -275,10 +272,8 @@ class LogService:def rotate_logs(cls) -> Dict:"""Trigger log rotation."""try:- result = subprocess.run(- ['sudo', 'logrotate', '-f', '/etc/logrotate.conf'],- capture_output=True,- text=True,+ result = run_privileged(+ ['logrotate', '-f', '/etc/logrotate.conf'],timeout=120)@@ -286,6 +281,8 @@ class LogService:'success': result.returncode == 0,'message': 'Logs rotated' if result.returncode == 0 else result.stderr}+ except FileNotFoundError:+ return {'success': False, 'error': 'logrotate command not found'}except Exception as e:return {'success': False, 'error': str(e)}@@ -302,7 +299,7 @@ class LogService:try:process = subprocess.Popen(- ['sudo', 'tail', '-f', '-n', '0', filepath],+ privileged_cmd(['tail', '-f', '-n', '0', filepath]),stdout=subprocess.PIPE,stderr=subprocess.PIPE,text=Truediff --git a/backend/app/services/process_service.py b/backend/app/services/process_service.pyindex bb424433..af1da4b3 100644--- a/backend/app/services/process_service.py+++ b/backend/app/services/process_service.py@@ -3,6 +3,8 @@ import subprocessimport platformfrom typing import List, Dict, Optional+from app.utils.system import run_privileged, is_command_available+class ProcessService:"""Service for process and service management."""@@ -129,13 +131,15 @@ class ProcessService:try:if system == 'Linux':# Try systemctl first (systemd)- cmd = ['sudo', 'systemctl', action, service_name]- result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)+ result = run_privileged(+ ['systemctl', action, service_name], timeout=30+ )if result.returncode != 0:# Fall back to service command- cmd = ['sudo', 'service', service_name, action]- result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)+ result = run_privileged(+ ['service', service_name, action], timeout=30+ )if result.returncode == 0:return {'success': True, 'message': f'Service {service_name} {action} successful'}@@ -158,6 +162,8 @@ class ProcessService:else:return {'success': False, 'error': f'Unsupported platform: {system}'}+ except FileNotFoundError:+ return {'success': False, 'error': 'systemctl/service command not found'}except subprocess.TimeoutExpired:return {'success': False, 'error': 'Command timed out'}except Exception as e:@@ -170,9 +176,13 @@ class ProcessService:try:if system == 'Linux':- # Use journalctl for systemd services- cmd = ['sudo', 'journalctl', '-u', service_name, '-n', str(lines), '--no-pager']- result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)+ if not is_command_available('journalctl'):+ return {'success': False, 'error': 'journalctl is not available on this system'}++ result = run_privileged(+ ['journalctl', '-u', service_name, '-n', str(lines), '--no-pager'],+ timeout=30+ )if result.returncode == 0:return {'success': True, 'logs': result.stdout}@@ -182,5 +192,7 @@ class ProcessService:else:return {'success': False, 'error': 'Log retrieval not supported on this platform'}+ except FileNotFoundError:+ return {'success': False, 'error': 'journalctl command not found'}except Exception as e:return {'success': False, 'error': str(e)}diff --git a/backend/app/utils/system.py b/backend/app/utils/system.pyindex 84231ab2..1c58ea86 100644--- a/backend/app/utils/system.py+++ b/backend/app/utils/system.py@@ -10,27 +10,50 @@ import subprocessfrom typing import List, Optional, Union+def _needs_sudo() -> bool:+ """Return True if the current process should prepend sudo to commands.++ Returns False when:+ - Running on Windows (no sudo concept; dev environment)+ - Already running as root (e.g. inside Docker)+ - ``sudo`` is not installed (minimal containers)+ """+ if os.name == 'nt':+ return False+ if os.geteuid() == 0:+ return False+ if not shutil.which('sudo'):+ return False+ return True+++def privileged_cmd(cmd: Union[List[str], str]) -> Union[List[str], str]:+ """Return *cmd* with ``sudo`` prepended when necessary.++ Use this when you need the command list for ``Popen`` or other non-``run``+ callers. For simple ``subprocess.run`` calls prefer :func:`run_privileged`.+ """+ if isinstance(cmd, str):+ if _needs_sudo() and not cmd.lstrip().startswith('sudo '):+ return f'sudo {cmd}'+ return cmd++ cmd = list(cmd)+ if _needs_sudo() and cmd[0] != 'sudo':+ return ['sudo'] + cmd+ return cmd++def run_privileged(cmd: Union[List[str], str], **kwargs) -> subprocess.CompletedProcess:"""Run a command with sudo if the current process is not root.- Prepends ``sudo`` when ``os.geteuid() != 0`` and the command does not- already start with ``sudo``. Defaults to ``capture_output=True, text=True``- but callers can override any kwarg.+ Prepends ``sudo`` only when needed (not root, not Windows, sudo exists).+ Defaults to ``capture_output=True, text=True`` but callers can override.Returns the raw ``CompletedProcess`` so services keep their existingerror-handling patterns."""- if isinstance(cmd, str):- # Shell-mode — caller is responsible for quoting- needs_sudo = os.geteuid() != 0 and not cmd.lstrip().startswith('sudo ')- if needs_sudo:- cmd = f'sudo {cmd}'- else:- cmd = list(cmd)- needs_sudo = os.geteuid() != 0 and cmd[0] != 'sudo'- if needs_sudo:- cmd = ['sudo'] + cmd-+ cmd = privileged_cmd(cmd)kwargs.setdefault('capture_output', True)kwargs.setdefault('text', True)return subprocess.run(cmd, **kwargs)diff --git a/frontend/src/pages/Downloads.jsx b/frontend/src/pages/Downloads.jsxindex 2f32f054..dca94cc5 100644--- a/frontend/src/pages/Downloads.jsx+++ b/frontend/src/pages/Downloads.jsx@@ -3,8 +3,23 @@ import api from '../services/api';// Platform icons as SVG componentsconst LinuxIcon = () => (- <svg viewBox="0 0 24 24" fill="currentColor" className="platform-icon">- <path d="M12.504 0c-.155 0-.315.008-.48.021-4.226.333-3.105 4.807-3.17 6.298-.076 1.092-.3 1.953-1.05 3.02-.885 1.051-2.127 2.75-2.716 4.521-.278.832-.41 1.684-.287 2.489a.424.424 0 00-.11.135c-.26.268-.45.6-.663.839-.199.199-.485.267-.797.4-.313.136-.658.269-.864.68-.09.189-.136.394-.132.602 0 .199.027.4.055.536.058.399.116.728.04.97-.249.68-.28 1.145-.106 1.484.174.334.535.47.94.601.81.2 1.91.135 2.774.6.926.466 1.866.67 2.616.47.526-.116.97-.464 1.208-.946.587-.003 1.23-.269 2.26-.334.699-.058 1.574.267 2.577.2.025.134.063.198.114.333l.003.003c.391.778 1.113 1.132 1.884 1.071.771-.06 1.592-.536 2.257-1.306.631-.765 1.683-1.084 2.378-1.503.348-.199.629-.469.649-.853.023-.4-.2-.811-.714-1.376v-.097l-.003-.003c-.17-.2-.25-.535-.338-.926-.085-.401-.182-.786-.492-1.046h-.003c-.059-.054-.123-.067-.188-.135a.357.357 0 00-.19-.064c.431-1.278.264-2.55-.173-3.694-.533-1.41-1.465-2.638-2.175-3.483-.796-1.005-1.576-1.957-1.56-3.368.026-2.152.236-6.133-3.544-6.139zm.529 3.405h.013c.213 0 .396.062.584.198.19.135.33.332.438.533.105.259.158.459.166.724 0-.02.006-.04.006-.06v.105a.086.086 0 01-.004-.021l-.004-.024a1.807 1.807 0 01-.15.706.953.953 0 01-.213.335.71.71 0 00-.088-.042c-.104-.045-.198-.064-.284-.133a1.312 1.312 0 00-.22-.066c.05-.06.146-.133.183-.198.053-.128.082-.264.088-.402v-.02a1.21 1.21 0 00-.061-.4c-.045-.134-.101-.2-.183-.333-.084-.066-.167-.132-.267-.132h-.016c-.093 0-.176.03-.262.132a.8.8 0 00-.205.334 1.18 1.18 0 00-.09.468v.018c0 .138.033.267.094.4.063.135.155.2.258.274-.246-.006-.33-.025-.416-.135-.09-.132-.132-.298-.138-.468v-.006c-.014-.2.02-.402.074-.6.054-.2.128-.4.232-.535.104-.133.244-.2.388-.2zm-.869.19c-.135.057-.264.134-.372.2a2.645 2.645 0 00-.298.274c-.132.135-.264.298-.4.398a.71.71 0 01-.118.067c.034-.135.092-.269.16-.402.065-.134.146-.267.232-.4.09-.132.194-.265.3-.332a.882.882 0 01.494-.132h.002zm3.086 2.932c-.02.066-.034.135-.034.2v.066c.014.066.027.2.027.265.014.066.014.2.014.265 0 .066-.014.132-.014.2-.014.132-.04.2-.055.265l-.015.002a.193.193 0 00-.054-.006l-.03.002h-.028c-.014 0-.014 0-.028.002l-.028.002h-.028c-.014 0-.014.002-.029.002h-.056c-.014.002-.014.002-.028.002h-.056c-.014.002-.028.002-.042.002h-.014c-.016 0-.029-.002-.043-.002a.256.256 0 01-.057-.004h-.014a.25.25 0 01-.071-.014h-.014a.146.146 0 01-.057-.029h-.014c-.014-.014-.028-.014-.043-.029-.014-.014-.028-.014-.043-.029h-.014c-.014-.014-.028-.028-.043-.043l-.014-.014a.189.189 0 01-.028-.043l-.015-.014c0-.014-.014-.028-.014-.043l-.014-.014c0-.014-.014-.029-.014-.043l-.015-.029a.17.17 0 01-.014-.042l-.014-.029a.17.17 0 01-.014-.042c-.014-.072-.028-.2-.028-.265-.014-.066-.014-.2-.014-.265 0-.066.014-.2.028-.265.014-.066.028-.135.042-.2.028-.066.056-.2.085-.265.014-.066.056-.132.085-.2.028-.066.07-.132.098-.2.028-.065.07-.132.098-.2.042-.066.085-.132.127-.198.029-.066.085-.132.127-.198.043-.066.085-.132.127-.198.043-.066.099-.132.155-.2.057-.066.098-.132.156-.2.056-.066.112-.132.168-.198.057-.066.113-.132.17-.198a2.37 2.37 0 01.183-.198l.183-.2c.057-.066.127-.132.184-.198l.09-.1c.074-.068.143-.134.214-.2.07-.066.14-.132.212-.198.07-.066.143-.132.214-.198.07-.066.142-.132.214-.2.07-.066.156-.132.226-.2.071-.066.156-.132.226-.2.072-.066.156-.132.227-.2.07-.066.155-.132.226-.2l.112-.1a4.98 4.98 0 01.23-.2l.226-.2c.07-.068.155-.134.226-.2l.056-.05a.17.17 0 01.084-.068l.043-.014c.028-.014.056-.014.098-.014h.042l.042.014c.028 0 .042.014.07.028.029.014.057.028.085.043l.042.043.042.042c.014.014.028.043.042.057l.028.042.028.043.014.042c.014.014.014.043.014.057v.042c.014.014.014.043.014.057v.042c0 .014 0 .043-.014.057v.042c0 .014-.014.043-.014.057l-.014.042c-.014.014-.014.043-.028.057l-.028.042c-.014.014-.014.028-.028.043l-.028.042-.042.043-.042.042-.042.028-.057.029c-.014.014-.028.014-.042.028h-.057l-.042.014h-.098l-.057-.014h-.028l-.042-.014-.043-.014a.127.127 0 01-.042-.028c-.014 0-.028-.014-.043-.028l-.042-.029-.043-.042-.028-.043-.028-.042c-.014-.014-.014-.029-.028-.043-.014-.014-.014-.028-.014-.042-.014-.014-.014-.029-.014-.043v-.042c0-.014 0-.029-.014-.043v-.042c0-.014.014-.029.014-.043V8.73c.014-.014.014-.028.014-.042.014-.014.014-.029.028-.043l.028-.042c.014-.014.014-.028.028-.042l.042-.043.043-.028.042-.029.043-.028a.262.262 0 01.085-.028l.042-.014h.057c.014 0 .028 0 .042.014h.043l.042.014.043.014.042.029c.014.014.028.014.043.028l.042.029c.014.014.028.028.043.042l.028.043.028.042c.014.014.014.028.028.043l.014.042.014.043v.042c.014.014.014.028.014.043v.042c0 .014 0 .028-.014.042v.043c0 .014-.014.028-.014.042-.014.014-.014.029-.014.043l-.028.042-.028.042c-.014.014-.014.029-.028.043l-.042.042-.043.043c-.014.014-.028.028-.042.028l-.043.029c-.014.014-.028.014-.042.028l-.043.028-.042.014-.043.014h-.084c-.014 0-.028-.014-.042-.014l-.043-.014c-.014-.014-.028-.014-.042-.028l-.043-.029-.042-.042-.028-.043-.029-.042c-.014-.014-.014-.028-.028-.042-.014-.014-.014-.029-.014-.043l-.014-.042v-.043c0-.014-.014-.028-.014-.042v-.086c0-.014.014-.028.014-.042v-.043c.014-.014.014-.029.014-.043.014-.014.014-.028.028-.042l.029-.042c.014-.014.014-.028.028-.043l.042-.042.043-.028.042-.029c.014-.014.028-.014.043-.028l.042-.029.043-.014.042-.014h.085c.014 0 .028.014.042.014l.043.014c.014.014.028.014.042.029l.043.028.042.043.029.042.028.043c.014.014.014.028.028.042l.014.043.014.042v.043c.014.014.014.028.014.042v.086c0 .014-.014.028-.014.042v.043c0 .014-.014.028-.014.042-.014.014-.014.029-.028.043l-.028.042c-.014.014-.014.028-.029.042l-.042.043-.042.028-.043.029c-.014.014-.028.014-.042.028l-.043.029-.042.014-.043.014h-.085c-.014 0-.028-.014-.042-.014z" />+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" className="platform-icon">+ {/* Tux body */}+ <ellipse cx="12" cy="14" rx="7" ry="8" />+ {/* Head */}+ <circle cx="12" cy="5.5" r="3.5" />+ {/* Left eye */}+ <circle cx="10.5" cy="5" r="0.7" fill="currentColor" stroke="none" />+ {/* Right eye */}+ <circle cx="13.5" cy="5" r="0.7" fill="currentColor" stroke="none" />+ {/* Beak */}+ <ellipse cx="12" cy="6.5" rx="1.2" ry="0.5" fill="currentColor" stroke="none" />+ {/* Belly */}+ <ellipse cx="12" cy="15" rx="4" ry="5.5" />+ {/* Left foot */}+ <path d="M7 21c-1.5 0.5-2.5 1-2 1.5s2.5 0.5 4 0" />+ {/* Right foot */}+ <path d="M17 21c1.5 0.5 2.5 1 2 1.5s-2.5 0.5-4 0" /></svg>);@@ -163,19 +178,26 @@ function Downloads() {<div className="version-info"><span className="version-label">Latest Version</span><span className="version-number">v{versionInfo.version}</span>+ <span className="version-date">Released {new Date(versionInfo.published_at).toLocaleDateString()}</span></div>- <div className="version-meta">- <span>Released: {new Date(versionInfo.published_at).toLocaleDateString()}</span>+ <div className="version-actions">{versionInfo.release_notes_url && (<ahref={versionInfo.release_notes_url}target="_blank"rel="noopener noreferrer"- className="release-notes-link"+ className="btn btn-banner-outline">- View Release Notes+ Release Notes</a>)}+ <a href="#downloads" className="btn btn-banner-primary" onClick={(e) => {+ e.preventDefault();+ document.querySelector('.download-cards')?.scrollIntoView({ behavior: 'smooth' });+ }}>+ <DownloadIcon />+ Download Now+ </a></div></div>@@ -196,12 +218,12 @@ function Downloads() {key={platform.id}className={`download-card ${!isAvailable ? 'unavailable' : ''}`}>- <div className="platform-header">+ <div className="platform-icon-wrapper"><Icon />- <div className="platform-info">- <h3>{platform.name}</h3>- <span className="platform-arch">{platform.arch}</span>- </div>+ </div>+ <div className="platform-info">+ <h3>{platform.name}</h3>+ <span className="platform-arch">{platform.arch}</span></div><buttonclassName="btn btn-primary download-btn"diff --git a/frontend/src/pages/Security.jsx b/frontend/src/pages/Security.jsxindex 32759e30..2ced3380 100644--- a/frontend/src/pages/Security.jsx+++ b/frontend/src/pages/Security.jsx@@ -923,68 +923,82 @@ const ScannerTab = () => {</div>)}- <div className="scanner-actions card">- <div className="card-header">- <h3>Malware Scanner</h3>- <button className="btn btn-sm btn-secondary" onClick={handleUpdateDefinitions} disabled={updating}>- {updating ? 'Updating...' : 'Update Definitions'}+ <div className="scan-options">+ <div className="scan-card" onClick={() => !isScanning && !scanning && handleStartScan('quick')}>+ <div className="scan-card-icon">+ <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" fill="none" strokeWidth="2">+ <polygon points="5 3 19 12 5 21 5 3"/>+ </svg>+ </div>+ <h4>Quick Scan</h4>+ <span className="scan-desc">Scan common web directories</span>+ <button+ className="btn btn-primary btn-sm"+ onClick={(e) => { e.stopPropagation(); handleStartScan('quick'); }}+ disabled={isScanning || scanning}+ >+ Start Scan</button></div>- <div className="card-body">- <div className="scan-options">- <div className="scan-preset">- <button- className="btn btn-primary btn-lg"- onClick={() => handleStartScan('quick')}- disabled={isScanning || scanning}- >- <svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" fill="none" strokeWidth="2">- <polygon points="5 3 19 12 5 21 5 3"/>- </svg>- Quick Scan- </button>- <span className="scan-desc">Scan common web directories</span>- </div>- <div className="scan-preset">- <button- className="btn btn-secondary btn-lg"- onClick={() => handleStartScan('full')}- disabled={isScanning || scanning}- >- <svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" fill="none" strokeWidth="2">- <circle cx="12" cy="12" r="10"/>- <circle cx="12" cy="12" r="6"/>- <circle cx="12" cy="12" r="2"/>- </svg>- Full Scan- </button>- <span className="scan-desc">Scan entire system (slow)</span>- </div>+ <div className="scan-card" onClick={() => !isScanning && !scanning && handleStartScan('full')}>+ <div className="scan-card-icon">+ <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" fill="none" strokeWidth="2">+ <circle cx="12" cy="12" r="10"/>+ <circle cx="12" cy="12" r="6"/>+ <circle cx="12" cy="12" r="2"/>+ </svg>+ </div>+ <h4>Full Scan</h4>+ <span className="scan-desc">Scan entire system (slow)</span>+ <button+ className="btn btn-primary btn-sm"+ onClick={(e) => { e.stopPropagation(); handleStartScan('full'); }}+ disabled={isScanning || scanning}+ >+ Start Scan+ </button>+ </div>- <div className="scan-custom">- <label>Custom Path</label>- <div className="input-group">- <input- type="text"- value={scanPath}- onChange={(e) => setScanPath(e.target.value)}- placeholder="/path/to/scan"- disabled={isScanning}- />- <button- className="btn btn-primary"- onClick={() => handleStartScan('custom')}- disabled={isScanning || scanning || !scanPath}- >- Scan- </button>- </div>- </div>+ <div className="scan-card scan-card--custom">+ <div className="scan-card-icon">+ <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" fill="none" strokeWidth="2">+ <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>+ </svg>+ </div>+ <h4>Custom Path</h4>+ <span className="scan-desc">Scan a specific directory</span>+ <div className="scan-custom-input">+ <input+ type="text"+ value={scanPath}+ onChange={(e) => setScanPath(e.target.value)}+ placeholder="/path/to/scan"+ disabled={isScanning}+ onClick={(e) => e.stopPropagation()}+ />+ <button+ className="btn btn-primary btn-sm"+ onClick={() => handleStartScan('custom')}+ disabled={isScanning || scanning || !scanPath}+ >+ Scan+ </button></div></div></div>+ <div className="scan-toolbar">+ <button className="btn btn-sm btn-secondary" onClick={handleUpdateDefinitions} disabled={updating}>+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>+ <polyline points="7 10 12 15 17 10"/>+ <line x1="12" y1="15" x2="12" y2="3"/>+ </svg>+ {updating ? 'Updating...' : 'Update Definitions'}+ </button>+ </div>+{isScanning && (<div className="card scan-progress"><div className="card-header">@@ -1015,7 +1029,13 @@ const ScannerTab = () => {</div><div className="card-body">{history.length === 0 ? (- <p className="text-muted">No scan history available.</p>+ <div className="empty-state-sm">+ <svg viewBox="0 0 24 24" width="40" height="40" stroke="currentColor" fill="none" strokeWidth="1.5">+ <circle cx="11" cy="11" r="8"/>+ <line x1="21" y1="21" x2="16.65" y2="16.65"/>+ </svg>+ <p>No scans have been run yet. Start a scan above to check for threats.</p>+ </div>) : (<table className="table"><thead>diff --git a/frontend/src/pages/Terminal.jsx b/frontend/src/pages/Terminal.jsxindex 967e77ea..3e722906 100644--- a/frontend/src/pages/Terminal.jsx+++ b/frontend/src/pages/Terminal.jsx@@ -199,7 +199,7 @@ const LogFilesTab = () => {<div className="sidebar-header"><h3>Log Files</h3><button className="btn btn-secondary btn-sm" onClick={loadLogFiles}>- <svg viewBox="0 0 24 24" width="14" height="14">+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>@@ -317,6 +317,7 @@ const LogFilesTab = () => {const JournalTab = () => {const [logs, setLogs] = useState('');const [loading, setLoading] = useState(false);+ const [unavailable, setUnavailable] = useState(false);const [unit, setUnit] = useState('');const [lineCount, setLineCount] = useState(100);const [priority, setPriority] = useState('');@@ -327,11 +328,17 @@ const JournalTab = () => {async function loadJournalLogs() {setLoading(true);+ setUnavailable(false);try {const data = await api.getJournalLogs(unit || null, lineCount);setLogs(data.content || data.logs || 'No logs available');} catch (err) {- setLogs(`Error: ${err.message}`);+ const msg = err.message || '';+ if (msg.includes('not available') || msg.includes('not found')) {+ setUnavailable(true);+ } else {+ setLogs(`Error: ${msg}`);+ }} finally {setLoading(false);}@@ -341,6 +348,30 @@ const JournalTab = () => {loadJournalLogs();}, []);+ if (unavailable) {+ return (+ <div className="journal-container">+ <div className="empty-state">+ <svg viewBox="0 0 24 24" width="48" height="48">+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>+ <line x1="9" y1="9" x2="15" y2="9"/>+ <line x1="9" y1="13" x2="15" y2="13"/>+ <line x1="9" y1="17" x2="11" y2="17"/>+ </svg>+ <h3>System Journal Unavailable</h3>+ <p>+ <code>journalctl</code> is not available on this system.+ This typically means the server is running without systemd+ (e.g. a minimal Docker container or Windows dev environment).+ </p>+ <p className="text-muted">+ Use the <strong>Log Files</strong> tab to browse available log files instead.+ </p>+ </div>+ </div>+ );+ }+return (<div className="journal-container"><div className="journal-controls">@@ -701,7 +732,7 @@ const ServicesTab = () => {<div className="services-container"><div className="services-toolbar"><button className="btn btn-secondary btn-sm" onClick={loadServices}>- <svg viewBox="0 0 24 24" width="14" height="14">+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>diff --git a/frontend/src/styles/_variables.less b/frontend/src/styles/_variables.lessindex 5aaf1a74..c83473fd 100644--- a/frontend/src/styles/_variables.less+++ b/frontend/src/styles/_variables.less@@ -103,7 +103,7 @@// TYPOGRAPHY// --------------------------------------------@font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;-@font-mono: 'Fira Code', 'Monaco', 'Consolas', monospace;+@font-mono: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;@font-size-xs: 10px;@font-size-sm: 12px;diff --git a/frontend/src/styles/components/_tabs.less b/frontend/src/styles/components/_tabs.lessindex fae8e501..34466a98 100644--- a/frontend/src/styles/components/_tabs.less+++ b/frontend/src/styles/components/_tabs.less@@ -4,7 +4,7 @@.tabs {display: flex;- gap: @space-1;+ gap: @space-2;border-bottom: 1px solid @border-subtle;margin-bottom: @space-6;overflow-x: auto;diff --git a/frontend/src/styles/layout/_sidebar.less b/frontend/src/styles/layout/_sidebar.lessindex 99360580..60494c78 100644--- a/frontend/src/styles/layout/_sidebar.less+++ b/frontend/src/styles/layout/_sidebar.less@@ -414,6 +414,9 @@transition: all 0.2s ease;margin-bottom: 2px;position: relative;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;// Pro Hover State&:hover {diff --git a/frontend/src/styles/pages/_downloads.less b/frontend/src/styles/pages/_downloads.lessindex 28da1542..b3d979ba 100644--- a/frontend/src/styles/pages/_downloads.less+++ b/frontend/src/styles/pages/_downloads.less@@ -76,12 +76,19 @@.version-banner {background: linear-gradient(135deg, @accent-primary 0%, #4f46e5 100%);border-radius: @radius-lg;- padding: @space-6;+ padding: @space-6 @space-8;margin-bottom: @space-8;display: flex;justify-content: space-between;align-items: center;- color: var(--text-primary);+ color: @white;++ @media (max-width: @breakpoint-md) {+ flex-direction: column;+ align-items: flex-start;+ gap: @space-4;+ padding: @space-5;+ }.version-info {display: flex;@@ -99,29 +106,57 @@font-size: @font-size-3xl;font-weight: 700;}++ .version-date {+ font-size: @font-size-sm;+ opacity: 0.75;+ }}- .version-meta {+ .version-actions {display: flex;- flex-direction: column;- align-items: flex-end;- gap: @space-2;+ align-items: center;+ gap: @space-3;+ }- span {- font-size: @font-size-sm;- opacity: 0.9;+ .btn-banner-outline {+ background: transparent;+ border: 1px solid rgba(255, 255, 255, 0.4);+ color: @white;+ padding: @space-2 @space-4;+ border-radius: @radius-md;+ font-size: @font-size-sm;+ cursor: pointer;+ transition: all 0.2s;++ &:hover {+ background: rgba(255, 255, 255, 0.1);+ border-color: rgba(255, 255, 255, 0.7);}+ }- .release-notes-link {- color: @white;- text-decoration: underline;- font-size: @font-size-sm;- opacity: 0.9;- transition: opacity 0.2s;+ .btn-banner-primary {+ background: @white;+ color: @accent-primary;+ border: none;+ padding: @space-2 @space-5;+ border-radius: @radius-md;+ font-size: @font-size-sm;+ font-weight: 600;+ cursor: pointer;+ display: flex;+ align-items: center;+ gap: @space-2;+ transition: all 0.2s;- &:hover {- opacity: 1;- }+ svg {+ width: 16px;+ height: 16px;+ }++ &:hover {+ background: rgba(255, 255, 255, 0.9);+ transform: translateY(-1px);}}}@@ -161,10 +196,12 @@background: @bg-card;border: 1px solid @border-default;border-radius: @radius-lg;- padding: @space-5;+ padding: @space-6;display: flex;flex-direction: column;- gap: @space-4;+ align-items: center;+ text-align: center;+ gap: @space-3;transition: all 0.2s;&:hover {@@ -181,28 +218,33 @@}}- .platform-header {+ .platform-icon-wrapper {+ width: 56px;+ height: 56px;display: flex;align-items: center;- gap: @space-3;+ justify-content: center;+ background: @bg-elevated;+ border-radius: @radius-lg;+ margin-bottom: @space-1;.platform-icon {- width: 40px;- height: 40px;+ width: 32px;+ height: 32px;color: @text-primary;}+ }- .platform-info {- h3 {- font-size: @font-size-lg;- font-weight: 600;- margin: 0;- }+ .platform-info {+ h3 {+ font-size: @font-size-lg;+ font-weight: 600;+ margin: 0 0 @space-1;+ }- .platform-arch {- font-size: @font-size-sm;- color: @text-secondary;- }+ .platform-arch {+ font-size: @font-size-sm;+ color: @text-secondary;}}@@ -212,6 +254,7 @@justify-content: center;gap: @space-2;width: 100%;+ margin-top: auto;svg {width: 18px;@@ -335,7 +378,7 @@justify-content: center;font-weight: 600;font-size: @font-size-sm;- color: var(--text-primary);+ color: @white;}.step-content {diff --git a/frontend/src/styles/pages/_security.less b/frontend/src/styles/pages/_security.lessindex c12645e5..9c3e1847 100644--- a/frontend/src/styles/pages/_security.less+++ b/frontend/src/styles/pages/_security.less@@ -5,7 +5,7 @@.security-page {.tabs-nav {display: flex;- gap: @space-1;+ gap: @space-2;margin-bottom: @space-6;border-bottom: 1px solid @border-subtle;padding-bottom: @space-2;@@ -110,55 +110,96 @@.scanner-tab {.scan-options {display: grid;- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));- gap: @space-6;- align-items: start;+ grid-template-columns: repeat(3, 1fr);+ gap: @space-4;+ margin-bottom: @space-4;++ @media (max-width: @breakpoint-md) {+ grid-template-columns: 1fr;+ }}- .scan-preset {+ .scan-card {display: flex;flex-direction: column;align-items: center;- gap: @space-2;text-align: center;+ padding: @space-6 @space-4;+ background: @bg-card;+ border: 1px solid @border-subtle;+ border-radius: @radius-lg;+ cursor: pointer;+ .transition(all);- .btn-lg {- display: flex;- align-items: center;- gap: @space-2;- padding: @space-4 @space-8;- font-size: @font-size-md;+ &:hover {+ border-color: @accent-primary;+ background: @bg-elevated;+ }- svg {- flex-shrink: 0;- }+ h4 {+ margin: 0 0 @space-1;+ font-size: @font-size-md;+ font-weight: @font-weight-semibold;}.scan-desc {color: @text-secondary;font-size: @font-size-sm;+ margin-bottom: @space-4;+ }++ .btn {+ margin-top: auto;}}- .scan-custom {- label {- display: block;- margin-bottom: @space-2;- font-weight: 500;+ .scan-card-icon {+ width: 48px;+ height: 48px;+ display: flex;+ align-items: center;+ justify-content: center;+ border-radius: @radius-md;+ background: fade(@accent-primary, 10%);+ color: @accent-primary;+ margin-bottom: @space-3;+ }++ .scan-card--custom {+ cursor: default;++ &:hover {+ border-color: @border-subtle;+ background: @bg-card;}+ }++ .scan-custom-input {+ display: flex;+ gap: @space-2;+ width: 100%;+ margin-top: auto;- .input-group {+ input {+ flex: 1;+ min-width: 0;+ }+ }++ .scan-toolbar {+ display: flex;+ justify-content: flex-end;+ margin-bottom: @space-4;++ .btn {display: flex;+ align-items: center;gap: @space-2;-- input {- flex: 1;- }}}.scan-progress {- margin-top: @space-6;+ margin-bottom: @space-4;border-color: @accent-primary;.progress-info {diff --git a/frontend/src/styles/pages/_terminal.less b/frontend/src/styles/pages/_terminal.lessindex 9e52c332..ebe91d0e 100644--- a/frontend/src/styles/pages/_terminal.less+++ b/frontend/src/styles/pages/_terminal.less@@ -245,17 +245,18 @@.log-content {flex: 1;overflow: auto;- padding: @space-4;+ padding: 1rem;background: var(--bg-code);pre {margin: 0;- font-family: 'JetBrains Mono', 'Fira Code', monospace;- font-size: 12px;- line-height: 1.6;+ font-family: @font-mono;+ font-size: @font-size-sm;+ line-height: 1.4;color: var(--text-code);white-space: pre-wrap;- word-break: break-all;+ word-wrap: break-word;+ overflow-wrap: break-word;}.empty-viewer {@@ -362,16 +363,17 @@background: var(--bg-code);border-radius: @radius-lg;overflow: auto;- padding: @space-4;+ padding: 1rem;pre {margin: 0;- font-family: 'JetBrains Mono', 'Fira Code', monospace;- font-size: 12px;- line-height: 1.6;+ font-family: @font-mono;+ font-size: @font-size-sm;+ line-height: 1.4;color: var(--text-code);white-space: pre-wrap;- word-break: break-all;+ word-wrap: break-word;+ overflow-wrap: break-word;}}@@ -418,14 +420,40 @@.processes-table {width: 100%;min-width: 800px;+ table-layout: fixed;+ border-collapse: collapse;++ // Column widths: PID | Name | User | CPU% | Mem% | Memory | Status | Actions+ th, td {+ padding: @space-2 @space-3;+ text-align: left;+ vertical-align: middle;+ font-size: @font-size-sm;+ }th {position: sticky;top: 0;background: var(--bg-secondary);z-index: 1;+ font-weight: @font-weight-semibold;+ color: @text-secondary;+ font-size: @font-size-xs;+ text-transform: uppercase;+ letter-spacing: 0.03em;+ border-bottom: 1px solid var(--border-color);}+ // Explicit column widths for alignment+ th:nth-child(1), td:nth-child(1) { width: 70px; } // PID+ th:nth-child(2), td:nth-child(2) { width: auto; } // Name (flexible)+ th:nth-child(3), td:nth-child(3) { width: 90px; } // User+ th:nth-child(4), td:nth-child(4) { width: 110px; } // CPU %+ th:nth-child(5), td:nth-child(5) { width: 110px; } // Memory %+ th:nth-child(6), td:nth-child(6) { width: 90px; } // Memory+ th:nth-child(7), td:nth-child(7) { width: 80px; } // Status+ th:nth-child(8), td:nth-child(8) { width: 80px; } // Actions+tr {cursor: pointer;transition: background 0.15s ease;@@ -439,13 +467,16 @@}}+ tbody tr {+ border-bottom: 1px solid var(--border-color);+ }+.mono {- font-family: 'JetBrains Mono', monospace;+ font-family: @font-mono;font-size: @font-size-xs;}.process-name {- max-width: 200px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;@@ -453,16 +484,14 @@.usage-cell {position: relative;- min-width: 100px;.usage-bar {position: absolute;left: 0;- top: 50%;- transform: translateY(-50%);- height: 4px;+ bottom: 0;+ height: 3px;border-radius: 2px;- opacity: 0.3;+ opacity: 0.4;&.cpu {background: @accent-primary;@@ -476,7 +505,7 @@span {position: relative;font-size: @font-size-xs;- font-family: monospace;+ font-family: @font-mono;}}@@ -542,7 +571,7 @@font-weight: 500;&.mono {- font-family: monospace;+ font-family: @font-mono;}}}@@ -564,7 +593,7 @@padding: @space-2;background: var(--bg-tertiary);border-radius: @radius-sm;- font-family: monospace;+ font-family: @font-mono;font-size: @font-size-xs;word-break: break-all;}@@ -687,15 +716,16 @@overflow: auto;background: var(--bg-code);border-radius: @radius-md;- padding: @space-4;+ padding: 1rem;pre {margin: 0;- font-family: 'JetBrains Mono', monospace;- font-size: 12px;- line-height: 1.6;+ font-family: @font-mono;+ font-size: @font-size-sm;+ line-height: 1.4;color: var(--text-code);white-space: pre-wrap;- word-break: break-all;+ word-wrap: break-word;+ overflow-wrap: break-word;}}