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
feat(panel): wire drift/doctor, CLI tools, security suite and hosting polish
Juan Denis5e22aa85109f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 077cf52c..808887ee 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -28,6 +28,52 @@ awaiting a stable release:### Added+- **Configuration drift detection + repair ("doctor")** — a daily read-only+ sweep re-renders the expected nginx vhost and compose override for every+ managed resource from panel state and diffs it against disk; drift raises an+ admin notification, and a Doctor tab on Monitoring runs the full diagnosis+ (drift, core services, cert expiry, disk headroom, database) with+ diff-confirmed per-item repair and batch repair. Nothing is ever changed+ automatically.+- **Operator CLI** — the `serverkit` CLI gains API-backed verbs for when the+ browser isn't an option: `status`, `services list/restart`, `apps list`,+ `doctor [--repair]`, `repair <type> <id>`, `update`, `support-bundle`, and+ `login-url` (mints a one-time login link). Auth is a break-glass 10-minute+ token minted in-process — root on the box already implies full control —+ and every mint is audit-logged.+- **Diagnostic support bundle** — one call (API or CLI) exports a sanitized+ zip (versions, service states, setting shapes without values, recent job+ failures, scrubbed log tail) to attach to a bug report; secrets are+ scrubbed by pattern and by the settings secret-key list.+- **Web-shell/YARA scanning + job-backed malware scans** — malware scans now+ run as jobs, can target an app's docroot directly, and a curated web-shell+ rules pass (eval/base64 droppers, c99/r57/WSO markers, PHP-in-image,+ auto_prepend hijacks…) runs alongside ClamAV — with a pure-Python fallback+ when yara isn't installed, custom rule upload, and one-click quarantine+ with restore.+- **File-integrity monitoring** — baseline-and-diff over the paths ServerKit+ manages (nginx config, ServerKit systemd units, app docroots on opt-in)+ every six hours, feeding the Notifications Bus; the Security → Integrity+ tab gains baseline/check/accept controls and a what-changed view.+- **CrowdSec extension** — a new `serverkit-crowdsec` marketplace extension+ surfaces CrowdSec decisions and alerts, lets you ban/unban IPs and manage+ allowlists via cscli, with graceful degradation when CrowdSec isn't+ installed.+- **Authoritative DNS server extension** — a new `serverkit-dns-server`+ marketplace extension runs PowerDNS in a managed container so a ServerKit+ box can be the nameserver for its domains: zones, records, DNSSEC with DS+ records for the registrar, and a delegation check. For homelab and+ air-gapped setups; complements (never replaces) the provider integrations.+- **Per-domain bandwidth accounting** — daily nginx access-log aggregation+ into per-site transfer stats, with 30-day sparklines on the Services list+ and a monthly figure on the service Overview.+- **Per-site micro-cache** — an opt-in nginx micro-cache (10s TTL) per site+ with safe bypasses for logged-in/admin/cart cookies and paths, an+ `X-SK-Cache` header for verification, and a manual purge button. Big cheap+ win for WordPress/PHP sites.+- **`.htaccess` → nginx converter** — a paste-in tool (on the Import wizard)+ translating common rewrite/redirect/auth/access rules to nginx directives,+ flagging anything it can't translate with the reason and line number.- **Import a site (migration pipeline)** — a 5-step wizard at `/imports`(entry points on Services and WordPress) restores cPanel/WHM, DirectAdminand Hestia/Vesta backup archives onto ServerKit: the archive is analyseddiff --git a/backend/app/__init__.py b/backend/app/__init__.pyindex 28b5e39c..044201ac 100644--- a/backend/app/__init__.py+++ b/backend/app/__init__.py@@ -470,6 +470,22 @@ def create_app(config_name=None):from app.api.site_imports import site_imports_bpapp.register_blueprint(site_imports_bp, url_prefix='/api/v1/imports')+ # Register blueprints - Drift detection + doctor sweep+ from app.api.doctor import doctor_bp+ app.register_blueprint(doctor_bp, url_prefix='/api/v1/doctor')++ # Register blueprints - Diagnostic support bundle+ from app.api.support_bundle import support_bundle_bp+ app.register_blueprint(support_bundle_bp, url_prefix='/api/v1/support-bundle')++ # Register blueprints - Per-site bandwidth accounting+ from app.api.bandwidth import bandwidth_bp+ app.register_blueprint(bandwidth_bp, url_prefix='/api/v1/bandwidth')++ # Register blueprints - .htaccess -> nginx converter (apps-prefixed tool)+ from app.api.htaccess_tools import htaccess_tools_bp+ app.register_blueprint(htaccess_tools_bp, url_prefix='/api/v1/apps')+# Handle database migrations (Alembic) — must run before plugin loader# since the loader queries the installed_plugins table.with app.app_context():@@ -598,6 +614,16 @@ def create_app(config_name=None):DbAdminSsoService.register_jobs()from app.services.site_import_service import SiteImportServiceSiteImportService.register_jobs()+ from app.services.drift_service import DriftService+ DriftService.register_jobs()+ from app.services.doctor_service import DoctorService+ DoctorService.register_jobs()+ from app.services.file_integrity_service import FileIntegrityService+ FileIntegrityService.register_jobs()+ from app.services.malware_scan_service import MalwareScanService+ MalwareScanService.register_jobs()+ from app.services.bandwidth_service import BandwidthService+ BandwidthService.register_jobs()start_job_system(app, seed=seed_builtin_schedules)# Request body size limitdiff --git a/backend/app/jobs/builtin_handlers.py b/backend/app/jobs/builtin_handlers.pyindex 45b58260..c6e0aa71 100644--- a/backend/app/jobs/builtin_handlers.py+++ b/backend/app/jobs/builtin_handlers.py@@ -355,3 +355,24 @@ def seed_builtin_schedules():db_admin_sso_service.REAP_SCHEDULE_NAME, db_admin_sso_service.REAP_JOB_KIND,interval_seconds=300, startup_delay_seconds=120,)+ # Daily configuration-drift sweep — handler registered by+ # DriftService.register_jobs() at boot.+ from app.services.drift_service import DRIFT_JOB_KIND, DRIFT_SCHEDULE_NAME+ ScheduledJobService.ensure(+ DRIFT_SCHEDULE_NAME, DRIFT_JOB_KIND,+ interval_seconds=86400, startup_delay_seconds=900,+ )+ # File-integrity sweep — handler registered by+ # FileIntegrityService.register_jobs() at boot.+ from app.services import file_integrity_service+ ScheduledJobService.ensure(+ file_integrity_service.FIM_SCHEDULE_NAME, file_integrity_service.FIM_JOB_KIND,+ interval_seconds=21600, startup_delay_seconds=1200,+ )+ # Daily per-site bandwidth aggregation — handler registered by+ # BandwidthService.register_jobs() at boot.+ from app.services import bandwidth_service+ ScheduledJobService.ensure(+ bandwidth_service.BANDWIDTH_SCHEDULE_NAME, bandwidth_service.BANDWIDTH_JOB_KIND,+ interval_seconds=86400, startup_delay_seconds=1800,+ )diff --git a/backend/app/models/__init__.py b/backend/app/models/__init__.pyindex 8c961734..a9f2a67f 100644--- a/backend/app/models/__init__.py+++ b/backend/app/models/__init__.py@@ -67,6 +67,7 @@ from app.models.domain_registration import DomainRegistrationfrom app.models.login_link import LoginLinkfrom app.models.managed_database_user import ManagedDatabaseUserfrom app.models.site_import import SiteImport+from app.models.site_bandwidth import SiteBandwidthDaily__all__ = ['User', 'Application', 'Domain', 'EnvironmentVariable', 'EnvironmentVariableHistory',@@ -110,4 +111,5 @@ __all__ = ['LoginLink','ManagedDatabaseUser','SiteImport',+ 'SiteBandwidthDaily',]diff --git a/backend/tests/test_jobs.py b/backend/tests/test_jobs.pyindex 2b8b6fcd..c2699bf9 100644--- a/backend/tests/test_jobs.py+++ b/backend/tests/test_jobs.py@@ -178,11 +178,11 @@ class TestBuiltins:assert len([k for k in kinds if k.startswith('builtin.')]) == 10builtin_handlers.seed_builtin_schedules()- # 10 builtin.* schedules + the login-link and SSO-credential reapers.- assert ScheduledJob.query.count() == 12+ # 10 builtin.* schedules + login-link/SSO reapers + drift/FIM/bandwidth sweeps.+ assert ScheduledJob.query.count() == 15# Seeding twice doesn't duplicate.builtin_handlers.seed_builtin_schedules()- assert ScheduledJob.query.count() == 12+ assert ScheduledJob.query.count() == 15class TestApi:diff --git a/frontend/src/services/api/index.js b/frontend/src/services/api/index.jsindex 1695fd5c..9292e15e 100644--- a/frontend/src/services/api/index.js+++ b/frontend/src/services/api/index.js@@ -36,6 +36,9 @@ import * as speedTestMethods from './speedtest.js';import * as dbProcessMethods from './dbProcesses.js';import * as dbTunerMethods from './dbTuner.js';import * as importMethods from './imports.js';+import * as doctorMethods from './doctor.js';+import * as bandwidthMethods from './bandwidth.js';+import * as htaccessToolMethods from './htaccessTools.js';class ApiService extends ApiClient {constructor() {@@ -79,6 +82,9 @@ class ApiService extends ApiClient {dbProcessMethods,dbTunerMethods,importMethods,+ doctorMethods,+ bandwidthMethods,+ htaccessToolMethods,];for (const mod of modules) {for (const [key, fn] of Object.entries(mod)) {diff --git a/frontend/src/styles/main.scss b/frontend/src/styles/main.scssindex 6aeaa297..6444aeeb 100644--- a/frontend/src/styles/main.scss+++ b/frontend/src/styles/main.scss@@ -35,6 +35,7 @@@import 'components/_tables';@import 'components/_alerts';@import 'components/_modals';+@import 'components/_htaccess-converter';@import 'components/_forms';@import 'components/_badges';@import 'components/_tabs';@@ -90,6 +91,8 @@@import 'pages/_databases';@import 'pages/_db-processes';@import 'pages/_db-tuner';+@import 'pages/_doctor';+@import 'pages/_bandwidth';@import 'pages/_domains';@import 'pages/_monitoring';@import 'pages/_backups';