-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.example.yaml
More file actions
505 lines (473 loc) · 12.9 KB
/
config.example.yaml
File metadata and controls
505 lines (473 loc) · 12.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# ShellUI Configuration Example
# Based on OliveTin documentation and adapted for ShellUI
# Application metadata
title: "ShellUI - My Server"
version: "1.0.0"
description: "Modern web interface for server management"
# Theme configuration
theme: "dark" # light, dark, system, custom
theme_config:
default_preset: "default"
custom_theme:
name: "Custom Theme"
mode: "dark"
colors:
primary: "#3b82f6"
accent: "#8b5cf6"
background: "#0f172a"
foreground: "#f8fafc"
commandSuccess: "#10b981"
commandError: "#ef4444"
commandWarning: "#f59e0b"
commandInfo: "#3b82f6"
fontFamily: "Inter, system-ui, sans-serif"
borderRadius: "0.5rem"
animation:
duration: "0.2s"
easing: "ease-in-out"
effects:
blur: "8px"
shadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1)"
glow: "0 0 20px rgba(59, 130, 246, 0.5)"
# Features
features:
auto_help: true
show_command_help: true
visual_param_builder: true
real_time_output: true
command_history: true
command_suggestions: true
bulk_operations: false
scheduled_executions: false
# Authentication
auth:
enabled: true
method: "local" # local, jwt, oauth2
users:
- username: "admin"
password: "admin_password"
roles: ["admin"]
permissions:
- "execute:*"
- "configure:*"
- "view:*"
- username: "user"
password: "user_password"
roles: ["user"]
permissions:
- "execute:system"
- "view:history"
# Security configuration
security:
acl:
- name: "admin-commands"
description: "Administrative commands"
commands: ["restart-service", "system-update"]
roles: ["admin"]
- name: "user-commands"
description: "User commands"
commands: ["system-info", "ping-test"]
roles: ["user", "admin"]
rateLimit:
enabled: true
windowMs: 900000 # 15 minutes
maxRequests: 100 # limit each IP to 100 requests per windowMs
message: "Too many requests from this IP"
validation:
allowedCommands: ["echo", "ping", "systemctl", "docker", "uname", "df", "free"]
blockedCommands: ["rm -rf /", "dd if=/dev/zero"]
requireConfirmation: ["systemctl", "docker rm"]
# Logging configuration
logging:
level: "info" # debug, info, warn, error
file: "/var/log/shellui/app.log"
maxSize: "10m"
maxFiles: 5
audit:
enabled: true
file: "/var/log/shellui/audit.log"
events: ["command_execute", "user_login", "config_change"]
# API configuration
api:
enabled: true
port: 3000
cors:
enabled: true
origins: ["http://localhost:3000", "https://shellui.example.com"]
rateLimit:
enabled: true
windowMs: 900000
maxRequests: 1000
# WebSocket configuration
websocket:
enabled: true
port: 3001
path: "/ws"
pingInterval: 30000
pingTimeout: 5000
maxConnections: 100
# Storage configuration
storage:
type: "json" # json, sqlite, postgresql
path: "/var/lib/shellui/data"
retention:
executions: "30d" # Keep execution history for 30 days
logs: "7d" # Keep logs for 7 days
backup:
enabled: true
interval: "24h"
path: "/var/backups/shellui"
# Commands
commands:
# System Commands
- id: "system-info"
title: "System Information"
description: "Display system information"
icon: "Terminal"
category: "System"
shell: "/bin/bash"
command: "uname -a && df -h && free -h"
timeout: 30000
hasHelp: true
help_command: "man uname"
- id: "service-status"
title: "Service Status"
description: "Check status of system services"
icon: "Activity"
category: "System"
shell: "/bin/bash"
command: "systemctl status {{ service }}"
args:
- name: "service"
type: "select"
label: "Service"
options:
- value: "nginx"
label: "Nginx"
- value: "apache2"
label: "Apache"
- value: "mysql"
label: "MySQL"
- value: "postgresql"
label: "PostgreSQL"
required: true
- id: "restart-service"
title: "Restart Service"
description: "Restart a system service"
icon: "RefreshCw"
category: "System"
shell: "/bin/bash"
command: "systemctl restart {{ service }}"
confirm: true
args:
- name: "service"
type: "select"
label: "Service"
options:
- value: "nginx"
label: "Nginx"
- value: "apache2"
label: "Apache"
- value: "mysql"
label: "MySQL"
required: true
# Network Commands
- id: "ping-test"
title: "Ping Test"
description: "Test network connectivity"
icon: "Wifi"
category: "Network"
shell: "/bin/bash"
command: "ping -c {{ count }} {{ host }}"
args:
- name: "host"
type: "text"
label: "Host"
placeholder: "Enter hostname or IP"
required: true
pattern: "^[a-zA-Z0-9.-]+$"
- name: "count"
type: "number"
label: "Count"
default: 4
min: 1
max: 20
required: false
- id: "network-scan"
title: "Network Scan"
description: "Scan network for active hosts"
icon: "Search"
category: "Network"
shell: "/bin/bash"
command: |
echo "Scanning network {{ network }}..."
nmap -sn {{ network }}
args:
- name: "network"
type: "text"
label: "Network"
placeholder: "192.168.1.0/24"
default: "192.168.1.0/24"
required: true
pattern: "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}/[0-9]{1,2}$"
# Container Commands
- id: "docker-ps"
title: "Docker Containers"
description: "List running Docker containers"
icon: "Docker"
category: "Containers"
shell: "/bin/bash"
command: "docker ps {{ format }}"
hasHelp: true
help_command: "docker ps --help"
args:
- name: "format"
type: "select"
label: "Format"
options:
- value: ""
label: "Default"
- value: "--format table"
label: "Table"
- value: "--format json"
label: "JSON"
- id: "docker-restart"
title: "Restart Container"
description: "Restart a Docker container"
icon: "RefreshCw"
category: "Containers"
shell: "/bin/bash"
command: "docker restart {{ container }}"
confirm: true
args:
- name: "container"
type: "text"
label: "Container Name/ID"
required: true
help: "Enter container name or ID"
# Database Commands
- id: "mysql-backup"
title: "MySQL Backup"
description: "Create MySQL database backup"
icon: "Database"
category: "Database"
shell: "/bin/bash"
command: |
echo "Creating backup of database {{ database }}..."
mysqldump -u {{ user }} -p{{ password }} {{ database }} > backup_{{ database }}_{{ timestamp }}.sql
echo "Backup completed: backup_{{ database }}_{{ timestamp }}.sql"
env:
MYSQL_PWD: "{{ password }}"
args:
- name: "database"
type: "text"
label: "Database Name"
required: true
- name: "user"
type: "text"
label: "Username"
default: "root"
required: true
- name: "password"
type: "password"
label: "Password"
required: true
- name: "timestamp"
type: "text"
label: "Timestamp"
default: "$(date +%Y%m%d_%H%M%S)"
required: false
# File Operations
- id: "find-files"
title: "Find Files"
description: "Search for files by name pattern"
icon: "Search"
category: "Files"
shell: "/bin/bash"
command: "find {{ path }} -name '{{ pattern }}' -type f"
args:
- name: "path"
type: "text"
label: "Search Path"
default: "/home"
required: true
help: "Directory to search in"
- name: "pattern"
type: "text"
label: "File Pattern"
default: "*.txt"
required: true
help: "File name pattern (e.g., *.txt, *.log)"
# Security Commands
- id: "firewall-status"
title: "Firewall Status"
description: "Check firewall status and rules"
icon: "Shield"
category: "Security"
shell: "/bin/bash"
command: |
echo "=== UFW Status ==="
ufw status verbose
echo ""
echo "=== iptables Rules ==="
iptables -L -n
user: "root"
- id: "allow-port"
title: "Allow Port"
description: "Allow a port through firewall"
icon: "Unlock"
category: "Security"
shell: "/bin/bash"
command: "ufw allow {{ port }}/{{ protocol }}"
confirm: true
user: "root"
args:
- name: "port"
type: "number"
label: "Port"
required: true
min: 1
max: 65535
- name: "protocol"
type: "select"
label: "Protocol"
options:
- value: "tcp"
label: "TCP"
- value: "udp"
label: "UDP"
default: "tcp"
required: true
# Monitoring Commands
- id: "system-monitor"
title: "System Monitor"
description: "Real-time system monitoring"
icon: "BarChart3"
category: "Monitoring"
shell: "/bin/bash"
command: |
echo "=== System Load ==="
uptime
echo ""
echo "=== Memory Usage ==="
free -h
echo ""
echo "=== Disk Usage ==="
df -h
echo ""
echo "=== Top Processes ==="
ps aux --sort=-%cpu | head -10
timeout: 60000
- id: "log-monitor"
title: "Log Monitor"
description: "Monitor system logs in real-time"
icon: "FileText"
category: "Monitoring"
shell: "/bin/bash"
command: "tail -f {{ logfile }}"
args:
- name: "logfile"
type: "select"
label: "Log File"
options:
- value: "/var/log/syslog"
label: "System Log"
- value: "/var/log/auth.log"
label: "Auth Log"
- value: "/var/log/nginx/access.log"
label: "Nginx Access"
- value: "/var/log/nginx/error.log"
label: "Nginx Error"
required: true
timeout: 300000 # 5 minutes
# Backup Commands
- id: "system-backup"
title: "System Backup"
description: "Create system backup"
icon: "Save"
category: "Backup"
shell: "/bin/bash"
command: |
echo "Creating system backup..."
tar -czf backup_$(date +%Y%m%d_%H%M%S).tar.gz {{ paths }}
echo "Backup completed"
confirm: true
args:
- name: "paths"
type: "text"
label: "Paths to Backup"
default: "/etc /home /var/www"
required: true
help: "Space-separated list of paths to backup"
# Custom Scripts
- id: "git-pull"
title: "Git Pull"
description: "Pull latest changes from git repository"
icon: "GitPullRequest"
category: "Development"
shell: "/bin/bash"
command: |
cd {{ repository }}
git pull origin {{ branch }}
echo "Repository updated successfully"
args:
- name: "repository"
type: "text"
label: "Repository Path"
required: true
help: "Path to git repository"
- name: "branch"
type: "text"
label: "Branch"
default: "main"
required: true
# Advanced Examples
- id: "smart-restart"
title: "Smart Restart"
description: "Restart service only if it's running"
icon: "RefreshCw"
category: "System"
shell: "/bin/bash"
command: |
if systemctl is-active --quiet {{ service }}; then
echo "Service {{ service }} is running. Restarting..."
systemctl restart {{ service }}
echo "Service restarted successfully"
else
echo "Service {{ service }} is not running. Starting..."
systemctl start {{ service }}
echo "Service started successfully"
fi
args:
- name: "service"
type: "text"
label: "Service Name"
required: true
- id: "full-backup"
title: "Full System Backup"
description: "Complete system backup with verification"
icon: "Save"
category: "Backup"
shell: "/bin/bash"
command: |
echo "=== Starting Full System Backup ==="
# Create backup directory
BACKUP_DIR="/var/backups/system_$(date +%Y%m%d_%H%M%S)"
mkdir -p $BACKUP_DIR
# Backup configuration files
echo "Backing up configuration files..."
tar -czf $BACKUP_DIR/config.tar.gz /etc
# Backup user data
echo "Backing up user data..."
tar -czf $BACKUP_DIR/home.tar.gz /home
# Backup databases
echo "Backing up databases..."
mysqldump --all-databases > $BACKUP_DIR/databases.sql
# Create backup manifest
echo "Creating backup manifest..."
ls -la $BACKUP_DIR > $BACKUP_DIR/manifest.txt
echo "=== Backup Completed ==="
echo "Backup location: $BACKUP_DIR"
echo "Total size: $(du -sh $BACKUP_DIR | cut -f1)"
confirm: true
timeout: 1800000 # 30 minutes