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
Scope cluster TLS fingerprints to their own endpoints (#1199)
rcourtmana64815371781
diff --git a/internal/monitoring/monitor_additional_test.go b/internal/monitoring/monitor_additional_test.goindex 0bc63c2fd2..79824b2f83 100644--- a/internal/monitoring/monitor_additional_test.go+++ b/internal/monitoring/monitor_additional_test.go@@ -272,6 +272,20 @@ func TestClusterEndpointEffectiveURL(t *testing.T) {t.Fatalf("override IP preference = %q, want %q", got, "https://192.168.1.10:8006")}+ // #1199: a cluster-level fingerprint (passed as hasFingerprint=true) must NOT+ // force IP routing for a member endpoint that has no per-endpoint fingerprint;+ // hostname routing must be preserved so TLS validation still works.+ endpoint = config.ClusterEndpoint{Host: "node.local", IP: "10.0.0.1"}+ if got := clusterEndpointEffectiveURL(endpoint, true, true); got != "https://node.local:8006" {+ t.Fatalf("cluster-level fingerprint must not force IP routing for a fingerprint-less endpoint, got %q", got)+ }++ // A per-endpoint fingerprint still allows IP routing under verifySSL.+ endpoint.Fingerprint = "endpoint-fp"+ if got := clusterEndpointEffectiveURL(endpoint, true, false); got != "https://10.0.0.1:8006" {+ t.Fatalf("per-endpoint fingerprint should allow IP routing, got %q", got)+ }+endpoint = config.ClusterEndpoint{}if got := clusterEndpointEffectiveURL(endpoint, true, false); got != "" {t.Fatalf("empty endpoint = %q, want empty", got)diff --git a/internal/monitoring/monitor_cluster_helpers.go b/internal/monitoring/monitor_cluster_helpers.goindex be3478d7b8..a98cc486f3 100644--- a/internal/monitoring/monitor_cluster_helpers.go+++ b/internal/monitoring/monitor_cluster_helpers.go@@ -107,12 +107,15 @@ func ensureClusterEndpointURL(raw string) string {return "https://" + net.JoinHostPort(value, "8006")}-func clusterEndpointEffectiveURL(endpoint config.ClusterEndpoint, verifySSL bool, hasFingerprint bool) string {- // When TLS hostname verification is required (VerifySSL=true and no fingerprint),- // prefer hostname over IP to ensure certificate CN/SAN validation works correctly.- // When TLS is not verified (VerifySSL=false) or a fingerprint is provided (which- // bypasses hostname checks), prefer IP to reduce DNS lookups (refs #620).- requiresHostnameForTLS := verifySSL && !hasFingerprint+func clusterEndpointEffectiveURL(endpoint config.ClusterEndpoint, verifySSL bool, _ bool) string {+ // A fingerprint only applies to the specific endpoint it was captured from.+ // The primary node's (cluster-level) fingerprint must not be treated as valid+ // for every cluster member, otherwise we route to per-node IPs while pinning+ // the wrong certificate. So derive this strictly from the endpoint's own+ // fingerprint and ignore any cluster-level value the caller passed. Refs: #1199+ // (and #620 for why a fingerprint lets us prefer IP to reduce DNS lookups).+ hasEndpointFingerprint := strings.TrimSpace(endpoint.Fingerprint) != ""+ requiresHostnameForTLS := verifySSL && !hasEndpointFingerprint// Use EffectiveIP() which prefers user-specified IPOverride over auto-discovered IPeffectiveIP := endpoint.EffectiveIP()