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.

Keep lazy Proxmox session construction serial during pin capture

pulse-triage[bot]ddc86c42934d
diff --git a/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md b/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md
index cb0217a281..cb94e54643 100644
--- a/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md
+++ b/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md
@@ -1300,3 +1300,5 @@ as verification progresses:
- `TestClusterFirstUseSessionRefusalKeepsTrust`, `TestClusterPasswordEstablishedPinsAreNotFirstUse`, `TestClusterFirstUsePasswordCaptureCancellation`: rejected/malformed login does not become healthy or replay; primary/saved pins and ending callers cannot gain first-use authority.
- `TestClusterFirstUsePasswordEndpointProjection`: real first-use password construction, failed retained session and separate normal public-read recovery feed the existing cluster-member consuming surface; native Online and saved identities/trust stay unchanged.
- Exact-source race/vet/build and desktop/narrow consuming pixels are source qualification, not installed/native acceptance or release availability.
+
+`TestClusterFirstUseConcurrentSelectionSharesConstruction` holds a real first-use TLS capture while eight ordinary readers join: one captured pin, one short/full login pair, independent returned readings and usable concurrent health inspection.
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index 863ef858ce..7ae9c78a0b 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -34,7 +34,8 @@ CA/redirect policy, login encodings, cadence and guest/backup fences do not chan
`TestClusterFirstUseSessionAdmission` covers JSON password, existing form
fallback and token modes in all three phases, then ordinary member reads.
The adjacent refusal, established-pin and cancellation controls exercise actual
-TLS sockets. `TestClusterFirstUsePasswordEndpointProjection` carries first-use
+TLS sockets. Concurrent lazy selection retains serialized construction while
+health/trust inspection stays usable during capture. `TestClusterFirstUsePasswordEndpointProjection` carries first-use
probe/full-session refusal and later public-read recovery into the monitor's
cluster-member projection without changing native Online state, identity or
saved fingerprints. This is source/consumer qualification, not installed
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index 9715f43a8d..76dfda7013 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -35,7 +35,8 @@ CA/redirect policy, login encodings, cadence and guest/backup fences do not chan
`TestClusterFirstUseSessionAdmission` covers JSON password, existing form
fallback and token modes in all three phases, then ordinary member reads.
The adjacent refusal, established-pin and cancellation controls exercise actual
-TLS sockets. `TestClusterFirstUsePasswordEndpointProjection` carries first-use
+TLS sockets. Concurrent lazy selection retains serialized construction while
+health/trust inspection stays usable during capture. `TestClusterFirstUsePasswordEndpointProjection` carries first-use
probe/full-session refusal and later public-read recovery into the monitor's
cluster-member projection without changing native Online state, identity or
saved fingerprints. This is source/consumer qualification, not installed
diff --git a/pkg/proxmox/cluster_client.go b/pkg/proxmox/cluster_client.go
index 4b3b2c5c1a..2e18538460 100644
--- a/pkg/proxmox/cluster_client.go
+++ b/pkg/proxmox/cluster_client.go
@@ -21,6 +21,7 @@ import (
// ClusterClient wraps multiple Proxmox clients for cluster-aware operations
type ClusterClient struct {
mu sync.RWMutex
+ clientInitMu sync.Mutex // Serialize lazy construction while a trust probe releases mu.
name string
clients map[string]*Client // Key is node name
endpoints []string // All available endpoints
@@ -680,6 +681,19 @@ func (cc *ClusterClient) getHealthyClient(ctx context.Context) (*Client, error)
// Get or create client for this endpoint
client, exists := cc.clients[selectedEndpoint]
if !exists {
+ // Selection previously serialized construction under mu. Keep that
+ // property without holding the trust/health mutex during capture:
+ // concurrent first readers must not create a password-login storm.
+ cc.mu.Unlock()
+ cc.clientInitMu.Lock()
+ cc.mu.Lock()
+ defer cc.clientInitMu.Unlock()
+ if err := ctx.Err(); err != nil {
+ return nil, err
+ }
+ if accepted := cc.clients[selectedEndpoint]; accepted != nil {
+ return accepted, nil
+ }
// Create new client with shorter timeout for initial test
cfg := cc.config
cfg.Host = selectedEndpoint
diff --git a/pkg/proxmox/cluster_client_first_use_session_test.go b/pkg/proxmox/cluster_client_first_use_session_test.go
index 2712141cf3..2421361d80 100644
--- a/pkg/proxmox/cluster_client_first_use_session_test.go
+++ b/pkg/proxmox/cluster_client_first_use_session_test.go
@@ -297,3 +297,42 @@ func TestClusterFirstUsePasswordCaptureCancellation(t *testing.T) {
t.Fatal("cancelled capture installed trust, changed failure or sent authentication")
}
}
+
+func TestClusterFirstUseConcurrentSelectionSharesConstruction(t *testing.T) {
+ f := newFirstUseSessionFixture(t, false, false)
+ f.gateAt.Store(2)
+ cfg := firstUseSessionConfig("https://primary.session.invalid", clusterTrustPin(clusterTrustCertificate(t)), false)
+ cc := NewClusterClient("joined-first-use", cfg, []string{f.server.URL}, nil)
+ closeFirstUseClusterClients(t, cc)
+ done := make(chan error, 8)
+ read := func() {
+ nodes, err := cc.GetNodes(context.Background())
+ if err == nil && (len(nodes) != 1 || nodes[0].CPU != 0.25) {
+ err = fmt.Errorf("lost ordinary member reading")
+ }
+ done <- err
+ }
+ go read()
+ select {
+ case <-f.entered:
+ case <-time.After(5 * time.Second):
+ close(f.resume)
+ <-done
+ t.Fatal("first selection did not reach capture")
+ }
+ for i := 0; i < 7; i++ {
+ go read()
+ }
+ // Health inspection remains usable while the credential-free capture is
+ // held. Closing this synthetic handshake does not cancel any native work.
+ _ = cc.GetHealthStatusWithErrors()
+ close(f.resume)
+ for i := 0; i < 8; i++ {
+ if err := <-done; err != nil {
+ t.Error(err)
+ }
+ }
+ if f.logins.Load() != 2 || f.nodes.Load() != 9 || f.handshakes.Load() != 4 {
+ t.Fatalf("concurrent selection duplicated capture/login: logins=%d nodes=%d handshakes=%d", f.logins.Load(), f.nodes.Load(), f.handshakes.Load())
+ }
+}