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.

Protect inside-guest Docker visibility boundaries

rcourtman5a405f7f0724
diff --git a/cmd/pulse-agent/main.go b/cmd/pulse-agent/main.go
index 9f67c85ff9..f664a88b6f 100644
--- a/cmd/pulse-agent/main.go
+++ b/cmd/pulse-agent/main.go
@@ -667,12 +667,13 @@ type Config struct {
Logger *zerolog.Logger
// Module flags
- EnableHost bool
- EnableDocker bool
- DockerConfigured bool
- EnableKubernetes bool
- EnableProxmox bool
- ProxmoxType string // "pve", "pbs", or "" for auto-detect
+ EnableHost bool
+ EnableDocker bool
+ DockerConfigured bool
+ DockerExplicitlyDisabled bool
+ EnableKubernetes bool
+ EnableProxmox bool
+ ProxmoxType string // "pve", "pbs", or "" for auto-detect
// Auto-update
DisableAutoUpdate bool
@@ -901,12 +902,22 @@ func loadConfig(args []string, getenv func(string) string) (Config, error) {
kubeExcludeNamespaces := gatherCSV(envKubeExcludeNamespaces, kubeExcludeNamespaceFlags)
diskExclude := gatherCSV(envDiskExclude, diskExcludeFlags)
- // Check if Docker was explicitly configured via fs or env
+ // Check if Docker was explicitly configured via fs or env. An explicit
+ // local disable is a privacy boundary and cannot be reversed by remote
+ // profile config or auto-detection.
dockerConfigured := envEnableDocker != ""
+ dockerExplicitlyDisabled := envEnableDocker != "" && !utils.ParseBool(envEnableDocker)
if !dockerConfigured {
fs.Visit(func(f *flag.Flag) {
if f.Name == "enable-docker" {
dockerConfigured = true
+ dockerExplicitlyDisabled = !*enableDockerFlag
+ }
+ })
+ } else {
+ fs.Visit(func(f *flag.Flag) {
+ if f.Name == "enable-docker" {
+ dockerExplicitlyDisabled = !*enableDockerFlag
}
})
}
@@ -927,6 +938,7 @@ func loadConfig(args []string, getenv func(string) string) (Config, error) {
EnableHost: *enableHostFlag,
EnableDocker: *enableDockerFlag,
DockerConfigured: dockerConfigured,
+ DockerExplicitlyDisabled: dockerExplicitlyDisabled,
EnableKubernetes: *enableKubernetesFlag,
EnableProxmox: *enableProxmoxFlag,
ProxmoxType: strings.TrimSpace(*proxmoxTypeFlag),
@@ -1264,6 +1276,11 @@ func applyRemoteSettings(cfg *Config, settings map[string]interface{}, logger *z
}
case "enable_docker":
if b, ok := v.(bool); ok {
+ if b && cfg.DockerExplicitlyDisabled {
+ cfg.DockerConfigured = true
+ logger.Info().Msg("Remote config: enable_docker ignored because Docker / Podman monitoring is locally disabled")
+ continue
+ }
cfg.EnableDocker = b
cfg.DockerConfigured = true
logger.Info().Bool("val", b).Msg("Remote config: enable_docker")
diff --git a/cmd/pulse-agent/main_test.go b/cmd/pulse-agent/main_test.go
index eff2cbe6a0..3ad99e8f0e 100644
--- a/cmd/pulse-agent/main_test.go
+++ b/cmd/pulse-agent/main_test.go
@@ -288,6 +288,29 @@ func TestApplyRemoteSettings(t *testing.T) {
}
}
+func TestApplyRemoteSettingsHonorsLocalDockerOptOut(t *testing.T) {
+ logger := zerolog.New(io.Discard)
+ cfg := &Config{
+ EnableDocker: false,
+ DockerConfigured: true,
+ DockerExplicitlyDisabled: true,
+ }
+
+ applyRemoteSettings(cfg, map[string]interface{}{
+ "enable_docker": true,
+ }, &logger)
+
+ if cfg.EnableDocker {
+ t.Fatal("remote config must not enable Docker / Podman after a local explicit disable")
+ }
+ if !cfg.DockerConfigured {
+ t.Fatal("expected DockerConfigured to remain true")
+ }
+ if !cfg.DockerExplicitlyDisabled {
+ t.Fatal("expected DockerExplicitlyDisabled to remain true")
+ }
+}
+
func TestApplyRemoteSettingsIntervalFloat(t *testing.T) {
logger := zerolog.New(io.Discard)
cfg := &Config{}
@@ -1285,6 +1308,37 @@ func TestRun(t *testing.T) {
})
}
+func TestDockerAutoDetectHonorsExplicitDisable(t *testing.T) {
+ origDocker := newDockerAgent
+ origLook := lookPath
+ defer func() {
+ newDockerAgent = origDocker
+ lookPath = origLook
+ }()
+
+ var dockerAgentCalls int32
+ newDockerAgent = func(cfg dockeragent.Config) (RunnableCloser, error) {
+ atomic.AddInt32(&dockerAgentCalls, 1)
+ return &mockRunnableCloser{}, nil
+ }
+ lookPath = func(path string) (string, error) {
+ if path == "docker" {
+ return "/usr/bin/docker", nil
+ }
+ return "", os.ErrNotExist
+ }
+
+ ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond)
+ defer cancel()
+ err := run(ctx, []string{"-enable-host=false", "-enable-docker=false", "-enable-kubernetes=false", "-health-addr", ""}, func(s string) string { return "" })
+ if err != nil && err != context.Canceled && err != context.DeadlineExceeded {
+ t.Fatalf("run returned unexpected error: %v", err)
+ }
+ if got := atomic.LoadInt32(&dockerAgentCalls); got != 0 {
+ t.Fatalf("Docker / Podman agent initialized despite explicit disable, calls=%d", got)
+ }
+}
+
func TestCleanupDockerAgent_Nil(t *testing.T) {
cleanupDockerAgent(nil, nil)
}
@@ -1610,6 +1664,9 @@ func TestLoadConfig_Comprehensive(t *testing.T) {
if !cfg.DockerConfigured {
t.Error("DockerConfigured should be true when flag is set")
}
+ if cfg.DockerExplicitlyDisabled {
+ t.Error("DockerExplicitlyDisabled should be false when flag enables Docker")
+ }
},
},
{
@@ -1648,6 +1705,60 @@ func TestLoadConfig_Comprehensive(t *testing.T) {
if !cfg.DockerConfigured {
t.Error("DockerConfigured should be true when env is set")
}
+ if cfg.DockerExplicitlyDisabled {
+ t.Error("DockerExplicitlyDisabled should be false when env enables Docker")
+ }
+ },
+ },
+ {
+ name: "docker explicitly disabled by flag",
+ args: []string{"-token", "T", "-enable-docker=false"},
+ validate: func(t *testing.T, cfg Config) {
+ if !cfg.DockerConfigured {
+ t.Error("DockerConfigured should be true when Docker flag is set")
+ }
+ if !cfg.DockerExplicitlyDisabled {
+ t.Error("DockerExplicitlyDisabled should be true when flag disables Docker")
+ }
+ if cfg.EnableDocker {
+ t.Error("EnableDocker should be false when flag disables Docker")
+ }
+ },
+ },
+ {
+ name: "docker explicitly disabled by env",
+ args: []string{"-token", "T"},
+ env: map[string]string{
+ "PULSE_ENABLE_DOCKER": "false",
+ },
+ validate: func(t *testing.T, cfg Config) {
+ if !cfg.DockerConfigured {
+ t.Error("DockerConfigured should be true when Docker env is set")
+ }
+ if !cfg.DockerExplicitlyDisabled {
+ t.Error("DockerExplicitlyDisabled should be true when env disables Docker")
+ }
+ if cfg.EnableDocker {
+ t.Error("EnableDocker should be false when env disables Docker")
+ }
+ },
+ },
+ {
+ name: "docker env disable overridden by enabling flag",
+ args: []string{"-token", "T", "-enable-docker=true"},
+ env: map[string]string{
+ "PULSE_ENABLE_DOCKER": "false",
+ },
+ validate: func(t *testing.T, cfg Config) {
+ if !cfg.DockerConfigured {
+ t.Error("DockerConfigured should be true when Docker env or flag is set")
+ }
+ if cfg.DockerExplicitlyDisabled {
+ t.Error("DockerExplicitlyDisabled should be false when explicit flag enables Docker")
+ }
+ if !cfg.EnableDocker {
+ t.Error("EnableDocker should be true when flag enables Docker")
+ }
},
},
{
@@ -1660,6 +1771,9 @@ func TestLoadConfig_Comprehensive(t *testing.T) {
if cfg.EnableDocker {
t.Error("EnableDocker should be false by default")
}
+ if cfg.DockerExplicitlyDisabled {
+ t.Error("DockerExplicitlyDisabled should be false when Docker is unconfigured")
+ }
if cfg.HealthAddr != "127.0.0.1:9191" {
t.Errorf("HealthAddr: got %q, want loopback default", cfg.HealthAddr)
}
diff --git a/docs/AGENT_SECURITY.md b/docs/AGENT_SECURITY.md
index a6b28114dc..7d60610e36 100644
--- a/docs/AGENT_SECURITY.md
+++ b/docs/AGENT_SECURITY.md
@@ -56,6 +56,16 @@ answers your monitoring question:
| Host SMART, temperatures, local ZFS/Ceph/mdadm detail, arbitrary mount reads, and full host telemetry | Install the agent on that host | Yes, for the supported full-telemetry profile |
| Kubernetes node/pod monitoring from a cluster | Use the Kubernetes agent/DaemonSet profile | Depends on whether host metrics are enabled |
+Inside-guest runtime visibility is explicit. Installing the agent inside a VM or
+LXC authorizes that guest-local agent to report Docker/Podman monitoring data
+according to its local module flags. A Proxmox node agent does not collect
+container inventory from guests through `pct exec`; at most, Pulse can perform a
+socket-presence hint for LXC guests, and that hint is disabled unless the server
+is started with `PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION=true`. That probe
+only checks for `/var/run/docker.sock` so Pulse can label the guest as a likely
+Docker host; full Docker page inventory still requires an agent inside the guest
+or another explicit Docker/Podman reporting path.
+
If Proxmox API data is enough for your use case, prefer API-only monitoring and
do not install a host agent just because the installer exists. Install agents
where you need data that Proxmox cannot provide through its API, or where the
diff --git a/docs/CENTRALIZED_MANAGEMENT.md b/docs/CENTRALIZED_MANAGEMENT.md
index cede8f820b..2bcffe6f7a 100644
--- a/docs/CENTRALIZED_MANAGEMENT.md
+++ b/docs/CENTRALIZED_MANAGEMENT.md
@@ -8,7 +8,7 @@ Profiles are managed in the UI: **Settings → Unified Agents → Agent Profiles
- **Agent Profile**: A named collection of configuration settings (e.g., "Production Servers", "Debug Mode").
- **Assignment**: A link between a specific Agent ID and an Agent Profile.
-- **Precedence**: Server-side profile settings override local agent flags/environment for supported keys.
+- **Precedence**: Server-side profile settings override local agent flags/environment for supported keys, except for explicit local privacy opt-outs.
## Supported Configuration Keys
@@ -33,7 +33,7 @@ The following settings can be controlled remotely via profiles:
Notes:
- `interval` accepts a duration string. If you send a JSON number, it is interpreted as seconds.
-- Docker auto-detection can still enable Docker monitoring if the agent is not explicitly configured. To force-disable Docker, set `PULSE_ENABLE_DOCKER=false` or install with `--enable-docker=false` on the host.
+- Docker auto-detection can still enable Docker monitoring if the agent is not explicitly configured. To force-disable Docker, set `PULSE_ENABLE_DOCKER=false` or install with `--enable-docker=false` on the host. That local disable also blocks remote profiles from turning Docker/Podman monitoring back on.
- `commandsEnabled` (AI command execution) is controlled separately per agent in **Settings → Unified Agents** and is applied live on report. It is not part of profile settings.
## API Usage
diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md
index 95c133de3c..d1939e8ec1 100644
--- a/docs/CONFIGURATION.md
+++ b/docs/CONFIGURATION.md
@@ -276,6 +276,7 @@ When `allowEmbedding` is `false`, Pulse sends `X-Frame-Options: DENY` and `frame
| `DNS_CACHE_TIMEOUT` | Cache TTL for DNS lookups | `5m` |
| `MAX_POLL_TIMEOUT` | Maximum time per polling cycle | `3m` |
| `PULSE_DISABLE_DOCKER_UPDATE_ACTIONS` | Hide Docker update buttons (read-only mode) | `false` |
+| `PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION` | Allow Proxmox-side LXC Docker socket hinting with `pct exec`; full Docker inventory still requires an agent inside the guest | `false` |
| `PULSE_TELEMETRY` | Anonymous outbound usage telemetry ([details](PRIVACY.md)); set `false` to disable | `true` |
### Logging Overrides
diff --git a/docs/UNIFIED_AGENT.md b/docs/UNIFIED_AGENT.md
index abf0487471..d8a9c221f3 100644
--- a/docs/UNIFIED_AGENT.md
+++ b/docs/UNIFIED_AGENT.md
@@ -118,7 +118,7 @@ health/metrics endpoint over the network. Use `--health-addr ""` or
Auto-detection behavior:
- **Host metrics**: Enabled by default.
-- **Docker/Podman**: Enabled automatically by the agent if Docker/Podman is detected and `PULSE_ENABLE_DOCKER` was not explicitly set.
+- **Docker/Podman**: Enabled automatically by the agent if Docker/Podman is detected and `PULSE_ENABLE_DOCKER` was not explicitly set. A local `--enable-docker=false` or `PULSE_ENABLE_DOCKER=false` is a hard opt-out and is not re-enabled by auto-detection or remote profile config.
- **Kubernetes**: Enabled automatically by the installer when a kubeconfig is detected and `PULSE_ENABLE_KUBERNETES` was not explicitly set.
- **Proxmox**: Enabled automatically by the installer when Proxmox is detected. Type auto-detects `pve` vs `pbs` if not specified.
@@ -128,6 +128,20 @@ To disable auto-detection, explicitly set the relevant flags or env vars, for ex
- `--enable-kubernetes=false` or `PULSE_ENABLE_KUBERNETES=false`
- `--enable-proxmox=false` or `PULSE_ENABLE_PROXMOX=false`
+### Inside-Guest Runtime Boundaries
+
+Docker/Podman inside a VM or LXC is monitored from inside that guest. Install the
+Unified Agent in the guest when you want full Docker host, container, service,
+and task inventory on the Docker page.
+
+Pulse does not use a Proxmox node agent to collect guest container inventory by
+default. The optional Proxmox-side LXC Docker hint is off unless the Pulse server
+is started with `PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION=true`. That hint
+uses `pct exec` only to check whether `/var/run/docker.sock` exists in a running
+LXC; it does not enumerate containers, images, environment variables, files, or
+processes. Use it only when operators are comfortable with Proxmox-side guest
+probing for placement hints.
+
## Installation Options
### Simple Install (host + Docker auto-detect)
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index 80bbd25dff..e1590a58ee 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -3393,6 +3393,119 @@
"kind": "file"
}
]
+ },
+ {
+ "id": "RA30",
+ "summary": "Inside-guest runtime visibility is explicit and privacy-bounded: Pulse may show Docker/Podman workloads from a VM or LXC only when a guest-local agent or another explicit Docker/Podman reporting path reports them. Proxmox-side guest probing must stay opt-in, limited to Docker socket presence hints, and must not collect guest container inventory, images, environment values, files, or process details. A local Unified Agent Docker/Podman disable must remain a hard opt-out that remote profiles and auto-detection cannot reverse.",
+ "kind": "trust-gate",
+ "blocking_level": "repo-ready",
+ "proof_type": "automated",
+ "lane_ids": [
+ "L14",
+ "L16"
+ ],
+ "subsystem_ids": [
+ "agent-lifecycle",
+ "security-privacy"
+ ],
+ "release_gate_ids": [],
+ "proof_commands": [
+ {
+ "id": "agent-docker-privacy-opt-out-tests",
+ "run": [
+ "go",
+ "test",
+ "./cmd/pulse-agent",
+ "-run",
+ "TestApplyRemoteSettingsHonorsLocalDockerOptOut|TestDockerAutoDetectHonorsExplicitDisable|TestLoadConfig_Comprehensive",
+ "-count=1"
+ ]
+ },
+ {
+ "id": "proxmox-guest-docker-detection-opt-in-tests",
+ "run": [
+ "go",
+ "test",
+ "./internal/api",
+ "./internal/config",
+ "-run",
+ "TestContract_ProxmoxGuestDockerDetectionRequiresExplicitOptIn|TestLoad_EnvOverrides_ProxmoxGuestDockerDetectionOptIn|TestLoad_ProxmoxGuestDockerDetectionEnvOptIn",
+ "-count=1"
+ ]
+ }
+ ],
+ "evidence": [
+ {
+ "repo": "pulse",
+ "path": "cmd/pulse-agent/main.go",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "cmd/pulse-agent/main_test.go",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "docs/AGENT_SECURITY.md",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "docs/CENTRALIZED_MANAGEMENT.md",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "docs/CONFIGURATION.md",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "docs/release-control/v6/internal/status.json",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "docs/release-control/v6/internal/subsystems/agent-lifecycle.md",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "docs/release-control/v6/internal/subsystems/security-privacy.md",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "docs/UNIFIED_AGENT.md",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "internal/api/contract_test.go",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "internal/api/router.go",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "internal/config/config.go",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "internal/config/config_env_overrides_test.go",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "internal/config/config_load_test.go",
+ "kind": "file"
+ }
+ ]
}
],
"evidence_reference_policy": {
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index f508a6400e..8bdd4c981e 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -101,6 +101,12 @@ management, and fleet control surfaces.
but Docker runtime capability truth is monitoring-owned. Lifecycle consumers
must not reinterpret standalone `Swarm.LocalNodeState=inactive` metadata as
agent enrollment, install, command, or fleet-control authority.
+Inside-guest Docker / Podman visibility is also a privacy boundary: full
+VM/LXC Docker inventory must come from a guest-local agent or another explicit
+Docker / Podman reporting path, not from Proxmox node-side guest scraping. A
+local `--enable-docker=false` or `PULSE_ENABLE_DOCKER=false` remains a hard
+Unified Agent opt-out that auto-detection and remote profile settings cannot
+reverse.
1. `frontend-modern/src/api/agentProfiles.ts` shared with `api-contracts`: the agent profiles frontend client is both an agent lifecycle control surface and a canonical API payload contract boundary.
2. `frontend-modern/src/api/nodes.ts` shared with `api-contracts`: the shared Proxmox node client is both an agent lifecycle setup/install control surface and a canonical API payload contract boundary.
@@ -550,6 +556,10 @@ profile and assignment columns, but embedded table framing must route through
help text and inline comments must describe the module and runtime as
Docker / Podman rather than exposing the generic container-runtime family
label.
+ The CLI entrypoint also owns the local Docker / Podman privacy opt-out:
+ when `--enable-docker=false` or `PULSE_ENABLE_DOCKER=false` is set on
+ the host, auto-detection and remote config must not start the Docker /
+ Podman module.
8. Add or change installer flags, persisted service arguments, or upgrade-safe re-entry behavior through `scripts/install.sh` and `scripts/install.ps1`.
Persistence-sensitive NAS targets must keep one canonical continuity model here: installer-owned bootstraps may use flash-backed or immutable-root launch hooks only as thin trampolines, while the durable wrapper, state, and reboot-surviving binary copy stay in the governed persistent state directory that updater continuity also refreshes.
Approval-gated command execution must expose stable rejection reasons for
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index bc3a4b72f9..a034fec5bc 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -10,6 +10,7 @@
"status_file": "docs/release-control/v6/internal/status.json",
"registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
"dependency_subsystem_ids": [
+ "agent-lifecycle",
"api-contracts"
]
}
@@ -139,6 +140,7 @@ controls as normal product settings.
auth-env reloads, hosted entitlement refresh origins, and
pinned-fingerprint TLS clients keep one fail-closed security floor.
9. Change operator-facing Resource Privacy/Data Handling posture through `frontend-modern/src/components/Settings/DataHandlingPanel.tsx` and `frontend-modern/src/components/Settings/dataHandlingPanelModel.ts` together so resource classification, handling-boundary, redaction copy, and the route-backed/hidden-sidebar presentation stay governed as a trust surface.
+10. Change inside-guest runtime collection boundaries through `docs/AGENT_SECURITY.md`, `docs/UNIFIED_AGENT.md`, `cmd/pulse-agent/main.go`, `internal/api/router.go`, and `internal/config/config.go` together. Docker / Podman inventory inside a VM or LXC must stay guest-agent or explicitly reported runtime data, Proxmox-side guest probing must remain opt-in and socket-presence-only, and local Unified Agent Docker / Podman disables must not be reversed by remote profile configuration.
## Forbidden Paths
@@ -173,6 +175,12 @@ controls as normal product settings.
use stable Pulse user/account/tenant IDs where they exist; SSO subject
migration must be explicit and compatible rather than silently substituting
email or display claims as durable principals.
+12. Keep inside-guest runtime visibility explicit: Pulse may show Docker /
+ Podman workloads from a VM or LXC only when a guest-local agent or another
+ explicit Docker / Podman reporting path supplies that inventory. Proxmox
+ node-side checks may only provide an opt-in socket-presence hint and must
+ not enumerate guest containers, images, environment values, files, or
+ process details.
## Current State
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index af8ddc741d..2db1cd105b 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -14365,3 +14365,46 @@ func TestContract_ResourceOperatorStateUrlCanonicalIDWinsOverBody(t *testing.T)
t.Errorf("body-supplied canonical_id must not have been persisted; GET vm:999 returned %d", rec2.Code)
}
}
+
+// TestContract_ProxmoxGuestDockerDetectionRequiresExplicitOptIn pins the
+// privacy boundary for Proxmox-side LXC Docker socket hinting. Router startup
+// may wire a Docker checker only when the server has the explicit opt-in config;
+// otherwise full guest runtime inventory must come from a guest-local agent or
+// another explicit Docker reporting path.
+func TestContract_ProxmoxGuestDockerDetectionRequiresExplicitOptIn(t *testing.T) {
+ t.Run("disabled without explicit opt-in", func(t *testing.T) {
+ monitor := &monitoring.Monitor{}
+ router := &Router{
+ config: &config.Config{
+ EnableProxmoxGuestDockerDetection: false,
+ },
+ agentExecServer: agentexec.NewServer(func(token string, agentID string, hostname string) bool {
+ return false
+ }),
+ }
+
+ router.configureProxmoxGuestDockerDetection(monitor)
+
+ if got := monitor.GetDockerChecker(); got != nil {
+ t.Fatalf("expected Proxmox guest Docker checker to stay disabled without explicit opt-in, got %T", got)
+ }
+ })
+
+ t.Run("enabled only with explicit opt-in", func(t *testing.T) {
+ monitor := &monitoring.Monitor{}
+ router := &Router{
+ config: &config.Config{
+ EnableProxmoxGuestDockerDetection: true,
+ },
+ agentExecServer: agentexec.NewServer(func(token string, agentID string, hostname string) bool {
+ return false
+ }),
+ }
+
+ router.configureProxmoxGuestDockerDetection(monitor)
+
+ if got := monitor.GetDockerChecker(); got == nil {
+ t.Fatal("expected Proxmox guest Docker checker after explicit opt-in")
+ }
+ })
+}
diff --git a/internal/api/router.go b/internal/api/router.go
index 135fc61be5..ef0021bf51 100644
--- a/internal/api/router.go
+++ b/internal/api/router.go
@@ -574,6 +574,9 @@ func (r *Router) setupRoutes() {
}
return false
})
+ if r.monitor != nil {
+ r.configureProxmoxGuestDockerDetection(r.monitor)
+ }
// Deploy store and handlers for cluster agent deployment
deployStore, deployErr := deploy.Open(filepath.Join(r.config.DataPath, "deploy.db"))
@@ -1293,30 +1296,42 @@ func (r *Router) SetMonitor(m *monitoring.Monitor) {
r.aiHandler.SetReadState(r.defaultReadState())
}
- // Set up Docker detector for automatic Docker detection in LXC containers
- if r.agentExecServer != nil {
- // Create a command executor function that wraps the agent exec server
- execFunc := func(ctx context.Context, hostname string, command string, timeout int) (string, int, error) {
- agentID, found := r.agentExecServer.GetAgentForHost(hostname)
- if !found {
- return "", -1, fmt.Errorf("no agent connected for host %s", hostname)
- }
- result, err := r.agentExecServer.ExecuteCommand(ctx, agentID, agentexec.ExecuteCommandPayload{
- RequestID: fmt.Sprintf("docker-check-%d", time.Now().UnixNano()),
- Command: command,
- Timeout: timeout,
- })
- if err != nil {
- return "", -1, err
- }
- return result.Stdout + result.Stderr, result.ExitCode, nil
- }
+ r.configureProxmoxGuestDockerDetection(m)
+ }
+}
+
+func (r *Router) configureProxmoxGuestDockerDetection(m *monitoring.Monitor) {
+ if r == nil || m == nil {
+ return
+ }
+ if r.config == nil || !r.config.EnableProxmoxGuestDockerDetection {
+ m.SetDockerChecker(nil)
+ return
+ }
+ if r.agentExecServer == nil {
+ m.SetDockerChecker(nil)
+ return
+ }
- checker := monitoring.NewAgentDockerChecker(execFunc)
- m.SetDockerChecker(checker)
- log.Info().Msg("[Router] Docker detector configured for automatic LXC Docker detection")
+ execFunc := func(ctx context.Context, hostname string, command string, timeout int) (string, int, error) {
+ agentID, found := r.agentExecServer.GetAgentForHost(hostname)
+ if !found {
+ return "", -1, fmt.Errorf("no agent connected for host %s", hostname)
+ }
+ result, err := r.agentExecServer.ExecuteCommand(ctx, agentID, agentexec.ExecuteCommandPayload{
+ RequestID: fmt.Sprintf("docker-check-%d", time.Now().UnixNano()),
+ Command: command,
+ Timeout: timeout,
+ })
+ if err != nil {
+ return "", -1, err
}
+ return result.Stdout + result.Stderr, result.ExitCode, nil
}
+
+ checker := monitoring.NewAgentDockerChecker(execFunc)
+ m.SetDockerChecker(checker)
+ log.Info().Msg("[Router] Proxmox guest Docker detector configured for explicit LXC socket hinting")
}
func (r *Router) defaultReadState() unifiedresources.ReadState {
diff --git a/internal/config/config.go b/internal/config/config.go
index 41bd36d089..7a952011f1 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -194,18 +194,19 @@ type Config struct {
LogCompress bool `envconfig:"LOG_COMPRESS" default:"true"`
// Security settings
- APIToken string
- APITokens []APITokenRecord `json:"-"`
- AuthUser string `envconfig:"PULSE_AUTH_USER"`
- AuthPass string `envconfig:"PULSE_AUTH_PASS"`
- DemoMode bool `envconfig:"DEMO_MODE" default:"false"` // Read-only demo mode
- AllowedOrigins string `envconfig:"ALLOWED_ORIGINS" default:"*"`
- HideLocalLogin bool `envconfig:"PULSE_AUTH_HIDE_LOCAL_LOGIN" default:"false"`
- DisableDockerUpdateActions bool `envconfig:"PULSE_DISABLE_DOCKER_UPDATE_ACTIONS" default:"false"` // Hide Docker update buttons (read-only mode for containers)
- TelemetryEnabled bool `envconfig:"PULSE_TELEMETRY" default:"true"` // Anonymous outbound usage telemetry enabled by default (install ID, version, resource counts, feature flags — opt out any time)
- MultiTenantEnabled bool `envconfig:"PULSE_MULTI_TENANT_ENABLED" default:"false"` // Enable multi-tenant support
- MetricsToken string `envconfig:"PULSE_METRICS_TOKEN" default:"" json:"-"` // Bearer token for /metrics endpoint (empty = unauthenticated)
- ProTrialSignupURL string `envconfig:"PULSE_PRO_TRIAL_SIGNUP_URL" default:""` // Legacy hosted commercial base URL used for entitlement refresh compatibility
+ APIToken string
+ APITokens []APITokenRecord `json:"-"`
+ AuthUser string `envconfig:"PULSE_AUTH_USER"`
+ AuthPass string `envconfig:"PULSE_AUTH_PASS"`
+ DemoMode bool `envconfig:"DEMO_MODE" default:"false"` // Read-only demo mode
+ AllowedOrigins string `envconfig:"ALLOWED_ORIGINS" default:"*"`
+ HideLocalLogin bool `envconfig:"PULSE_AUTH_HIDE_LOCAL_LOGIN" default:"false"`
+ DisableDockerUpdateActions bool `envconfig:"PULSE_DISABLE_DOCKER_UPDATE_ACTIONS" default:"false"` // Hide Docker update buttons (read-only mode for containers)
+ EnableProxmoxGuestDockerDetection bool `envconfig:"PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION" default:"false" json:"-"` // Allow Proxmox-side pct exec probes that only detect Docker socket presence inside LXC guests
+ TelemetryEnabled bool `envconfig:"PULSE_TELEMETRY" default:"true"` // Anonymous outbound usage telemetry enabled by default (install ID, version, resource counts, feature flags — opt out any time)
+ MultiTenantEnabled bool `envconfig:"PULSE_MULTI_TENANT_ENABLED" default:"false"` // Enable multi-tenant support
+ MetricsToken string `envconfig:"PULSE_METRICS_TOKEN" default:"" json:"-"` // Bearer token for /metrics endpoint (empty = unauthenticated)
+ ProTrialSignupURL string `envconfig:"PULSE_PRO_TRIAL_SIGNUP_URL" default:""` // Legacy hosted commercial base URL used for entitlement refresh compatibility
// Proxy authentication settings
ProxyAuthSecret string `envconfig:"PROXY_AUTH_SECRET"`
@@ -1070,6 +1071,18 @@ func load(initLogging bool) (*Config, error) {
}
}
+ if guestDockerDetectionStr := utils.GetenvTrim("PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION"); guestDockerDetectionStr != "" {
+ if enabled, err := strconv.ParseBool(guestDockerDetectionStr); err == nil {
+ cfg.EnableProxmoxGuestDockerDetection = enabled
+ cfg.EnvOverrides["PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION"] = true
+ log.Info().Bool("enabled", enabled).Msg("Overriding Proxmox guest Docker detection setting from environment")
+ } else {
+ log.Warn().
+ Str("value", guestDockerDetectionStr).
+ Msg("Invalid PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION value, ignoring")
+ }
+ }
+
if telemetryStr := utils.GetenvTrim("PULSE_TELEMETRY"); telemetryStr != "" {
if enabled, err := strconv.ParseBool(telemetryStr); err == nil {
cfg.TelemetryEnabled = enabled
diff --git a/internal/config/config_env_overrides_test.go b/internal/config/config_env_overrides_test.go
index eaf0ce412e..c67b06c956 100644
--- a/internal/config/config_env_overrides_test.go
+++ b/internal/config/config_env_overrides_test.go
@@ -18,6 +18,7 @@ func TestLoad_EnvOverrides_Comprehensive(t *testing.T) {
"ENABLE_TEMPERATURE_MONITORING",
"PULSE_AUTH_HIDE_LOCAL_LOGIN",
"PULSE_DISABLE_DOCKER_UPDATE_ACTIONS",
+ "PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION",
"ENABLE_BACKUP_POLLING",
"ADAPTIVE_POLLING_ENABLED",
"ADAPTIVE_POLLING_BASE_INTERVAL",
@@ -40,6 +41,7 @@ func TestLoad_EnvOverrides_Comprehensive(t *testing.T) {
t.Setenv("ENABLE_TEMPERATURE_MONITORING", "false")
t.Setenv("PULSE_AUTH_HIDE_LOCAL_LOGIN", "true")
t.Setenv("PULSE_DISABLE_DOCKER_UPDATE_ACTIONS", "true")
+ t.Setenv("PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION", "true")
t.Setenv("ENABLE_BACKUP_POLLING", "false")
t.Setenv("ADAPTIVE_POLLING_ENABLED", "true")
t.Setenv("ADAPTIVE_POLLING_BASE_INTERVAL", "20s")
@@ -57,6 +59,8 @@ func TestLoad_EnvOverrides_Comprehensive(t *testing.T) {
assert.False(t, cfg.TemperatureMonitoringEnabled)
assert.True(t, cfg.HideLocalLogin)
assert.True(t, cfg.DisableDockerUpdateActions)
+ assert.True(t, cfg.EnableProxmoxGuestDockerDetection)
+ assert.True(t, cfg.EnvOverrides["PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION"])
assert.False(t, cfg.EnableBackupPolling)
assert.True(t, cfg.AdaptivePollingEnabled)
assert.Equal(t, 20*time.Second, cfg.AdaptivePollingBaseInterval)
@@ -167,6 +171,37 @@ func TestLoad_EnvOverrides_DockerUpdateActionsCanonicalOnly(t *testing.T) {
})
}
+func TestLoad_EnvOverrides_ProxmoxGuestDockerDetectionOptIn(t *testing.T) {
+ t.Run("defaults disabled", func(t *testing.T) {
+ t.Setenv("PULSE_DATA_DIR", t.TempDir())
+
+ cfg, err := Load()
+ require.NoError(t, err)
+ assert.False(t, cfg.EnableProxmoxGuestDockerDetection)
+ assert.False(t, cfg.EnvOverrides["PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION"])
+ })
+
+ t.Run("canonical env var", func(t *testing.T) {
+ t.Setenv("PULSE_DATA_DIR", t.TempDir())
+ t.Setenv("PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION", "true")
+
+ cfg, err := Load()
+ require.NoError(t, err)
+ assert.True(t, cfg.EnableProxmoxGuestDockerDetection)
+ assert.True(t, cfg.EnvOverrides["PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION"])
+ })
+
+ t.Run("invalid value ignored", func(t *testing.T) {
+ t.Setenv("PULSE_DATA_DIR", t.TempDir())
+ t.Setenv("PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION", "maybe")
+
+ cfg, err := Load()
+ require.NoError(t, err)
+ assert.False(t, cfg.EnableProxmoxGuestDockerDetection)
+ assert.False(t, cfg.EnvOverrides["PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION"])
+ })
+}
+
func TestLoad_EnvOverrides_InvalidFrontendPortIgnored(t *testing.T) {
t.Run("invalid FRONTEND_PORT", func(t *testing.T) {
t.Setenv("PULSE_DATA_DIR", t.TempDir())
diff --git a/internal/config/config_load_test.go b/internal/config/config_load_test.go
index 2646b2b7c8..008714ed5b 100644
--- a/internal/config/config_load_test.go
+++ b/internal/config/config_load_test.go
@@ -85,6 +85,22 @@ func TestLoad_EnvOverrides(t *testing.T) {
assert.Equal(t, "admin", cfg.AuthUser)
}
+func TestLoad_ProxmoxGuestDockerDetectionEnvOptIn(t *testing.T) {
+ t.Setenv("PULSE_DATA_DIR", t.TempDir())
+
+ cfg, err := Load()
+ require.NoError(t, err)
+ assert.False(t, cfg.EnableProxmoxGuestDockerDetection)
+ assert.False(t, cfg.EnvOverrides["PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION"])
+
+ t.Setenv("PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION", "true")
+
+ cfg, err = Load()
+ require.NoError(t, err)
+ assert.True(t, cfg.EnableProxmoxGuestDockerDetection)
+ assert.True(t, cfg.EnvOverrides["PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION"])
+}
+
func TestLoad_MetricsStorageEnvOverrides(t *testing.T) {
t.Setenv("PULSE_DATA_DIR", t.TempDir())
t.Setenv("PULSE_METRICS_DB_PATH", "/dev/shm/pulse/metrics.db")