From 9580070a50a5fb094036ffea47aeac02b07eab24 Mon Sep 17 00:00:00 2001 From: Debian Date: Tue, 2 Jun 2026 09:09:39 +0200 Subject: [PATCH] =?UTF-8?q?fix(crowdsec):=20cscli-Aufrufe=20nur=20wenn=20A?= =?UTF-8?q?gent=20l=C3=A4uft=20=E2=80=94=20v1.2.64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wenn CrowdSec gestoppt war, hing ServiceStatus auf cscli decisions/alerts/ bouncers/machines (Socket des gestoppten Agents). Der Status-Endpoint antwortete nie → status=undefined im UI → Switch war disabled (rotes Schild). Fix: cscli-Datenabrufe (decisions, alerts, bouncers, machines) nur wenn AgentRunning=true. Version-Abruf via cscli version bleibt (schlägt schnell fehl wenn Agent gestoppt, kein Hang). Co-Authored-By: Claude Sonnet 4.6 --- VERSION | 2 +- internal/crowdsec/service.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 32b12cc..6efdfbb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.63 +1.2.64 diff --git a/internal/crowdsec/service.go b/internal/crowdsec/service.go index fdb59af..805ccfa 100644 --- a/internal/crowdsec/service.go +++ b/internal/crowdsec/service.go @@ -172,8 +172,12 @@ func ServiceStatus(ctx context.Context) Status { st.Version = strings.TrimSpace(scanner.Text()) } } + } - // Best-effort counts — ignore errors (agent may be stopped). + // Only query cscli data endpoints when the agent is running — cscli + // hangs on its local socket when the agent is stopped, which would + // block the entire status response and leave the UI with no data. + if st.AgentRunning { if decisions, err := Decisions(ctx); err == nil { st.DecisionCount = len(decisions) }