Server Task Runner
SSH connector, command safety rules, and task reports in the Server Task Runner.
The Server Task Runner (ServerPanel Core module) in the dpanel app provides:
- SSH Connector (password + private key auth)
- Safe command queue runner for server tasks
- AI error resolver for task failures
- Command approval flow and blocked-command protection
- Full task/event history and TXT reports
Stack
- Laravel 12
- Vue + Inertia
- Tailwind CSS
- MySQL/MariaDB
- Redis queue
- Supervisor worker
phpseclib/phpseclibfor SSH
Security Controls
- Credentials are stored in encrypted casts (
encrypted_password,encrypted_private_key,encrypted_private_key_passphrase). - Secret fields are hidden from model serialization and never returned intentionally.
- Root login is only allowed when server mode is
setup(and config allows it). - Every command is classified as
safe,approval_required, orblocked. - Dangerous commands are blocked.
- Approval-required commands must be approved by admin.
- Every command emits timeline events and report output.
Included Backend Components
Tables
serversssh_connection_testscommand_jobscommand_eventsai_error_resolutionsserver_tasksserver_task_steps
Models
ServerSshConnectionTestCommandJobCommandEventAiErrorResolutionServerTaskServerTaskStep
Services
SshClientServiceCommandSafetyServiceCommandRunnerServiceAiErrorResolverServiceErrorSignatureServiceReportServiceServerInventoryService
Jobs
ExecuteSshCommandJobAnalyzeCommandErrorJobScanServerInventoryJob
Controllers
ServerControllerCommandJobControllerServerTaskController
Events
CommandCreatedCommandClassifiedCommandApprovedCommandStartedCommandFinishedCommandFailedAiFixSuggested
UI Pages (Inertia Vue)
/servers/servers/create/servers/{server}/servers/{server}/commands/commands/{commandJob}/server-tasks/server-tasks/{task}
Setup
- Install PHP dependencies:
composer install
- Install frontend dependencies:
npm install
- Configure
.envqueue settings:
QUEUE_CONNECTION=redis
REDIS_CLIENT=phpredis
- Run migrations and seeders:
php artisan migrate
php artisan db:seed
- Build frontend assets:
npm run build
Required Package
composer require phpseclib/phpseclib
Supervisor Example
[program:serverpanel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /path-to-project/artisan queue:work redis --queue=heavy,server-commands,default --sleep=2 --tries=1 --timeout=3600
autostart=true
autorestart=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/path-to-project/storage/logs/serverpanel-worker.log
Config
See config/serverpanel.php for:
ssh_timeoutcommand_timeoutallow_root_setup_modeauto_run_safe_commandsauto_run_safe_fixesmax_output_lengthblocked_commandsapproval_required_patternssafe_patternsreport_base_path
Reports
Command reports are saved under:
storage/app/serverpanel/reports/YYYY-MM-DD/server-{id}/command-{uuid}.txt
Tests
Run:
php artisan test --filter=ServerPanelModuleTest
The feature test covers:
- encrypted password storage
- secret non-exposure
- safe/approval/blocked classification outcomes
- approval dispatch flow
- failed command AI analyzer dispatch
- report generation
- memory search
Questions & comments (0)