Commit Graph
24 Commits
Author SHA1 Message Date
patrickandClaude Opus 5.5 8c8be8ec63 fix(auditor): don't heal when the LAPI is unreachable
CI / Unit tests (push) Successful in 4s
CI / Unit tests (pull_request) Successful in 3s
get_remote_lapi_truth() returned {} when 'cscli decisions list' failed, which is
indistinguishable from "no active bans". reconcile() then saw every kernel ban as extra,
reported membership_mismatch, and the heal restarted crowdsec-firewall-bouncer. A LAPI
outage would do that on every node at once, every heal interval.

Raise LapiUnavailableError instead. reconcile() propagates it, so the main loop records
it as last_error and retries in 60s without healing; post-heal verification records it
as verify_error. A genuinely empty decision list still returns {} as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 16:47:48 -04:00
patrickandClaude Opus 5.5 79f72512e4 fix(auditor): use longest kernel expiry for IPs in multiple sets
The bouncer keeps one nft set per decision origin, so an IP with both a
crowdsec ban and a later, longer cscli ban sits in two sets. The kernel
scan kept whichever set it read last, so the short TTL could be compared
against the longest LAPI decision and reported as metadata drift.

Keep the longest expiry per IP instead, and log per-IP evidence (expected
vs kernel seconds, source sets, LAPI decisions) whenever drift is flagged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 19:27:59 -04:00
patrick c698d01c40 feat(auditor): add startup enforcement sanity check and dedupe set-mismatch warnings 2026-03-05 20:32:29 -05:00
patrick 172f5d7ced fix(auditor): fail open when configured enforcement sets do not match nft state 2026-03-05 20:23:00 -05:00
patrick bffe28485d feat(config): enforce runtime nft targets and managed sets from config.yaml 2026-03-05 20:19:31 -05:00
patrick 55cc29071e Add nft handle fallback when flushing CrowdSec sets with slash-based names 2026-02-26 14:14:20 -05:00
patrick 716468901c Harden metadata heal across nft table variants and non-fatal flush errors 2026-02-26 13:37:48 -05:00
patrick aae920fb73 fix: metadata drift false positives - corrected by normalizing nft TTL and skipping unverifiable expiry 2026-02-25 15:02:24 -05:00
patrick 0f7f03f005 Fix metadata-drift healing by flushing CrowdSec nft sets before restart
Add drift-aware heal path in FirewallAuditor to remediate metadata drift by discovering and flushing
  *-cscli sets in crowdsec/crowdsec6 tables, then restarting the bouncer.

Update execute_heal_and_verify to pass drift context to heal_with_drift when supported, keeping
  backward compatibility via heal().

Add unit tests covering metadata-drift flush+restart behavior, non-metadata restart-only behavior,
  and drift context propagation.
2026-02-25 14:59:44 -05:00
patrick 28267a0cf4 fix(auditor): heal on decision-duration drift, not just IP membership/count 2026-02-23 22:20:16 -05:00
patrick 480eea8095 refactor(agent): split orchestration into config, healing, and main modules 2026-02-10 22:11:33 -05:00
patrick 234224a5c6 feat(healing): add post-restart verification and heal outcome telemetry 2026-02-10 21:55:43 -05:00
patrick e342d83a70 fix(reconcile): gate heal flapping by drift fingerprint instead of kernel count 2026-02-10 21:48:50 -05:00
patrick 3d7c1b3f2a fix(auditor): support flat and nested cscli decision JSON parsing 2026-02-10 21:45:37 -05:00
patrick 82352110a4 fix: incorrect decision pulling from CrowdSec locally 2026-01-25 22:49:19 -05:00
patrick 6e98117126 fix: add cscli decision list check for LAPI threat-agent 2026-01-26 03:30:42 +00:00
patrick 42c25c145e fix: finalize merge with agent-node branch 2026-01-26 03:14:46 +00:00
patrick 5990dddf5a Merge branch 'agent-node' 2026-01-26 03:10:21 +00:00
patrick 14c5ac758e feat: add TTL-aware drift detection and stabilize healing 2026-01-25 21:32:02 -05:00
patrick c23f2b7a47 fix: dual-stack ipv6 audit and cleanup unused lapi function 2026-01-23 13:29:23 -05:00
patrick b08e4bec29 feat: implement dual-stack IPv4/IPv6 auditing and updated logs 2026-01-23 13:18:55 -05:00
patrick b48dabed85 fix: remove errant line, not used 2026-01-23 11:20:07 -05:00
patrick 672e821738 feat: implement self-healing auditor with remote LAPI sync 2026-01-23 10:58:35 -05:00
patrick 848a29543d initial commit: Threat Engine Agent 2026-01-22 20:22:00 -05:00