fix(auditor): report range decisions the kernel can't enforce instead of healing #5

Merged
patrick merged 1 commits from fix/unenforceable-range-decisions into main 2026-10-23 13:44:58 +00:00
Owner

Problem

Nodes were stuck in DESYNC_DETECTED with missing=1 extra=1 and the same fingerprint every time. On zephyrus the cause is a cscli RANGE_ESCALATION decision for 195.178.110.0/24. crowdsec-blacklists-cscli has only the timeout flag (no interval), so nft keeps just 195.178.110.0 as a single host. Each heal restarted the bouncer, which inserted the same address again, so the heal never held and the flap guard kept suppressing repeats. The /24 itself is not blocked.

Changes

  • auditor: when a missing LAPI range's network address is in the kernel, match the two up. The range goes into unenforceable_ranges with its own warning and stays out of the missing/extra counts and the fingerprint, so it no longer triggers a heal that can't work. A /32 or /128 stored as a plain address counts as in sync.
  • auditor: Desync: log lines now list missing_values / extra_values (up to 10, then "+N more").
  • reporter: new unenforceable_range_count field. A node that's otherwise in sync reports DEGRADED instead of HEALTHY.
  • main / healing: pass the count through to the state file, including after a heal.

Testing

  • 54 unit tests pass, including new ones for: a range alone, a range alongside real drift, a range whose network address is also banned on its own, /32 and /128 entries, the new log values, and the DEGRADED status.
  • Ran the patched auditor against live zephyrus state. Result: in_sync with unenforceable_ranges=['195.178.110.0/24'].

Notes

  • Anything reading the state file that only expects HEALTHY or DESYNC_DETECTED will need to handle DEGRADED.
  • The /24 is still not blocked. That needs a fix on the enforcement side: individual IP bans, or interval-capable sets.

🤖 Generated with Claude Code

## Problem Nodes were stuck in `DESYNC_DETECTED` with `missing=1 extra=1` and the same fingerprint every time. On zephyrus the cause is a cscli `RANGE_ESCALATION` decision for `195.178.110.0/24`. `crowdsec-blacklists-cscli` has only the `timeout` flag (no `interval`), so nft keeps just `195.178.110.0` as a single host. Each heal restarted the bouncer, which inserted the same address again, so the heal never held and the flap guard kept suppressing repeats. The /24 itself is **not** blocked. ## Changes - **auditor:** when a missing LAPI range's network address is in the kernel, match the two up. The range goes into `unenforceable_ranges` with its own warning and stays out of the missing/extra counts and the fingerprint, so it no longer triggers a heal that can't work. A `/32` or `/128` stored as a plain address counts as in sync. - **auditor:** `Desync:` log lines now list `missing_values` / `extra_values` (up to 10, then "+N more"). - **reporter:** new `unenforceable_range_count` field. A node that's otherwise in sync reports `DEGRADED` instead of `HEALTHY`. - **main / healing:** pass the count through to the state file, including after a heal. ## Testing - 54 unit tests pass, including new ones for: a range alone, a range alongside real drift, a range whose network address is also banned on its own, `/32` and `/128` entries, the new log values, and the `DEGRADED` status. - Ran the patched auditor against live zephyrus state. Result: `in_sync` with `unenforceable_ranges=['195.178.110.0/24']`. ## Notes - Anything reading the state file that only expects `HEALTHY` or `DESYNC_DETECTED` will need to handle `DEGRADED`. - The /24 is still not blocked. That needs a fix on the enforcement side: individual IP bans, or interval-capable sets. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
patrick added 1 commit 2026-10-23 13:44:38 +00:00
fix(auditor): report range decisions the kernel can't enforce instead of healing
CI / Unit tests (push) Successful in 3s
CI / Unit tests (pull_request) Successful in 7s
e76e957282
A LAPI range decision (e.g. 195.178.110.0/24) inserted into an nft set
without the interval flag is stored as its bare network address. The
string diff saw that as one missing and one extra entry, and every heal
re-added the same address, so nodes stuck in DESYNC_DETECTED with the
flap guard suppressing repeat heals.

Pair such ranges with their network address, report them as
unenforceable_ranges with a dedicated warning, and keep them out of the
drift counts and fingerprint. The reporter records
unenforceable_range_count and shows DEGRADED for a node that is
otherwise in sync. Desync log lines now name the missing and extra
values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
patrick merged commit 88d3c57ab0 into main 2026-10-23 13:44:58 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: patrick/threat-engine-agent#5