minsec minsec

Firewall and backends

What minsec creates

The nft backend owns table inet minsec and touches nothing outside it:

ObjectContents
set ban4 / ban6local bans of one IPv4 address or one IPv6 network (a /64 by default), each element with its own timeout
set bannet4 / bannet6manual bans of wider networks, such as minsec ban 203.0.113.0/24
set allow4 / allow6the effective allowlist
set crowd4 / crowd6, crowdnet4 / crowdnet6the crowd blocklist, if enabled: single addresses and /64s, then wider prefixes
chain input, forwardhooks at priority -10

Priority -10 puts the chains ahead of firewalld and iptables-nft without modifying existing rules, so minsec composes with an existing firewall instead of fighting it. Allow entries are matched before bans; crowd entries are enforced after your allowlist and your local bans.

Single addresses and /64s, which are nearly all bans, live in hash sets. Only wider prefixes use nftables interval sets, because interval sets with timeouts have corrupted on older kernels, including EL8's, turning one banned address into a range covering a large part of the internet.

sudo nft list table inet minsec
sudo nft list set inet minsec ban4

Why bans live in the kernel

Each set element has an nftables timeout. That has three consequences worth knowing:

  • Bans expire on their own, with no daemon involvement.
  • Bans survive a restart of the daemon without a minsec-managed list.
  • minsec list queries the kernel. There are no intermediate data sources.

Other backends

[defaults]
backend = "nft"     # nft | null | exec

null runs the full engine and logs what it would ban. To try a configuration on a production server:

sudo minsec daemon --backend null

exec runs a script for each action, for platforms nftables does not cover:

<cmd> ban <net> <ttl>
<cmd> unban <net>

The exec backend cannot enumerate bans, so minsec list answers from the daemon's in-memory mirror and only covers bans issued since it started. ipset and pf backends are on the roadmap.

IPv6

IPv6 is tracked and banned per /64 by default (ipv6_prefix = 64), because an attacker with a /64 has effectively unlimited single addresses. Reports to the crowd are aggregated the same way.

Interaction with firewalld

None required. minsec's chains run first at priority -10; firewalld's rules are untouched and still apply to everything minsec does not drop. You do not need to add a firewalld service, zone, or direct rule.