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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Harden runtime Proxmox token ACLs
rcourtmance7b459aa799
diff --git a/docs/release-control/v6/internal/records/agent-lifecycle-proxmox-runtime-token-permission-proof-2026-05-05.md b/docs/release-control/v6/internal/records/agent-lifecycle-proxmox-runtime-token-permission-proof-2026-05-05.mdnew file mode 100644index 0000000000..b995fd50d0--- /dev/null+++ b/docs/release-control/v6/internal/records/agent-lifecycle-proxmox-runtime-token-permission-proof-2026-05-05.md@@ -0,0 +1,51 @@+# Agent Lifecycle Proxmox Runtime Token Permission Proof++- Date: `2026-05-05`+- Lane: `L16`+- Adjacent lane: `L1`+- Trigger: Runtime-side follow-up to generated Proxmox setup permission hardening++## Context++Generated Proxmox setup scripts already use privilege-separated PVE tokens and+mirror ACLs to the concrete token id. The runtime-side host-agent setup and the+root installer auto-registration path still had their own PVE token creation+logic, so they needed the same canonical permission model instead of a parallel+shared-token or user-only ACL variant.++## Outcome++- `internal/hostagent/proxmox_setup.go` now creates and rotates PVE monitor+ tokens with privilege separation enabled, then applies `PVEAuditor`, optional+ `PulseMonitor`, and `/storage` `PVEDatastoreAdmin` grants to both+ `pulse-monitor@pve` and the concrete `pulse-monitor@pve!pulse-*` token id.+- Host-agent PVE setup keeps the non-destructive `PulseMonitor` role update+ path while applying the selected guest-agent privilege shape to the token as+ well as the service user.+- The root `install.sh` auto-registration path now uses the same+ privilege-separated PVE token posture, comma-joined `PulseMonitor` privileges,+ non-destructive role update, and user-plus-token ACL pairing before posting the+ generated token to `/api/auto-register`.++## Proof Commands++Run as part of this slice:++- `bash -n install.sh`+- `go test ./internal/hostagent -run 'TestProxmoxSetup_(SetupPVETokenUsesPrivilegeSeparatedTokenACLs|ConfigurePVEPermissions_FallsBackToGuestAgentAudit|RunForType|RunAll)|TestPrivProbeRoleName|TestProxmoxSetup_ProbePVEPrivilege' -count=1`+- `go test ./scripts/installtests -run TestRootInstallScriptAutoRegisterUsesSecureContractShape -count=1`+- `go test ./internal/hostagent -count=1`+- `go test ./scripts/installtests -count=1`+- `python3 scripts/release_control/status_audit.py --pretty`+- `python3 scripts/release_control/contract_audit.py --pretty`+- `python3 scripts/release_control/registry_audit.py --pretty`+- `python3 scripts/release_control/canonical_completion_guard.py`+- `python3 scripts/release_control/staged_commit_shape_guard.py`+- `git diff --cached --check`++## Follow-Up Guard++Any future PVE setup path that creates a Pulse-managed API token must use the+same privilege-separated token contract and mirror effective ACLs to the service+user and concrete token id. A user-only ACL or `--privsep 0` token is not a+canonical Proxmox API Inventory setup path.diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.jsonindex 421af4a695..27357da5c3 100644--- a/docs/release-control/v6/internal/status.json+++ b/docs/release-control/v6/internal/status.json@@ -2483,6 +2483,11 @@"path": "docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md","kind": "file"},+ {+ "repo": "pulse",+ "path": "docs/release-control/v6/internal/records/agent-lifecycle-proxmox-runtime-token-permission-proof-2026-05-05.md",+ "kind": "file"+ },{"repo": "pulse","path": "docs/release-control/v6/internal/records/known-rc-issue-closure-for-ga-installer-bundle-fallback-2026-05-01.md",@@ -2497,6 +2502,16 @@"repo": "pulse","path": "docs/release-control/v6/internal/subsystems/deployment-installability.md","kind": "file"+ },+ {+ "repo": "pulse",+ "path": "install.sh",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "scripts/installtests/root_install_sh_test.go",+ "kind": "file"}]},@@ -3380,6 +3395,11 @@"path": "docs/release-control/v6/internal/records/agent-lifecycle-proxmox-api-first-onboarding-2026-05-05.md","kind": "file"},+ {+ "repo": "pulse",+ "path": "docs/release-control/v6/internal/records/agent-lifecycle-proxmox-runtime-token-permission-proof-2026-05-05.md",+ "kind": "file"+ },{"repo": "pulse","path": "docs/release-control/v6/internal/records/agent-lifecycle-proxmox-setup-permission-proof-2026-05-05.md",@@ -3505,6 +3525,16 @@"path": "internal/hostagent/agent.go","kind": "file"},+ {+ "repo": "pulse",+ "path": "internal/hostagent/proxmox_setup.go",+ "kind": "file"+ },+ {+ "repo": "pulse",+ "path": "internal/hostagent/proxmox_setup_test.go",+ "kind": "file"+ },{"repo": "pulse","path": "scripts/install.sh",diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 1c89af7bb3..ead806de0e 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -304,6 +304,11 @@ profile and assignment columns, but embedded table framing must route through2. Add or change update continuity and persisted-version handoff through `internal/agentupdate/`.3. Add or change runtime-side Unified Agent startup, first-report assembly, and enroll/runtime continuity through `internal/hostagent/`.Proxmox host-agent setup must treat local `proxmox-registered` markers as a cache, not authority: before skipping token setup or node repair, `internal/hostagent/proxmox_setup.go` must revalidate the current type and candidate hosts against Pulse through the canonical auto-register contract.+ Runtime-side PVE token setup must also keep the same permission shape as the+ generated setup script: Pulse-managed PVE monitor tokens are+ privilege-separated, and `PVEAuditor`, optional `PulseMonitor`, plus+ `/storage` `PVEDatastoreAdmin` grants must be mirrored to both+ `pulse-monitor@pve` and the concrete `pulse-monitor@pve!pulse-*` token id.Runtime startup must preserve the token-optional path for already-installednon-enrollment agents; only enrollment mode may fail CLI configurationloading solely because no API token was supplied.diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex cbf79ec59d..fa94acf3aa 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -183,14 +183,15 @@ product API routes free of maintainer commercial analytics.That same canonical payload contract also owns strict-TLS truth for that selected host: `/api/auto-register` may only persist `VerifySSL=true` when Pulse actually captured a certificate fingerprint for the selected candidate, and it must not pretend public-CA verification is safe after every candidate fingerprint probe failed.That same contract now owns stale-marker verification as well: setup-token-authenticated `checkRegistration` requests may omit token completion fields and must answer `{registered:boolean}` from canonical candidate-host matching so runtime repair can distinguish real registrations from stale local marker files without rotating tokens first.That same shared setup contract also owns teardown symmetry for script-managed Proxmox nodes: `/api/auto-unregister` must accept the canonical `type`, normalized `host`, explicit `serverName`, optional canonical `tokenId`, request-body `authToken`, and `source:"script"` payload, and it must answer the same canonical success envelope on both real removals and idempotent no-op reruns so browser/runtime callers do not invent a second uninstall vocabulary.- That same setup-script payload contract owns the generated Proxmox- permission shape. PVE scripts must create `pulse-monitor@pve!pulse-*`- tokens with privilege separation enabled, then apply the generated- `PVEAuditor`, optional `PulseMonitor`, and optional `/storage`- `PVEDatastoreAdmin` ACLs to both `pulse-monitor@pve` and the concrete- token id. PBS scripts must grant `Audit` to both `pulse-monitor@pbs` and- the concrete token id. Browser/runtime setup callers must not fork this- into token-shared, token-unprivileged, or user-only ACL variants.+ That same setup-script payload contract owns the Proxmox permission shape+ for generated scripts, runtime-side host-agent setup, and installer+ auto-registration. PVE setup paths must create+ `pulse-monitor@pve!pulse-*` tokens with privilege separation enabled, then+ apply `PVEAuditor`, optional `PulseMonitor`, and optional `/storage`+ `PVEDatastoreAdmin` ACLs to both `pulse-monitor@pve` and the concrete token+ id. PBS scripts must grant `Audit` to both `pulse-monitor@pbs` and the+ concrete token id. Browser/runtime setup callers must not fork this into+ token-shared, token-unprivileged, or user-only ACL variants.37. `internal/api/enterprise_extension_rbac_admin.go` shared with `organization-settings`: RBAC admin extension endpoints are both an organization settings control surface and a canonical API payload contract boundary.38. `internal/api/licensing_bridge.go` shared with `cloud-paid`: commercial licensing bridge handlers carry both API payload contract and cloud-paid entitlement boundary ownership.39. `internal/api/licensing_handlers.go` shared with `cloud-paid`: commercial licensing handlers carry both API payload contract and cloud-paid entitlement boundary ownership.diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex aff9edc845..a46e7e13a0 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -1036,7 +1036,10 @@ specific `pve` or `pbs` type.That same installer-owned bootstrap step against `/api/setup-script-url` mustalso validate the returned canonical `type`, normalized `host`, and live`expires` metadata before using the one-time setup token, so install-time-registration cannot drift onto a stale or mismatched bootstrap response. A+registration cannot drift onto a stale or mismatched bootstrap response.+Install-time PVE auto-registration must also create privilege-separated+Pulse-managed monitor tokens and mirror effective ACLs to the concrete token id+rather than relying on user-only grants or shared-token inheritance. Anon-empty `expires` field alone is not sufficient; the installer must rejectbootstrap responses whose expiry is already in the past. That same bootstrapconsumer must also fail closed unless the runtime-owned setup metadata isdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 418b9a6112..3254c261eb 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -66,11 +66,11 @@ state.## Extension Points-Generated Proxmox setup-script changes in `internal/api/` that affect backup-visibility permissions are storage/recovery-adjacent: optional PVE `/storage`-grants must remain effective for privilege-separated tokens by assigning the-same `PVEDatastoreAdmin` role to both the service user and the concrete token-id.+Generated Proxmox setup-script, runtime host-agent setup, and installer+auto-registration changes that affect backup visibility permissions are+storage/recovery-adjacent: optional PVE `/storage` grants must remain effective+for privilege-separated tokens by assigning the same `PVEDatastoreAdmin` role to+both the service user and the concrete token id.Storage/recovery auth-adjacent changes may consume SSO-authenticated sessions,but they must not reinterpret SAML or multi-provider SSO availability as a@@ -2359,10 +2359,11 @@ names stay bound to the canonical Pulse endpoint across setup/bootstrapsurfaces, so adjacent setup and recovery-linked flows may not derive tokenscope from request-local `Host` fallbacks and accidentally fork monitor-tokenidentity for the same Pulse instance.-That same shared dependency also assumes generated PVE setup scripts keep-backup visibility permissions effective on privilege-separated tokens: optional-`/storage` `PVEDatastoreAdmin` grants must be mirrored to the service user and-the concrete token id, not left as a user-only ACL that the token cannot use.+That same shared dependency also assumes generated PVE setup scripts, runtime+host-agent setup, and installer auto-registration keep backup visibility+permissions effective on privilege-separated tokens: optional `/storage`+`PVEDatastoreAdmin` grants must be mirrored to the service user and the concrete+token id, not left as a user-only ACL that the token cannot use.That same shared dependency also assumes `/api/setup-script` stays on onecanonical artifact contract: manual setup downloads must ship as`text/x-shellscript` attachments with deterministic `pulse-setup-*.sh`diff --git a/install.sh b/install.shindex 8d5dad7f3d..0aaf163a43 100755--- a/install.sh+++ b/install.sh@@ -2243,6 +2243,7 @@ PYpveum aclmod /storage -user pulse-monitor@pve -role PVEDatastoreAdmin >/dev/null 2>&1 || truefi+ local pulse_monitor_role_ready=falselocal extra_privs=()if pveum role list 2>/dev/null | grep -q "Sys.Audit"; thenextra_privs+=("Sys.Audit")@@ -2274,9 +2275,10 @@ PYfiif [[ ${#extra_privs[@]} -gt 0 ]]; then- local priv_string="${extra_privs[*]}"- pveum role delete PulseMonitor >/dev/null 2>&1 || true- if pveum role add PulseMonitor -privs "$priv_string" >/dev/null 2>&1; then+ local priv_string+ priv_string="$(IFS=,; echo "${extra_privs[*]}")"+ if pveum role modify PulseMonitor -privs "$priv_string" >/dev/null 2>&1 || pveum role add PulseMonitor -privs "$priv_string" >/dev/null 2>&1; then+ pulse_monitor_role_ready=truepveum aclmod / -user pulse-monitor@pve -role PulseMonitor >/dev/null 2>&1 || truefifi@@ -2304,7 +2306,7 @@ PYlocal token_output=""set +e- token_output=$(pveum user token add pulse-monitor@pve "$token_name" --privsep 0 2>&1)+ token_output=$(pveum user token add pulse-monitor@pve "$token_name" --privsep 1 2>&1)local token_status=$?set -eif [[ $token_status -ne 0 ]]; then@@ -2321,6 +2323,13 @@ PYreturnfilocal token_id="pulse-monitor@pve!${token_name}"+ pveum aclmod / -token "$token_id" -role PVEAuditor >/dev/null 2>&1 || true+ if [[ "$backup_perms" == "true" ]]; then+ pveum aclmod /storage -token "$token_id" -role PVEDatastoreAdmin >/dev/null 2>&1 || true+ fi+ if [[ "$pulse_monitor_role_ready" == "true" ]]; then+ pveum aclmod / -token "$token_id" -role PulseMonitor >/dev/null 2>&1 || true+ filocal register_payloadregister_payload=$(python3 - <<'PY' "$normalized_host_url" "$token_id" "$token_value" "$server_name" "$setup_token"diff --git a/internal/hostagent/proxmox_setup.go b/internal/hostagent/proxmox_setup.goindex 62adefc88b..dd5dfc5a46 100644--- a/internal/hostagent/proxmox_setup.go+++ b/internal/hostagent/proxmox_setup.go@@ -229,10 +229,17 @@ func (p *ProxmoxSetup) probePVEPrivilege(ctx context.Context, privilege string)return true}-func (p *ProxmoxSetup) configurePVEPermissions(ctx context.Context) {+func (p *ProxmoxSetup) applyPVEACL(ctx context.Context, path string, principalFlag string, principal string, role string) {+ if _, err := p.collector.CommandCombinedOutput(ctx, "pveum", "aclmod", path, principalFlag, principal, "-role", role); err != nil {+ p.logger.Warn().Err(err).Str("path", path).Str("principal", principal).Str("role", role).Msg("Failed to apply PVE role")+ }+}++func (p *ProxmoxSetup) configurePVEPermissions(ctx context.Context, tokenID string) {// Baseline: read-only access.- if _, err := p.collector.CommandCombinedOutput(ctx, "pveum", "aclmod", "/", "-user", proxmoxUserPVE, "-role", "PVEAuditor"); err != nil {- p.logger.Warn().Err(err).Msg("Failed to add PVEAuditor role (may already exist)")+ p.applyPVEACL(ctx, "/", "-user", proxmoxUserPVE, "PVEAuditor")+ if tokenID != "" {+ p.applyPVEACL(ctx, "/", "-token", tokenID, "PVEAuditor")}// Extra privileges are optional, but enable additional features:@@ -266,14 +273,16 @@ func (p *ProxmoxSetup) configurePVEPermissions(ctx context.Context) {}}- if _, err := p.collector.CommandCombinedOutput(ctx, "pveum", "aclmod", "/", "-user", proxmoxUserPVE, "-role", proxmoxMonitorRole); err != nil {- p.logger.Warn().Err(err).Msg("Failed to apply PulseMonitor role")+ p.applyPVEACL(ctx, "/", "-user", proxmoxUserPVE, proxmoxMonitorRole)+ if tokenID != "" {+ p.applyPVEACL(ctx, "/", "-token", tokenID, proxmoxMonitorRole)}}// Add PVEDatastoreAdmin on /storage for backup visibility (issue #1139)- if _, err := p.collector.CommandCombinedOutput(ctx, "pveum", "aclmod", "/storage", "-user", proxmoxUserPVE, "-role", "PVEDatastoreAdmin"); err != nil {- p.logger.Warn().Err(err).Msg("Failed to apply PVEDatastoreAdmin role on /storage")+ p.applyPVEACL(ctx, "/storage", "-user", proxmoxUserPVE, "PVEDatastoreAdmin")+ if tokenID != "" {+ p.applyPVEACL(ctx, "/storage", "-token", tokenID, "PVEDatastoreAdmin")}}@@ -736,18 +745,15 @@ func (p *ProxmoxSetup) setupPVEToken(ctx context.Context, tokenName string) (str}}- // Apply baseline + optional enhanced permissions (Sys.Audit, guest agent access).- p.configurePVEPermissions(ctx)-- // Create token with privilege separation disabled- output, err := p.collector.CommandCombinedOutput(ctx, "pveum", "user", "token", "add", proxmoxUserPVE, tokenName, "--privsep", "0")+ // Create token with privilege separation enabled, then mirror ACLs onto the token.+ output, err := p.collector.CommandCombinedOutput(ctx, "pveum", "user", "token", "add", proxmoxUserPVE, tokenName, "--privsep", "1")if err != nil {if tokenAlreadyExists(err, output) {p.logger.Info().Str("token", tokenName).Msg("PVE monitoring token already exists; rotating token in place")if _, deleteErr := p.collector.CommandCombinedOutput(ctx, "pveum", "user", "token", "remove", proxmoxUserPVE, tokenName); deleteErr != nil {return "", "", fmt.Errorf("failed to delete existing token before rotation: %w", deleteErr)}- output, err = p.collector.CommandCombinedOutput(ctx, "pveum", "user", "token", "add", proxmoxUserPVE, tokenName, "--privsep", "0")+ output, err = p.collector.CommandCombinedOutput(ctx, "pveum", "user", "token", "add", proxmoxUserPVE, tokenName, "--privsep", "1")}if err != nil {return "", "", fmt.Errorf("failed to create token: %w", err)@@ -761,6 +767,8 @@ func (p *ProxmoxSetup) setupPVEToken(ctx context.Context, tokenName string) (str}tokenID := fmt.Sprintf("%s!%s", proxmoxUserPVE, tokenName)+ p.configurePVEPermissions(ctx, tokenID)+return tokenID, tokenValue, nil}@@ -818,7 +826,7 @@ func (p *ProxmoxSetup) setupPBSToken(ctx context.Context, tokenName string) (str// ╞══════════════╪══════════════════════════════════════╡// │ full-tokenid │ pulse-monitor@pve!pulse-token │// ├──────────────┼──────────────────────────────────────┤-// │ info │ {"privsep":"0"} │+// │ info │ {"privsep":"1"} │// ├──────────────┼──────────────────────────────────────┤// │ value │ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx │// └──────────────┴──────────────────────────────────────┘diff --git a/internal/hostagent/proxmox_setup_test.go b/internal/hostagent/proxmox_setup_test.goindex 1164b48812..0f86f38119 100644--- a/internal/hostagent/proxmox_setup_test.go+++ b/internal/hostagent/proxmox_setup_test.go@@ -16,6 +16,38 @@ import ("github.com/rs/zerolog")+type commandCall struct {+ name string+ args []string+}++func newCommandCall(name string, args ...string) commandCall {+ return commandCall{name: name, args: append([]string(nil), args...)}+}++func commandCallIndex(calls []commandCall, name string, args ...string) int {+ for i, call := range calls {+ if call.name != name || len(call.args) != len(args) {+ continue+ }+ matches := true+ for j := range args {+ if call.args[j] != args[j] {+ matches = false+ break+ }+ }+ if matches {+ return i+ }+ }+ return -1+}++func hasCommandCall(calls []commandCall, name string, args ...string) bool {+ return commandCallIndex(calls, name, args...) >= 0+}+func canonicalSetupScriptCommand(expectedScriptURL string, setupToken string) string {return fmt.Sprintf(`curl -fsSL '%s' | { if [ "$(id -u)" -eq 0 ]; then PULSE_SETUP_TOKEN='%s' bash; elif command -v sudo >/dev/null 2>&1; then sudo env PULSE_SETUP_TOKEN='%s' bash; else echo "Root privileges required. Run as root (su -) and retry." >&2; exit 1; fi; }`,@@ -559,7 +591,7 @@ func TestProxmoxSetup_RunForType(t *testing.T) {t.Run("performs registration successfully", func(t *testing.T) {mc.statFn = func(name string) (os.FileInfo, error) { return nil, os.ErrNotExist }mc.commandCombinedOutputFn = func(ctx context.Context, name string, arg ...string) (string, error) {- // pveum user token add pulse-monitor@pve ... --privsep 0+ // pveum user token add pulse-monitor@pve ... --privsep 1// arg[0]=user, arg[1]=token, arg[2]=addif name == "pveum" && len(arg) > 2 && arg[1] == "token" && arg[2] == "add" {return "│ value │ my-token │", nil@@ -582,6 +614,66 @@ func TestProxmoxSetup_RunForType(t *testing.T) {})}+func TestProxmoxSetup_SetupPVETokenUsesPrivilegeSeparatedTokenACLs(t *testing.T) {+ mc := &mockCollector{}+ calls := make([]commandCall, 0)+ tokenName := "pulse-node-1"+ tokenID := fmt.Sprintf("%s!%s", proxmoxUserPVE, tokenName)++ mc.commandCombinedOutputFn = func(ctx context.Context, name string, arg ...string) (string, error) {+ calls = append(calls, newCommandCall(name, arg...))+ if name == "pveum" && len(arg) > 2 && arg[1] == "token" && arg[2] == "add" {+ return "│ value │ pve-token-value │", nil+ }+ return "", nil+ }++ p := &ProxmoxSetup{+ logger: zerolog.Nop(),+ collector: mc,+ }++ gotTokenID, gotTokenValue, err := p.setupPVEToken(context.Background(), tokenName)+ if err != nil {+ t.Fatalf("setupPVEToken() error = %v", err)+ }+ if gotTokenID != tokenID {+ t.Fatalf("tokenID = %q, want %q", gotTokenID, tokenID)+ }+ if gotTokenValue != "pve-token-value" {+ t.Fatalf("tokenValue = %q, want pve-token-value", gotTokenValue)+ }++ tokenAddIndex := commandCallIndex(calls, "pveum", "user", "token", "add", proxmoxUserPVE, tokenName, "--privsep", "1")+ if tokenAddIndex < 0 {+ t.Fatalf("missing privilege-separated PVE token creation command; calls=%#v", calls)+ }+ if hasCommandCall(calls, "pveum", "user", "token", "add", proxmoxUserPVE, tokenName, "--privsep", "0") {+ t.Fatalf("PVE setup still creates an unprivileged shared token")+ }++ requiredACLs := []struct {+ name string+ args []string+ }{+ {name: "pveum", args: []string{"aclmod", "/", "-user", proxmoxUserPVE, "-role", "PVEAuditor"}},+ {name: "pveum", args: []string{"aclmod", "/", "-token", tokenID, "-role", "PVEAuditor"}},+ {name: "pveum", args: []string{"aclmod", "/", "-user", proxmoxUserPVE, "-role", proxmoxMonitorRole}},+ {name: "pveum", args: []string{"aclmod", "/", "-token", tokenID, "-role", proxmoxMonitorRole}},+ {name: "pveum", args: []string{"aclmod", "/storage", "-user", proxmoxUserPVE, "-role", "PVEDatastoreAdmin"}},+ {name: "pveum", args: []string{"aclmod", "/storage", "-token", tokenID, "-role", "PVEDatastoreAdmin"}},+ }+ for _, required := range requiredACLs {+ idx := commandCallIndex(calls, required.name, required.args...)+ if idx < 0 {+ t.Fatalf("missing PVE ACL command %s %#v; calls=%#v", required.name, required.args, calls)+ }+ if idx < tokenAddIndex {+ t.Fatalf("PVE token ACL %s %#v was applied before token creation", required.name, required.args)+ }+ }+}+func TestPrivProbeRoleName_Sanitizes(t *testing.T) {got := privProbeRoleName("VM.GuestAgent.Audit")if got != "PulseTmpPrivCheck_VM_GuestAgent_Audit" {@@ -656,8 +748,11 @@ func TestProxmoxSetup_ProbePVEPrivilege_ReturnsFalseOnAddError(t *testing.T) {func TestProxmoxSetup_ConfigurePVEPermissions_FallsBackToGuestAgentAudit(t *testing.T) {mc := &mockCollector{}var pulseMonitorPrivs string+ var calls []commandCall+ tokenID := fmt.Sprintf("%s!%s", proxmoxUserPVE, "pulse-node-1")mc.commandCombinedOutputFn = func(ctx context.Context, name string, arg ...string) (string, error) {+ calls = append(calls, newCommandCall(name, arg...))if name != "pveum" {return "", nil}@@ -693,7 +788,7 @@ func TestProxmoxSetup_ConfigurePVEPermissions_FallsBackToGuestAgentAudit(t *testcollector: mc,}- p.configurePVEPermissions(context.Background())+ p.configurePVEPermissions(context.Background(), tokenID)if !strings.Contains(pulseMonitorPrivs, "VM.GuestAgent.Audit") {t.Fatalf("expected PulseMonitor privileges to include VM.GuestAgent.Audit, got %q", pulseMonitorPrivs)@@ -704,6 +799,9 @@ func TestProxmoxSetup_ConfigurePVEPermissions_FallsBackToGuestAgentAudit(t *testif strings.Contains(pulseMonitorPrivs, " ") {t.Fatalf("expected comma-separated privileges, got %q", pulseMonitorPrivs)}+ if !hasCommandCall(calls, "pveum", "aclmod", "/", "-token", tokenID, "-role", proxmoxMonitorRole) {+ t.Fatalf("expected PulseMonitor role to be applied to the privilege-separated token; calls=%#v", calls)+ }}func TestProxmoxSetup_RunAll(t *testing.T) {diff --git a/scripts/installtests/root_install_sh_test.go b/scripts/installtests/root_install_sh_test.goindex c2ccefda05..5f13a15341 100644--- a/scripts/installtests/root_install_sh_test.go+++ b/scripts/installtests/root_install_sh_test.go@@ -229,6 +229,12 @@ func TestRootInstallScriptAutoRegisterUsesSecureContractShape(t *testing.T) {`AUTO_NODE_REGISTERED_NAME="$register_node_name"`,`curl --retry 3 --retry-delay 2 -fsS -X POST "$pulse_url/api/setup-script-url" -H "Content-Type: application/json" -d "$setup_payload"`,`curl --retry 3 --retry-delay 2 -fsS -X POST "$pulse_url/api/auto-register" -H "Content-Type: application/json" -d "$register_payload"`,+ `token_output=$(pveum user token add pulse-monitor@pve "$token_name" --privsep 1 2>&1)`,+ `pveum aclmod / -token "$token_id" -role PVEAuditor`,+ `pveum aclmod / -token "$token_id" -role PulseMonitor`,+ `pveum aclmod /storage -token "$token_id" -role PVEDatastoreAdmin`,+ `priv_string="$(IFS=,; echo "${extra_privs[*]}")"`,+ `pveum role modify PulseMonitor -privs "$priv_string"`,`slug = re.sub(r"[^a-z0-9]+", "-", host)`,`print(f"pulse-{slug}")`,}@@ -244,6 +250,8 @@ func TestRootInstallScriptAutoRegisterUsesSecureContractShape(t *testing.T) {`local bootstrap_token=""`,`X-Setup-Token: $bootstrap_token`,`Discovered bootstrap token from container`,+ `--privsep 0`,+ `pveum role delete PulseMonitor`,}for _, needle := range forbidden {if strings.Contains(script, needle) {