Repository navigation
Replies: 4 comments 2 replies
|
Yep, that's a topic for a long discussion ;D |
|
I've had first thought on this matter. |
|
@mwriter The cost you're pointing at is real. The expensive part isn't holding an entry... it's re-checking it. With tens of thousands of bans the daemon spends most of its idle time re-reading the kernel set and comparing it to what it expects. So a list that's loaded once and left alone is the right shape, and The part I'd push back on is "no further checks" meaning never looking again. If fail2zig stops looking it can't tell you the list is still enforced. An I was thinking we check cheaply instead of not at all. The kernel can answer for a handful of specific entries in one message without walking the set, and it broadcasts an event when a table or set gets flushed or deleted. So fail2zig keeps a hash of what it loaded, spot-checks a few entries on a slow schedule, listens for deletions, and if either says something changed it reloads the whole block in one shot and says so. At idle that's close to free even at millions of entries. Two things we should probably keep separate. A permanent ban from detection still needs its record so On IPv6... a list there is ranges, not addresses, and kernel sets hold intervals natively, so a list of /64s or /48s stays small. Merging overlapping ranges before loading would be on us. Questions for you:
No timing promise yet, but this is high on the list. |
|
@mwriter Fair point on reboot... the rules come back with the daemon, so that one's off the list. Flush and other tools rewriting the table stay on it, and those are the two that happen in the field. On workload vs security, I don't think we have to pick. The check is only expensive today because it's a full read of the set every few seconds. We cut that in half this week and the next step is to stop polling altogether and let the kernel tell us when something changes... it sends an event on every flush and delete, which costs nothing while nothing happens. Once that's in, a permanent jail gets what you're after, no periodic work, and we still know the moment something touches the rules. So I'd rather make the check free for every jail than add a mode that turns it off. On your other three: agreed, lists stay grouped by jail like everything else. Files you manage come first, and URLs can come later. And yes, whether hits get recorded is its own per-jail setting, same as the rest. Let's keep this post open as the design record, and I'll post here when there's something to try. |
Uh oh!
There was an error while loading. Please reload this page.
This came up in #117: what happens if a ban list holds millions of addresses? It deserves its own design discussion, so here it is. @mwriter, it started with your question, so your input would be especially valuable.
Why not through bans
Every ban in fail2zig is tracked individually: a durable record, who owns it, and a check against the kernel every few seconds, so fail2zig can always tell you exactly what's enforced and why. That's what makes bans trustworthy, and it's also why they have a ceiling (65,536 across the daemon). Pushing millions of addresses through that machinery would cost gigabytes of state and constant verification work, and could bring a small box to its knees.
What we're researching: a native blocklist loader
The kernel itself handles very large lists well, as long as they're loaded as a block rather than one ban at a time. The idea is to build that into fail2zig:
statusshows each list with its source, entry count and last refreshWe think this would be a great fit for fail2zig: one tool for both detection-driven bans and large curated lists.
What would help us shape it
This is research, not a release commitment yet. We'll post here as the design firms up.
All reactions