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 Proxmox auto-register TLS fallback
rcourtmanf9fffc8461be
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex a87fad5066..83041e3149 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -642,7 +642,11 @@ first preference. Unified Agent setup must send canonical `candidateHosts`alongside the preferred `host`, and `/api/auto-register` must store the firstcandidate that Pulse can actually reach for fingerprint capture from its ownnetwork view so mixed-DNS and split-network installs do not register a host the-server itself cannot use afterward.+server itself cannot use afterward. That same selection path must only persist+`VerifySSL=true` when Pulse actually captured a certificate fingerprint for the+selected host; if every candidate fingerprint probe fails, registration must+fall back to the preferred normalized host with strict TLS disabled instead of+pretending public-CA verification is now safe for a self-signed Proxmox node.That same canonical behavior also includes one auth transport for Proxmoxcompletion: runtime-side Unified Agent and script callers must send `/api/auto-register`authentication through a one-time setup token in the request-bodydiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 37071b0df7..173b2960a9 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -113,6 +113,7 @@ Own canonical runtime payload shapes between backend and frontend.35. `internal/api/ai_intelligence_handlers.go` shared with `ai-runtime`: AI intelligence handlers are both an AI runtime control surface and a canonical API payload contract boundary.36. `internal/api/config_setup_handlers.go` shared with `agent-lifecycle`: auto-register and setup handlers are both an agent lifecycle control surface and a canonical API payload contract boundary.That same shared boundary also owns reachable-host selection truth for canonical Proxmox registration: runtime callers may propose ordered `candidateHosts`, but the API contract must persist and echo the first candidate Pulse can actually reach instead of freezing the caller's rejected first preference into the stored node endpoint.+ 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.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/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 71762d0f5a..b8f260b973 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -83,6 +83,11 @@ querying, and the operator-facing storage health presentation layer.recovery-adjacent transport flows may not bypass server-side reachable-hostselection or persist the caller's first preferred host when the canonicalauto-register helper has already chosen a different reachable endpoint.+ That same shared dependency also assumes the helper only persists+ `VerifySSL=true` for the selected Proxmox host when Pulse actually captured+ that host's certificate fingerprint, so adjacent setup and recovery-linked+ transport flows do not inherit a false strict-TLS claim for self-signed+ nodes that never completed fingerprint capture.15. Preserve the governed root-or-sudo Unix wrapper in shared backend install-command helpers so storage- and recovery-adjacent transport surfaces do not inherit a stale raw `| bash -s --` install payload shape from the canonical agent-install-command API and hosted Proxmox install responses.16. Preserve optional-auth tokenless behavior in those same shared backend install-command helpers so adjacent transport surfaces do not implicitly persist API tokens and flip auth-configured state when an operator only requested a Proxmox install command on a token-optional Pulse instance.17. Preserve backend-owned Pulse Mobile relay runtime credential minting in those same shared `internal/api/` auth/security helpers so storage- and recovery-adjacent transport surfaces do not inherit browser-authored wildcard token bundles when they depend on the canonical security helper layer.diff --git a/internal/api/config_handlers_canonical_auto_register_test.go b/internal/api/config_handlers_canonical_auto_register_test.goindex 4ce5918e92..36e6cc1338 100644--- a/internal/api/config_handlers_canonical_auto_register_test.go+++ b/internal/api/config_handlers_canonical_auto_register_test.go@@ -8,6 +8,7 @@ import ("testing""github.com/rcourtman/pulse-go-rewrite/internal/config"+ "github.com/rcourtman/pulse-go-rewrite/pkg/tlsutil")func TestHandleCanonicalAutoRegister_PVE(t *testing.T) {@@ -167,6 +168,127 @@ func TestHandleCanonicalAutoRegister_PVEAcceptsCallerProvidedTokenWithoutCredent}}+func TestHandleCanonicalAutoRegisterSelectsReachableFallbackCandidateHost(t *testing.T) {+ tempDir := t.TempDir()+ t.Setenv("PULSE_DATA_DIR", tempDir)++ cfg := &config.Config{+ DataPath: tempDir,+ ConfigPath: tempDir,+ }+ handler := newTestConfigHandlers(t, cfg)++ reachable := newIPv4TLSServer(t, http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {+ w.WriteHeader(http.StatusOK)+ }))+ defer reachable.Close()++ reqBody := AutoRegisterRequest{+ Type: "pve",+ Host: "https://127.0.0.1:1",+ CandidateHosts: []string{"https://127.0.0.1:1", reachable.URL},+ ServerName: "test-node",+ TokenID: "pulse-monitor@pve!pulse-test-node",+ TokenValue: "created-locally",+ Source: "agent",+ }++ req := httptest.NewRequest(http.MethodPost, "/api/auto-register", nil)+ rec := httptest.NewRecorder()++ handler.handleCanonicalAutoRegister(rec, req, &reqBody, "127.0.0.1")++ if rec.Code != http.StatusOK {+ t.Fatalf("status = %d, want 200: %s", rec.Code, rec.Body.String())+ }++ if len(handler.defaultConfig.PVEInstances) != 1 {+ t.Fatalf("expected 1 PVE instance, got %d", len(handler.defaultConfig.PVEInstances))+ }++ instance := handler.defaultConfig.PVEInstances[0]+ if instance.Host != reachable.URL {+ t.Fatalf("host = %q, want reachable fallback %q", instance.Host, reachable.URL)+ }++ expectedFingerprint, err := tlsutil.FetchFingerprint(reachable.URL)+ if err != nil {+ t.Fatalf("fetch expected fingerprint: %v", err)+ }+ if instance.Fingerprint != expectedFingerprint {+ t.Fatalf("fingerprint = %q, want %q", instance.Fingerprint, expectedFingerprint)+ }+ if !instance.VerifySSL {+ t.Fatal("expected verifySSL to stay enabled when Pulse captured a reachable fingerprint")+ }++ var resp AutoRegisterResponse+ if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {+ t.Fatalf("decode response: %v", err)+ }+ if resp.Host != reachable.URL {+ t.Fatalf("response host = %q, want %q", resp.Host, reachable.URL)+ }+}++func TestHandleCanonicalAutoRegisterDisablesStrictTLSWhenFingerprintCaptureFails(t *testing.T) {+ tempDir := t.TempDir()+ t.Setenv("PULSE_DATA_DIR", tempDir)++ cfg := &config.Config{+ DataPath: tempDir,+ ConfigPath: tempDir,+ }+ handler := newTestConfigHandlers(t, cfg)++ originalFingerprint := fetchTLSFingerprint+ fetchTLSFingerprint = func(string) (string, error) {+ return "", nil+ }+ t.Cleanup(func() {+ fetchTLSFingerprint = originalFingerprint+ })++ reqBody := AutoRegisterRequest{+ Type: "pve",+ Host: "https://pve.local:8006",+ CandidateHosts: []string{"https://pve.local:8006", "https://10.0.0.5:8006"},+ ServerName: "test-node",+ TokenID: "pulse-monitor@pve!pulse-test-node",+ TokenValue: "created-locally",+ Source: "agent",+ }++ req := httptest.NewRequest(http.MethodPost, "/api/auto-register", nil)+ rec := httptest.NewRecorder()++ handler.handleCanonicalAutoRegister(rec, req, &reqBody, "127.0.0.1")++ if rec.Code != http.StatusOK {+ t.Fatalf("status = %d, want 200: %s", rec.Code, rec.Body.String())+ }++ if len(handler.defaultConfig.PVEInstances) != 1 {+ t.Fatalf("expected 1 PVE instance, got %d", len(handler.defaultConfig.PVEInstances))+ }++ expectedHost, err := normalizeNodeHost(reqBody.Host, reqBody.Type)+ if err != nil {+ t.Fatalf("normalize expected host: %v", err)+ }++ instance := handler.defaultConfig.PVEInstances[0]+ if instance.Host != expectedHost {+ t.Fatalf("host = %q, want primary normalized host %q", instance.Host, expectedHost)+ }+ if instance.Fingerprint != "" {+ t.Fatalf("fingerprint = %q, want empty when capture failed", instance.Fingerprint)+ }+ if instance.VerifySSL {+ t.Fatal("expected verifySSL to be disabled when Pulse could not capture any candidate fingerprint")+ }+}+func TestHandleCanonicalAutoRegisterRejectsUnknownSource(t *testing.T) {tempDir := t.TempDir()t.Setenv("PULSE_DATA_DIR", tempDir)diff --git a/internal/api/config_setup_handlers.go b/internal/api/config_setup_handlers.goindex c09be1a316..c8122a2ce9 100644--- a/internal/api/config_setup_handlers.go+++ b/internal/api/config_setup_handlers.go@@ -346,10 +346,10 @@ func normalizeAutoRegisterHostCandidates(nodeType, primary string, alternates []return candidates, nil}-func selectAutoRegisterHost(nodeType, primary string, alternates []string) (string, string, []string, error) {+func selectAutoRegisterHost(nodeType, primary string, alternates []string) (string, string, bool, []string, error) {candidates, err := normalizeAutoRegisterHostCandidates(nodeType, primary, alternates)if err != nil {- return "", "", nil, err+ return "", "", false, nil, err}for idx, candidate := range candidates {@@ -369,10 +369,10 @@ func selectAutoRegisterHost(nodeType, primary string, alternates []string) (striStr("requestedHost", candidates[0]).Msg("Auto-register switched to fallback host candidate reachable from Pulse")}- return candidate, fingerprint, candidates, nil+ return candidate, fingerprint, true, candidates, nil}- return candidates[0], "", candidates, nil+ return candidates[0], "", false, candidates, nil}func canonicalAutoRegisterMatchMessage(reason string) string {@@ -682,13 +682,12 @@ func (h *ConfigHandlers) handleCanonicalAutoRegister(w http.ResponseWriter, r *hreq.ServerName = serverNamereq.Source = registrationSource- host, fingerprint, candidateHosts, err := selectAutoRegisterHost(req.Type, req.Host, req.CandidateHosts)+ host, fingerprint, verifySSL, candidateHosts, err := selectAutoRegisterHost(req.Type, req.Host, req.CandidateHosts)if err != nil {http.Error(w, err.Error(), http.StatusBadRequest)return}- verifySSL := truelog.Info().Str("requestedHost", req.Host).Str("selectedHost", host).