From d4205fb8f849f34f107226c212aadb3e060ced44 Mon Sep 17 00:00:00 2001 From: Admin MPCZ Date: Tue, 28 Apr 2026 01:14:03 +0200 Subject: [PATCH] fix(qualys/agents): retry avec reconnect SSH si Timeout opening channel (limite channels PSMP) --- app/services/realtime_audit_service.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/services/realtime_audit_service.py b/app/services/realtime_audit_service.py index 4a248b1..7be0db9 100644 --- a/app/services/realtime_audit_service.py +++ b/app/services/realtime_audit_service.py @@ -932,7 +932,18 @@ def audit_qualys_agent_only(hostname): try: for key, cmd in QUALYS_AGENT_CMDS.items(): - result[key] = _run(client, cmd) or "(empty)" + out = _run(client, cmd) + # Retry avec reconnect si Timeout opening channel (limite PSMP) + if out and ("timeout opening channel" in out.lower() or + "channel closed" in out.lower()): + try: + client.close() + except Exception: + pass + client = _connect(target, hostname) + if client: + out = _run(client, cmd) + result[key] = out or "(empty)" result["status"] = "OK" except Exception as e: result["status"] = "ERROR"