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
Gate Docker mutations on authz-plugin posture
rcourtmane6b0d47bd6a8
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex 1476817791..0c3d005243 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -209,6 +209,14 @@ publish those resources from the same canonical unified snapshot thatraw store-only inventory for broadcast. Otherwise cold hydrate and laterregistry-backed refreshes can swap the operator-visible infrastructure setunder one running session.+That same Docker/Podman monitoring boundary now also owns Docker+authorization-plugin posture. `internal/dockeragent/collect.go` must project+`system.Info().Plugins.Authorization` into the canonical agent report,+`internal/monitoring/monitor_agents.go` must preserve that posture on the+shared Docker host model, and `internal/monitoring/docker_commands.go` must+refuse Docker daemon-mutating commands when authorization plugins are+configured until the upstream Moby authz-plugin advisory line has a fixed Go+module release.That same monitoring owner now also governs restart-safe standalone hostcontinuity for monitored-system usage and admission. `internal/monitoring/monitor_agents.go`must persist recent host identity at report time, anddiff --git a/internal/api/docker_agents_additional_test.go b/internal/api/docker_agents_additional_test.goindex 7122bda79d..00999c22a7 100644--- a/internal/api/docker_agents_additional_test.go+++ b/internal/api/docker_agents_additional_test.go@@ -319,6 +319,45 @@ func TestDockerAgentHandlers_HandleContainerUpdate_Disabled(t *testing.T) {}}+func TestDockerAgentHandlers_HandleContainerUpdate_BlockedBySecurityPosture(t *testing.T) {+ handler, monitor := newDockerAgentHandlers(t, &config.Config{DataPath: t.TempDir()})+ hostID := seedDockerHost(t, monitor)++ if _, err := monitor.ApplyDockerReport(agentsdocker.Report{+ Agent: agentsdocker.AgentInfo{+ ID: "agent-1",+ Version: "1.0.0",+ IntervalSeconds: 30,+ },+ Host: agentsdocker.HostInfo{+ Hostname: "docker-host",+ Security: &agentsdocker.HostSecurityInfo{+ AuthorizationPlugins: []string{"opa"},+ },+ },+ Timestamp: time.Now().UTC(),+ }, nil); err != nil {+ t.Fatalf("ApplyDockerReport (with security): %v", err)+ }++ reqBody := map[string]string{+ "agentId": hostID,+ "containerId": "container-1",+ "containerName": "nginx",+ }+ body, _ := json.Marshal(reqBody)+ req := httptest.NewRequest(http.MethodPost, "/api/agents/docker/containers/container-1/update", bytes.NewReader(body))+ rec := httptest.NewRecorder()++ handler.HandleContainerUpdate(rec, req)+ if rec.Code != http.StatusBadRequest {+ t.Fatalf("status = %d, want 400: %s", rec.Code, rec.Body.String())+ }+ if !strings.Contains(rec.Body.String(), "authorization plugins") {+ t.Fatalf("expected authorization plugin block reason, got %s", rec.Body.String())+ }+}+func TestDockerAgentHandlers_HandleCheckUpdates(t *testing.T) {handler, monitor := newDockerAgentHandlers(t, nil)hostID := seedDockerHost(t, monitor)@@ -396,3 +435,51 @@ func TestDockerAgentHandlers_HandleUpdateAll_Disabled(t *testing.T) {t.Fatalf("status = %d, want 403", rec.Code)}}++func TestDockerAgentHandlers_HandleUpdateAll_BlockedBySecurityPosture(t *testing.T) {+ handler, monitor := newDockerAgentHandlers(t, nil)+ hostID := seedDockerHost(t, monitor)++ _, err := monitor.ApplyDockerReport(agentsdocker.Report{+ Agent: agentsdocker.AgentInfo{+ ID: "agent-1",+ Version: "1.0.0",+ IntervalSeconds: 30,+ },+ Host: agentsdocker.HostInfo{+ Hostname: "docker-host",+ Security: &agentsdocker.HostSecurityInfo{+ AuthorizationPlugins: []string{"opa"},+ },+ },+ Containers: []agentsdocker.Container{{+ ID: "container-1",+ Name: "nginx",+ Image: "nginx:latest",+ CreatedAt: time.Now().UTC(),+ State: "running",+ Status: "Up",+ UpdateStatus: &agentsdocker.UpdateStatus{+ UpdateAvailable: true,+ CurrentDigest: "sha256:old",+ LatestDigest: "sha256:new",+ LastChecked: time.Now().UTC(),+ },+ }},+ Timestamp: time.Now().UTC(),+ }, nil)+ if err != nil {+ t.Fatalf("ApplyDockerReport (with containers and security): %v", err)+ }++ req := httptest.NewRequest(http.MethodPost, "/api/agents/docker/runtimes/"+hostID+"/update-all", nil)+ rec := httptest.NewRecorder()++ handler.HandleUpdateAll(rec, req)+ if rec.Code != http.StatusBadRequest {+ t.Fatalf("status = %d, want 400: %s", rec.Code, rec.Body.String())+ }+ if !strings.Contains(rec.Body.String(), "authorization plugins") {+ t.Fatalf("expected authorization plugin block reason, got %s", rec.Body.String())+ }+}diff --git a/internal/dockeragent/agent_collect_test.go b/internal/dockeragent/agent_collect_test.goindex 706d6fd637..127664fe87 100644--- a/internal/dockeragent/agent_collect_test.go+++ b/internal/dockeragent/agent_collect_test.go@@ -10,9 +10,25 @@ import ("time"containertypes "github.com/docker/docker/api/types/container"+ systemtypes "github.com/docker/docker/api/types/system""github.com/rs/zerolog")+func TestBuildHostSecurityInfoAuthorizationPlugins(t *testing.T) {+ security := buildHostSecurityInfo(systemtypes.Info{+ Plugins: systemtypes.PluginsInfo{+ Authorization: []string{"opa", " audit ", "opa", ""},+ },+ })++ if security == nil {+ t.Fatalf("expected host security info")+ }+ if got := security.AuthorizationPlugins; len(got) != 2 || got[0] != "opa" || got[1] != "audit" {+ t.Fatalf("expected normalized authorization plugins, got %#v", got)+ }+}+func TestCollectContainer(t *testing.T) {logger := zerolog.Nop()diff --git a/internal/dockeragent/agent_report_coverage_test.go b/internal/dockeragent/agent_report_coverage_test.goindex c772ce85d3..578a511d05 100644--- a/internal/dockeragent/agent_report_coverage_test.go+++ b/internal/dockeragent/agent_report_coverage_test.go@@ -154,6 +154,43 @@ func TestBuildReport_CollectContainersForcedAndSwarmInfo(t *testing.T) {}}+func TestBuildReport_ReportsAuthorizationPlugins(t *testing.T) {+ swap(t, &hostmetricsCollect, func(context.Context, []string) (hostmetrics.Snapshot, error) {+ return hostmetrics.Snapshot{}, nil+ })++ agent := &Agent{+ cfg: Config{+ IncludeContainers: false,+ },+ runtime: RuntimeDocker,+ logger: zerolog.Nop(),+ docker: &fakeDockerClient{+ infoFunc: func(context.Context) (systemtypes.Info, error) {+ return systemtypes.Info{+ Name: "docker-host",+ ServerVersion: "24.0.0",+ OperatingSystem: "linux",+ Plugins: systemtypes.PluginsInfo{+ Authorization: []string{"opa", " audit "},+ },+ }, nil+ },+ },+ }++ report, err := agent.buildReport(context.Background())+ if err != nil {+ t.Fatalf("unexpected error: %v", err)+ }+ if report.Host.Security == nil {+ t.Fatalf("expected security posture in report")+ }+ if got := report.Host.Security.AuthorizationPlugins; len(got) != 2 || got[0] != "opa" || got[1] != "audit" {+ t.Fatalf("expected normalized authorization plugins, got %#v", got)+ }+}+func TestBuildReport_HostMetricsError(t *testing.T) {swap(t, &hostmetricsCollect, func(context.Context, []string) (hostmetrics.Snapshot, error) {return hostmetrics.Snapshot{}, errors.New("metrics failed")diff --git a/internal/dockeragent/collect.go b/internal/dockeragent/collect.goindex 319a53eb64..8774e4552e 100644--- a/internal/dockeragent/collect.go+++ b/internal/dockeragent/collect.go@@ -149,6 +149,7 @@ func (a *Agent) buildReport(ctx context.Context) (agentsdocker.Report, error) {Memory: snapshot.Memory,Disks: append([]agentsdocker.Disk(nil), snapshot.Disks...),Network: append([]agentsdocker.NetworkInterface(nil), snapshot.Network...),+ Security: buildHostSecurityInfo(info),},Timestamp: time.Now().UTC(),}@@ -174,6 +175,40 @@ func (a *Agent) buildReport(ctx context.Context) (agentsdocker.Report, error) {return report, nil}+func buildHostSecurityInfo(info systemtypes.Info) *agentsdocker.HostSecurityInfo {+ authzPlugins := normalizedNonEmptyStrings(info.Plugins.Authorization)+ if len(authzPlugins) == 0 {+ return nil+ }+ return &agentsdocker.HostSecurityInfo{+ AuthorizationPlugins: authzPlugins,+ }+}++func normalizedNonEmptyStrings(values []string) []string {+ if len(values) == 0 {+ return nil+ }++ normalized := make([]string, 0, len(values))+ seen := make(map[string]struct{}, len(values))+ for _, value := range values {+ value = strings.TrimSpace(value)+ if value == "" {+ continue+ }+ if _, ok := seen[value]; ok {+ continue+ }+ seen[value] = struct{}{}+ normalized = append(normalized, value)+ }+ if len(normalized) == 0 {+ return nil+ }+ return normalized+}+func (a *Agent) collectContainers(ctx context.Context) ([]agentsdocker.Container, error) {options := containertypes.ListOptions{All: true}if len(a.stateFilters) > 0 {diff --git a/internal/models/converters.go b/internal/models/converters.goindex f65e6caf69..be16b91b69 100644--- a/internal/models/converters.go+++ b/internal/models/converters.go@@ -271,6 +271,14 @@ func (d DockerHost) ToFrontend() DockerHostFrontend {sw := d.Swarm.ToFrontend()h.Swarm = &sw}+ if d.Security != nil {+ security := DockerHostSecurityFrontend{+ AuthorizationPlugins: append([]string(nil), d.Security.AuthorizationPlugins...),+ MutatingCommandsBlocked: d.Security.MutatingCommandsBlocked,+ MutatingCommandsBlockedReason: d.Security.MutatingCommandsBlockedReason,+ }.NormalizeCollections()+ h.Security = &security+ }if len(d.LoadAverage) > 0 {h.LoadAverage = append([]float64(nil), d.LoadAverage...)diff --git a/internal/models/deepcopy.go b/internal/models/deepcopy.goindex bc9776b45c..6fac548bc8 100644--- a/internal/models/deepcopy.go+++ b/internal/models/deepcopy.go@@ -413,6 +413,15 @@ func cloneDockerSwarmInfo(src *DockerSwarmInfo) *DockerSwarmInfo {return &dest}+func cloneDockerHostSecurity(src *DockerHostSecurity) *DockerHostSecurity {+ if src == nil {+ return nil+ }+ dest := *src+ dest.AuthorizationPlugins = append([]string(nil), src.AuthorizationPlugins...)+ return &dest+}+func cloneDockerHostCommandStatus(src *DockerHostCommandStatus) *DockerHostCommandStatus {if src == nil {return nil@@ -435,6 +444,7 @@ func cloneDockerHost(src DockerHost) DockerHost {dest.Services = cloneDockerServices(src.Services)dest.Tasks = cloneDockerTasks(src.Tasks)dest.Swarm = cloneDockerSwarmInfo(src.Swarm)+ dest.Security = cloneDockerHostSecurity(src.Security)dest.Temperature = cloneFloat64Ptr(src.Temperature)dest.TokenLastUsedAt = cloneTimePtr(src.TokenLastUsedAt)dest.Command = cloneDockerHostCommandStatus(src.Command)diff --git a/internal/models/models.go b/internal/models/models.goindex dba6b2cea7..a45e68cfd2 100644--- a/internal/models/models.go+++ b/internal/models/models.go@@ -643,6 +643,7 @@ type DockerHost struct {Services []DockerService `json:"services,omitempty"`Tasks []DockerTask `json:"tasks,omitempty"`Swarm *DockerSwarmInfo `json:"swarm,omitempty"`+ Security *DockerHostSecurity `json:"security,omitempty"`Temperature *float64 `json:"temperature,omitempty"` // Optional host temperature in CelsiusTokenID string `json:"tokenId,omitempty"`TokenName string `json:"tokenName,omitempty"`@@ -688,9 +689,27 @@ func (h DockerHost) NormalizeCollections() DockerHost {if h.Tasks == nil {h.Tasks = []DockerTask{}}+ if h.Security != nil {+ security := h.Security.NormalizeCollections()+ h.Security = &security+ }return h}+// DockerHostSecurity describes security-relevant runtime posture for a Docker host.+type DockerHostSecurity struct {+ AuthorizationPlugins []string `json:"authorizationPlugins,omitempty"`+ MutatingCommandsBlocked bool `json:"mutatingCommandsBlocked,omitempty"`+ MutatingCommandsBlockedReason string `json:"mutatingCommandsBlockedReason,omitempty"`+}++func (s DockerHostSecurity) NormalizeCollections() DockerHostSecurity {+ if s.AuthorizationPlugins == nil {+ s.AuthorizationPlugins = []string{}+ }+ return s+}+// RemovedDockerHost tracks a docker host that was deliberately removed and blocked from reporting.type RemovedDockerHost struct {ID string `json:"id"`diff --git a/internal/models/models_frontend.go b/internal/models/models_frontend.goindex 91c6ca502f..87e0cae4a2 100644--- a/internal/models/models_frontend.go+++ b/internal/models/models_frontend.go@@ -141,40 +141,41 @@ func (c ContainerFrontend) NormalizeCollections() ContainerFrontend {// DockerHostFrontend represents a Docker host with frontend-friendly fieldstype DockerHostFrontend struct {- ID string `json:"id"`- AgentID string `json:"agentId"`- Hostname string `json:"hostname"`- DisplayName string `json:"displayName"`- CustomDisplayName string `json:"customDisplayName,omitempty"`- MachineID string `json:"machineId,omitempty"`- OS string `json:"os,omitempty"`- KernelVersion string `json:"kernelVersion,omitempty"`- Architecture string `json:"architecture,omitempty"`- Runtime string `json:"runtime"`- RuntimeVersion string `json:"runtimeVersion,omitempty"`- DockerVersion string `json:"dockerVersion,omitempty"`- CPUs int `json:"cpus"`- TotalMemoryBytes int64 `json:"totalMemoryBytes"`- UptimeSeconds int64 `json:"uptimeSeconds"`- CPUUsagePercent float64 `json:"cpuUsagePercent"`- LoadAverage []float64 `json:"loadAverage"`- Memory *Memory `json:"memory,omitempty"`- Disks []Disk `json:"disks"`- NetworkInterfaces []HostNetworkInterface `json:"networkInterfaces"`- Status string `json:"status"`- LastSeen int64 `json:"lastSeen"`- IntervalSeconds int `json:"intervalSeconds"`- AgentVersion string `json:"agentVersion,omitempty"`- Containers []DockerContainerFrontend `json:"containers"`- Services []DockerServiceFrontend `json:"services"`- Tasks []DockerTaskFrontend `json:"tasks"`- Swarm *DockerSwarmFrontend `json:"swarm,omitempty"`- TokenID string `json:"tokenId,omitempty"`- TokenName string `json:"tokenName,omitempty"`- TokenHint string `json:"tokenHint,omitempty"`- TokenLastUsedAt *int64 `json:"tokenLastUsedAt,omitempty"`- PendingUninstall bool `json:"pendingUninstall"`- Command *DockerHostCommandFrontend `json:"command,omitempty"`+ ID string `json:"id"`+ AgentID string `json:"agentId"`+ Hostname string `json:"hostname"`+ DisplayName string `json:"displayName"`+ CustomDisplayName string `json:"customDisplayName,omitempty"`+ MachineID string `json:"machineId,omitempty"`+ OS string `json:"os,omitempty"`+ KernelVersion string `json:"kernelVersion,omitempty"`+ Architecture string `json:"architecture,omitempty"`+ Runtime string `json:"runtime"`+ RuntimeVersion string `json:"runtimeVersion,omitempty"`+ DockerVersion string `json:"dockerVersion,omitempty"`+ CPUs int `json:"cpus"`+ TotalMemoryBytes int64 `json:"totalMemoryBytes"`+ UptimeSeconds int64 `json:"uptimeSeconds"`+ CPUUsagePercent float64 `json:"cpuUsagePercent"`+ LoadAverage []float64 `json:"loadAverage"`+ Memory *Memory `json:"memory,omitempty"`+ Disks []Disk `json:"disks"`+ NetworkInterfaces []HostNetworkInterface `json:"networkInterfaces"`+ Status string `json:"status"`+ LastSeen int64 `json:"lastSeen"`+ IntervalSeconds int `json:"intervalSeconds"`+ AgentVersion string `json:"agentVersion,omitempty"`+ Containers []DockerContainerFrontend `json:"containers"`+ Services []DockerServiceFrontend `json:"services"`+ Tasks []DockerTaskFrontend `json:"tasks"`+ Swarm *DockerSwarmFrontend `json:"swarm,omitempty"`+ Security *DockerHostSecurityFrontend `json:"security,omitempty"`+ TokenID string `json:"tokenId,omitempty"`+ TokenName string `json:"tokenName,omitempty"`+ TokenHint string `json:"tokenHint,omitempty"`+ TokenLastUsedAt *int64 `json:"tokenLastUsedAt,omitempty"`+ PendingUninstall bool `json:"pendingUninstall"`+ Command *DockerHostCommandFrontend `json:"command,omitempty"`}func (h DockerHostFrontend) NormalizeCollections() DockerHostFrontend {@@ -202,9 +203,27 @@ func (h DockerHostFrontend) NormalizeCollections() DockerHostFrontend {for i := range h.Services {h.Services[i] = h.Services[i].NormalizeCollections()}+ if h.Security != nil {+ security := h.Security.NormalizeCollections()+ h.Security = &security+ }return h}+// DockerHostSecurityFrontend exposes docker-host security posture to the UI.+type DockerHostSecurityFrontend struct {+ AuthorizationPlugins []string `json:"authorizationPlugins"`+ MutatingCommandsBlocked bool `json:"mutatingCommandsBlocked,omitempty"`+ MutatingCommandsBlockedReason string `json:"mutatingCommandsBlockedReason,omitempty"`+}++func (s DockerHostSecurityFrontend) NormalizeCollections() DockerHostSecurityFrontend {+ if s.AuthorizationPlugins == nil {+ s.AuthorizationPlugins = []string{}+ }+ return s+}+// ConnectedInfrastructureSurfaceFrontend describes one reporting surface that// Pulse associates with an infrastructure item in the connected-infrastructure// settings view.diff --git a/internal/monitoring/canonical_guardrails_test.go b/internal/monitoring/canonical_guardrails_test.goindex 2f8b7ef034..78cab83b95 100644--- a/internal/monitoring/canonical_guardrails_test.go+++ b/internal/monitoring/canonical_guardrails_test.go@@ -228,6 +228,47 @@ func TestProxmoxGuestMemoryFallbackUsesInstanceScopedCachesAndAgentMeminfo(t *te}}+func TestDockerMutatingCommandsRespectCanonicalSecurityPosture(t *testing.T) {+ monitor := newTestMonitorForCommands(t)+ host := models.DockerHost{+ ID: "docker-secure-host",+ Hostname: "docker-secure-host",+ Status: "online",+ Containers: []models.DockerContainer{+ {+ ID: "container-a",+ Name: "container-a",+ UpdateStatus: &models.DockerContainerUpdateStatus{+ UpdateAvailable: true,+ LastChecked: time.Now().UTC(),+ },+ },+ },+ Security: &models.DockerHostSecurity{+ AuthorizationPlugins: []string{"opa"},+ MutatingCommandsBlocked: true,+ MutatingCommandsBlockedReason: "blocked for test",+ },+ }+ monitor.state.UpsertDockerHost(host)++ if _, err := monitor.QueueDockerContainerUpdateCommand(host.ID, "container-a", "container-a"); err == nil || !strings.Contains(err.Error(), "blocked for test") {+ t.Fatalf("expected container update to be blocked by canonical security posture, got %v", err)+ }++ if _, err := monitor.QueueDockerUpdateAllCommand(host.ID); err == nil || !strings.Contains(err.Error(), "blocked for test") {+ t.Fatalf("expected update-all to be blocked by canonical security posture, got %v", err)+ }++ status, err := monitor.QueueDockerCheckUpdatesCommand(host.ID)+ if err != nil {+ t.Fatalf("expected check-updates to remain allowed, got %v", err)+ }+ if status.Type != DockerCommandTypeCheckUpdates {+ t.Fatalf("expected check-updates command, got %q", status.Type)+ }+}+func TestProxmoxGuestMemoryCarryForwardUsesCanonicalSnapshotStability(t *testing.T) {requiredSnippets := map[string][]string{"guest_memory_stability.go": {diff --git a/internal/monitoring/docker_commands.go b/internal/monitoring/docker_commands.goindex d9da5c8c12..87f10fb8a2 100644--- a/internal/monitoring/docker_commands.go+++ b/internal/monitoring/docker_commands.go@@ -183,6 +183,9 @@ func (m *Monitor) QueueDockerContainerUpdateCommand(hostID, containerID, containreturn models.DockerHostCommandStatus{}, fmt.Errorf("docker host %q not found", hostID)}hostID = canonicalHostID+ if err := m.ensureDockerMutatingCommandsAllowedLocked(hostID); err != nil {+ return models.DockerHostCommandStatus{}, err+ }// Check for existing commands in progress for this hostif existing, ok := m.dockerCommands[hostID]; ok {@@ -238,6 +241,9 @@ func (m *Monitor) QueueDockerUpdateAllCommand(hostID string) (models.DockerHostCreturn models.DockerHostCommandStatus{}, fmt.Errorf("docker host %q not found", hostID)}hostID = canonicalHostID+ if err := m.ensureDockerMutatingCommandsAllowedLocked(hostID); err != nil {+ return models.DockerHostCommandStatus{}, err+ }// Check for existing commands in progress for this hostif existing, ok := m.dockerCommands[hostID]; ok {@@ -539,3 +545,19 @@ func (m *Monitor) stateDockerHostByIDLocked(hostID string) (models.DockerHost, b}return models.DockerHost{}, false}++func (m *Monitor) ensureDockerMutatingCommandsAllowedLocked(hostID string) error {+ host, found := m.stateDockerHostByIDLocked(hostID)+ if !found {+ return fmt.Errorf("docker host %q not found", hostID)+ }+ if host.Security == nil || !host.Security.MutatingCommandsBlocked {+ return nil+ }++ reason := strings.TrimSpace(host.Security.MutatingCommandsBlockedReason)+ if reason == "" {+ reason = "Docker daemon-mutating commands are disabled for this host."+ }+ return fmt.Errorf("%s", reason)+}diff --git a/internal/monitoring/docker_commands_test.go b/internal/monitoring/docker_commands_test.goindex 3072f4eb20..320f74cb0a 100644--- a/internal/monitoring/docker_commands_test.go+++ b/internal/monitoring/docker_commands_test.go@@ -1230,6 +1230,31 @@ func TestQueueDockerContainerUpdateCommand(t *testing.T) {}}+func TestQueueDockerContainerUpdateCommand_BlockedBySecurityPosture(t *testing.T) {+ t.Parallel()++ monitor := newTestMonitorForCommands(t)+ host := models.DockerHost{+ ID: "host-secure-update",+ Hostname: "node-secure-update",+ Status: "online",+ Security: &models.DockerHostSecurity{+ AuthorizationPlugins: []string{"opa"},+ MutatingCommandsBlocked: true,+ MutatingCommandsBlockedReason: "blocked for test",+ },+ }+ monitor.state.UpsertDockerHost(host)++ _, err := monitor.QueueDockerContainerUpdateCommand(host.ID, "container-1", "nginx")+ if err == nil {+ t.Fatalf("expected security posture to block mutating command")+ }+ if !strings.Contains(err.Error(), "blocked for test") {+ t.Fatalf("expected block reason in error, got %v", err)+ }+}+func TestQueueDockerCheckUpdatesCommand(t *testing.T) {t.Parallel()@@ -1360,6 +1385,59 @@ func TestQueueDockerUpdateAllCommand(t *testing.T) {})}+func TestQueueDockerUpdateAllCommand_BlockedBySecurityPosture(t *testing.T) {+ t.Parallel()++ monitor := newTestMonitorForCommands(t)+ host := models.DockerHost{+ ID: "host-secure-update-all",+ Hostname: "node-secure-update-all",+ Status: "online",+ Containers: []models.DockerContainer{+ {ID: "c1", Name: "app1", UpdateStatus: &models.DockerContainerUpdateStatus{UpdateAvailable: true, LastChecked: time.Now().UTC()}},+ },+ Security: &models.DockerHostSecurity{+ AuthorizationPlugins: []string{"opa"},+ MutatingCommandsBlocked: true,+ MutatingCommandsBlockedReason: "blocked for test",+ },+ }+ monitor.state.UpsertDockerHost(host)++ _, err := monitor.QueueDockerUpdateAllCommand(host.ID)+ if err == nil {+ t.Fatalf("expected security posture to block mutating command")+ }+ if !strings.Contains(err.Error(), "blocked for test") {+ t.Fatalf("expected block reason in error, got %v", err)+ }+}++func TestQueueDockerCheckUpdatesCommand_AllowsSecurityPosture(t *testing.T) {+ t.Parallel()++ monitor := newTestMonitorForCommands(t)+ host := models.DockerHost{+ ID: "host-secure-check-updates",+ Hostname: "node-secure-check-updates",+ Status: "online",+ Security: &models.DockerHostSecurity{+ AuthorizationPlugins: []string{"opa"},+ MutatingCommandsBlocked: true,+ MutatingCommandsBlockedReason: "blocked for test",+ },+ }+ monitor.state.UpsertDockerHost(host)++ status, err := monitor.QueueDockerCheckUpdatesCommand(host.ID)+ if err != nil {+ t.Fatalf("check updates should remain allowed: %v", err)+ }+ if status.Type != DockerCommandTypeCheckUpdates {+ t.Fatalf("expected check updates command, got %q", status.Type)+ }+}+func TestQueueDockerUpdateAllCommand_AcceptsUnifiedHostID(t *testing.T) {t.Parallel()diff --git a/internal/monitoring/monitor_agents.go b/internal/monitoring/monitor_agents.goindex 76508e8a9e..b9a66e2d34 100644--- a/internal/monitoring/monitor_agents.go+++ b/internal/monitoring/monitor_agents.go@@ -1236,6 +1236,7 @@ func (m *Monitor) ApplyDockerReport(report agentsdocker.Report, tokenRecord *conservices := convertDockerServices(report.Services)tasks := convertDockerTasks(report.Tasks)swarmInfo := convertDockerSwarmInfo(report.Host.Swarm)+ security := deriveDockerHostSecurity(report.Host.Security, runtime)loadAverage := make([]float64, 0, len(report.Host.LoadAverage))if len(report.Host.LoadAverage) > 0 {@@ -1339,6 +1340,7 @@ func (m *Monitor) ApplyDockerReport(report agentsdocker.Report, tokenRecord *conServices: services,Tasks: tasks,Swarm: swarmInfo,+ Security: security,IsLegacy: isLegacyAgent(report.Agent.Type),}@@ -1493,6 +1495,54 @@ func (m *Monitor) ApplyDockerReport(report agentsdocker.Report, tokenRecord *conreturn host, nil}+const dockerAuthorizationPluginBlockReasonFormat = "Pulse blocks Docker daemon-mutating commands while Docker authorization plugins are configured (%s) because advisory GO-2026-4887 does not yet provide a fixed Docker Go module line."++func deriveDockerHostSecurity(raw *agentsdocker.HostSecurityInfo, runtime string) *models.DockerHostSecurity {+ authzPlugins := normalizedSecurityStrings(nil)+ if raw != nil {+ authzPlugins = normalizedSecurityStrings(raw.AuthorizationPlugins)+ }+ if len(authzPlugins) == 0 {+ return nil+ }++ security := &models.DockerHostSecurity{+ AuthorizationPlugins: authzPlugins,+ }+ if strings.EqualFold(strings.TrimSpace(runtime), "docker") {+ security.MutatingCommandsBlocked = true+ security.MutatingCommandsBlockedReason = fmt.Sprintf(+ dockerAuthorizationPluginBlockReasonFormat,+ strings.Join(authzPlugins, ", "),+ )+ }+ return security+}++func normalizedSecurityStrings(values []string) []string {+ if len(values) == 0 {+ return nil+ }++ normalized := make([]string, 0, len(values))+ seen := make(map[string]struct{}, len(values))+ for _, value := range values {+ value = strings.TrimSpace(value)+ if value == "" {+ continue+ }+ if _, ok := seen[value]; ok {+ continue+ }+ seen[value] = struct{}{}+ normalized = append(normalized, value)+ }+ if len(normalized) == 0 {+ return nil+ }+ return normalized+}+// ApplyHostReport ingests a host agent report into the shared state.func (m *Monitor) ApplyHostReport(report agentshost.Report, tokenRecord *config.APITokenRecord) (models.Host, error) {hostname := strings.TrimSpace(report.Host.Hostname)diff --git a/internal/monitoring/monitor_docker_test.go b/internal/monitoring/monitor_docker_test.goindex 61b50edc37..7807efc1af 100644--- a/internal/monitoring/monitor_docker_test.go+++ b/internal/monitoring/monitor_docker_test.go@@ -555,6 +555,43 @@ func TestApplyDockerReportPodmanRuntimeMetadata(t *testing.T) {}}+func TestApplyDockerReportDerivesDockerSecurityPosture(t *testing.T) {+ monitor := newTestMonitor(t)++ report := agentsdocker.Report{+ Agent: agentsdocker.AgentInfo{+ ID: "agent-secure",+ Version: "2.0.0",+ IntervalSeconds: 60,+ },+ Host: agentsdocker.HostInfo{+ Hostname: "secure-docker-host",+ Runtime: "docker",+ Security: &agentsdocker.HostSecurityInfo{+ AuthorizationPlugins: []string{"opa", " audit "},+ },+ },+ Timestamp: time.Now().UTC(),+ }++ host, err := monitor.ApplyDockerReport(report, nil)+ if err != nil {+ t.Fatalf("ApplyDockerReport returned error: %v", err)+ }+ if host.Security == nil {+ t.Fatalf("expected host security posture to be populated")+ }+ if !host.Security.MutatingCommandsBlocked {+ t.Fatalf("expected mutating commands to be blocked")+ }+ if got := host.Security.AuthorizationPlugins; len(got) != 2 || got[0] != "opa" || got[1] != "audit" {+ t.Fatalf("expected normalized authorization plugins, got %#v", got)+ }+ if !strings.Contains(host.Security.MutatingCommandsBlockedReason, "GO-2026-4887") {+ t.Fatalf("expected advisory reason, got %q", host.Security.MutatingCommandsBlockedReason)+ }+}+func TestConvertDockerServices(t *testing.T) {t.Parallel()diff --git a/internal/monitoring/monitor_host_agents_test.go b/internal/monitoring/monitor_host_agents_test.goindex 26c8a065fe..287e3ffa60 100644--- a/internal/monitoring/monitor_host_agents_test.go+++ b/internal/monitoring/monitor_host_agents_test.go@@ -1,6 +1,7 @@package monitoringimport (+ "strings""testing""time"@@ -9,6 +10,7 @@ import ("github.com/rcourtman/pulse-go-rewrite/internal/mock""github.com/rcourtman/pulse-go-rewrite/internal/models""github.com/rcourtman/pulse-go-rewrite/internal/storagehealth"+ agentsdocker "github.com/rcourtman/pulse-go-rewrite/pkg/agents/docker"agentshost "github.com/rcourtman/pulse-go-rewrite/pkg/agents/host""github.com/rcourtman/pulse-go-rewrite/pkg/metrics")@@ -264,6 +266,51 @@ func TestApplyHostReportAllowsTokenReuseAcrossHosts(t *testing.T) {}}+func TestApplyDockerReportDerivesCanonicalDockerSecurityPosture(t *testing.T) {+ t.Helper()++ monitor := &Monitor{+ state: models.NewState(),+ alertManager: alerts.NewManager(),+ config: &config.Config{},+ rateTracker: NewRateTracker(),+ dockerMetadataStore: config.NewDockerMetadataStore(t.TempDir(), nil),+ }+ t.Cleanup(func() { monitor.alertManager.Stop() })++ host, err := monitor.ApplyDockerReport(agentsdocker.Report{+ Agent: agentsdocker.AgentInfo{+ ID: "agent-secure",+ Version: "1.0.0",+ IntervalSeconds: 30,+ },+ Host: agentsdocker.HostInfo{+ Hostname: "docker-secure-host",+ Runtime: "docker",+ Security: &agentsdocker.HostSecurityInfo{+ AuthorizationPlugins: []string{"opa", " audit "},+ },+ },+ Timestamp: time.Now().UTC(),+ }, nil)+ if err != nil {+ t.Fatalf("ApplyDockerReport returned error: %v", err)+ }++ if host.Security == nil {+ t.Fatalf("expected security posture on docker host")+ }+ if !host.Security.MutatingCommandsBlocked {+ t.Fatalf("expected mutating commands to be blocked")+ }+ if got := host.Security.AuthorizationPlugins; len(got) != 2 || got[0] != "opa" || got[1] != "audit" {+ t.Fatalf("expected normalized authorization plugins, got %#v", got)+ }+ if !strings.Contains(host.Security.MutatingCommandsBlockedReason, "GO-2026-4887") {+ t.Fatalf("expected advisory reason, got %q", host.Security.MutatingCommandsBlockedReason)+ }+}+func TestHostReportMatchesKnownIdentityUsesPersistedContinuity(t *testing.T) {now := time.Now().UTC()store := config.NewHostContinuityStore(t.TempDir(), nil)diff --git a/pkg/agents/docker/report.go b/pkg/agents/docker/report.goindex d34e2a1277..b884dfd952 100644--- a/pkg/agents/docker/report.go+++ b/pkg/agents/docker/report.go@@ -48,6 +48,12 @@ type HostInfo struct {Memory MemoryMetric `json:"memory,omitempty"`Disks []Disk `json:"disks,omitempty"`Network []NetworkInterface `json:"network,omitempty"`+ Security *HostSecurityInfo `json:"security,omitempty"`+}++// HostSecurityInfo captures container-runtime security posture data reported by the agent.+type HostSecurityInfo struct {+ AuthorizationPlugins []string `json:"authorizationPlugins,omitempty"`}// Container captures the runtime state for a Docker container at report time.