Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix: Allow qm/pct reboot/shutdown commands with approval

rcourtmand71b6bd7569d
diff --git a/internal/agentexec/policy.go b/internal/agentexec/policy.go
index 4bcaf3d44d..e97b1af444 100644
--- a/internal/agentexec/policy.go
+++ b/internal/agentexec/policy.go
@@ -162,12 +162,13 @@ func DefaultPolicy() *CommandPolicy {
`>\s*/dev/sd`,
`>\s*/dev/nvme`,
- // System destruction
- `shutdown`,
- `reboot`,
- `init\s+0`,
- `poweroff`,
- `halt`,
+ // System destruction (host-level commands only)
+ // Note: qm/pct reboot/shutdown are allowed with approval (see RequireApproval)
+ `^shutdown(\s|$)`,
+ `^reboot(\s|$)`,
+ `^init\s+0`,
+ `^poweroff(\s|$)`,
+ `^halt(\s|$)`,
// Dangerous permissions
`chmod\s+777`,
diff --git a/internal/agentexec/policy_test.go b/internal/agentexec/policy_test.go
index 45d3975f00..d2def8f8c4 100644
--- a/internal/agentexec/policy_test.go
+++ b/internal/agentexec/policy_test.go
@@ -23,6 +23,18 @@ func TestDefaultPolicyEvaluate(t *testing.T) {
{"require approval", "systemctl restart nginx", PolicyRequireApproval},
{"unknown defaults to approval", "echo hello", PolicyRequireApproval},
{"sudo with flags remains conservative", "sudo -u root df -h", PolicyRequireApproval},
+
+ // Proxmox VM control - should require approval, not be blocked
+ {"qm reboot requires approval", "qm reboot 201", PolicyRequireApproval},
+ {"qm shutdown requires approval", "qm shutdown 201", PolicyRequireApproval},
+ {"pct reboot requires approval", "pct reboot 100", PolicyRequireApproval},
+ {"pct shutdown requires approval", "pct shutdown 100", PolicyRequireApproval},
+
+ // Host-level system commands should be blocked
+ {"bare reboot blocked", "reboot", PolicyBlock},
+ {"bare shutdown blocked", "shutdown", PolicyBlock},
+ {"shutdown now blocked", "shutdown now", PolicyBlock},
+ {"reboot now blocked", "reboot -f", PolicyBlock},
}
for _, tc := range cases {