Why Can't fail2ban Block Attackers Behind Cloudflare?
Behind Cloudflare, your logs show the real visitor IP but the actual TCP socket is a Cloudflare edge IP. When fail2ban tells iptables to ban the logged address, the ban does nothing — the attacker isn't connecting to you, Cloudflare is. Worse, banning an IP that turns out to be a Cloudflare range firewalls Cloudflare itself and takes every site on the server down.
How Does Swatter Block Attackers Without Firewalling Cloudflare?
It classifies every offender as direct-to-origin or via-Cloudflare — from the logs and from live TCP sockets. Direct attackers are blocked at CSF; proxied attackers get a Cloudflare managed challenge by default via the IP Access Rules API, so a false positive means a human solves a challenge, not a lockout. Cloudflare's own ranges are a hardcoded never-block set checked before every block, and if the range list goes stale Swatter fails closed.
What About Attackers That Bypass Cloudflare and Hit My Origin Directly?
If someone discovers your server's real IP, they can connect straight to :443 with a valid Host header and look exactly like proxied traffic in your logs — and a naive blocker answers with a useless edge challenge while the flood keeps landing. Swatter also inspects the live TCP socket: a peer on your web ports that isn't a Cloudflare edge is provably direct, so it's sent to CSF where the block actually bites — even mid-flood.
Will It Block My Own Customers Logging into WordPress?
Brute-force detection requires failure evidence — error responses or POST floods — not mere visits to sensitive paths. A site owner logging in and working in wp-admin produces successful requests and can't trip it. You can also guarantee specific IPs with swatter allow, and it ships report-only so you review decisions before it acts.
What Does It Require?
A cPanel/Apache server with CSF (AlmaLinux, CentOS, RHEL), gawk, and flock. Optionally jq + curl for threat-intel and the Cloudflare API, and sqlite3 for the state store. Not behind Cloudflare? It works as a straightforward CSF auto-blocker too.
Is It Free?
Yes — MIT licensed. The code, docs, and issue tracker are on GitHub, with a full mirror on GitLab.