Watch first, then block
It starts in observe mode: it records what it would ban and changes no
firewall rule until you run ipfence enable.
Nginx and Caddy detection stays off until you turn it on and say how visitors reach you. Stopping the program leaves the firewall rules in place.
Build and try it
Use a machine you can still reach another way, such as your provider’s console.
Needs Go 1.27.4 or newer.
Shell commands
git clone https://github.com/nothikemu/ipfence.git
cd ipfence
scripts/build.sh
sudo install -m 0755 dist/ipfence-linux-amd64 /usr/local/bin/ipfence
sudo install -m 0644 systemd/ipfence.service /etc/systemd/system/ipfence.service
sudo systemctl daemon-reload
Then, in order: see what it can protect, start it watching, read what it would ban, and only then start blocking.
Shell commands
sudo ipfence init
sudo systemctl enable --now ipfence
sudo ipfence status
sudo ipfence enable
init never changes the firewall. If you run it from an SSH session it
allowlists that session's exact client address and says so.
Getting started explains each step. After that: everyday tasks.
Locked out? sudo ipfence disable --yes removes every ipfence rule, and there are other ways back in.
What stays on your machine
ipfence's built-in components never send anything off your machine. No
telemetry, crash reports, update checks, accounts, API keys, shared threat feeds,
downloaded databases or remote parsers. Rules, history and logs stay local.
One thing you can add does send data wherever you choose: the optional
hook, a program of yours that runs after a ban.
It is off unless you configure it, and the unit's network block applies to it
until you remove that block.
Privacy and threat model
What it won’t do
- It is not a web application firewall and does not protect against volumetric
denial of service.
- It cannot block a visitor who reaches you through a reverse proxy or CDN: this
host only ever sees the proxy's address.
- It does not treat a bare 401 or 403 as a failed login, and has no generic
"suspicious URL" rules.
- It does not read container logs or detect services running inside containers.
- It cannot promise you will never be locked out. It exempts what it can
verify and gives you ways back in; see
IPv6 and lockout.
This is an early release. It has automated tests and an adversarial review by its
author; it has not had an independent security audit.