ipfence home page local-first intrusion prevention for Linux

Manual pages

IPv6 and lockout

Never banned automatically

Addresses Why
127.0.0.0/8, ::1 loopback; also excluded in the rules themselves
this host's own addresses rechecked at every reconciliation
[allow] addresses and ipfence allow entries yours
[proxy] trusted banning a proxy cuts off everyone behind it
private (10/8, 172.16/12, 192.168/16, fc00::/7) and link-local (169.254/16, fe80::/10) your LAN, VPN and containers; opt in with auto_ban_private
unspecified, multicast, broadcast not a source worth banning

100.64.0.0/10 (carrier-grade NAT, also Tailscale) can be banned.

Skipped events are visible in status as ignored.<reason> counters.

Your own access

ipfence cannot know which connection is yours. A boot-time daemon cannot infer "the administrator's session", and does not try.

  • ipfence init, run from SSH, allowlists the client address of that session, exactly, and says so. Because sudo clears SSH_CONNECTION, it also reads parent processes, and only trusts the value if that connection is open now (an old tmux session would otherwise offer a stale address).
  • It writes the entry only into a new config file. If one exists, it prints the ipfence allow command instead.
  • Or choose explicitly: ipfence init --ssh-client 203.0.113.5, or ipfence allow 203.0.113.5.
  • An address is never widened to a subnet for you.
  • ban refuses a range containing your current SSH client unless forced.

If your address changes (mobile, home broadband), the entry no longer protects you. Keep a console path: a provider's serial console, physical access or an out-of-band network.

Getting back in

  1. sudo ipfence unban <address> (works with the daemon stopped)
  2. sudo ipfence allow <address>
  3. sudo ipfence disable --yes
  4. sudo systemctl stop ipfence && sudo nft delete table inet ipfence

A first ban lasts 15 minutes and expires in the kernel even if everything else fails. Permanent bans exist only if you create them or opt in with permanent_after.

IPv6

By default a ban covers one address (/128). Privacy extensions let a client change addresses often, so an attacker with a prefix can evade single-address bans. That is a known limit.

Prefix escalation is off by default:

Settings file (TOML)

[ipv6]
prefix_escalation = true
prefix = 64          # you must choose, 48 to 127
threshold = 5        # distinct addresses in that prefix that must be banned first
window = "24h"

When enabled, after threshold addresses within one prefix are banned, the prefix is banned for the usual escalating duration. It is shown with origin escalation, skipped if the prefix contains any allowlisted, local or trusted address, and never permanent. Remove it at once with ipfence unban 2001:db8:1:2::/64.

A prefix ban can block unrelated people and devices. A /64 is not reliably one person or one subscriber: providers delegate prefixes of different sizes, and many users can share one network.

A manual ban of a link-local range can break neighbour discovery with the affected neighbours.