A decision created moments before an audit shows up as missing=1 until
the bouncer's next poll, which triggered a bouncer restart for nothing.
When the audit finds a membership mismatch, wait membership_recheck_delay
seconds (default 30, 0 disables) and audit again; only drift that is still
present is reported and healed. Metadata drift is not delayed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
- add tail-based HEAL line lookup to avoid O(file-size) reads in should_heal()
- keep a safe fallback full scan when no HEAL marker is found in tail window
- add regression test for large history files with recent HEAL marker
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.