Server rack glowing softly in a quiet data room at dawn
Rack at dawn

technology

Mass scanners hit every server I run. So I built the wall.

Brute-force bots, .env hunters and AI crawl agents arrive from hundreds of networks a day. TrapGuard Firewall is what I built to answer them — deliberately simple, cheap to run, open source.

Any server attached to the public internet leads a doubled life. The quiet one is the site visitors see. The loud one lives in the access logs, where the same anonymous crowd arrives every hour of every day, walking lists of paths and passwords in the hope one of them opens a door. /.env. /.git/config. /_profiler/phpinfo. /wp-content/upgrade/. Firmware-style filenames tested against whatever answers. I have run servers long enough that none of this registers as news. It is weather.

The machines I look after are cPanel and LiteSpeed fleets, and over recent months the background radiation hardened into something you plan around. Mass attackers and scanners, hundreds of distinct networks in a single day, the overwhelming majority automated. Taken singly each request is trivial. Taken as a flock they are a permanent tax: bandwidth, load, log volume, and the small standing probability that one probe eventually sticks.

Friction, inverted

I have written here before that traffic is not the hard part; friction is. My whole career has been spent sanding it down — performance marketing, instant property offers, advertising inventory a landlord sells without a broker in the room. Defence runs the same economics the other way. Against an automated attacker, friction is the product. The winning move is a wall that costs less to maintain than the attack costs to mount, and that never taxes a legitimate visitor for the sins of the bots.

My own shelves carried the usual equipment: fail2ban with hand-rolled jails, CSF watching the ports, a heavier web-application firewall upstream where the site warranted one. Every layer earned its keep. None saw the whole picture, and each paid rent — configuration sprawl here, a web-server restart there, an evening lost correlating four logs to answer one question. Efficiency was the missing quality. The tools existed; simplicity did not.

The brief

So I wrote the brief I wished somebody else would have written, and built the thing it described. TrapGuard Firewall reads logs rather than packets: it parses access logs at upwards of 33,000 lines a second, holds its verdicts in roughly eighteen megabytes of memory, and pushes blocks down to whatever enforcement the server already trusts. It never restarts the web server and never sits in the request path, so there is no new hop to go slow and nothing to break mid-morning. On the install line it recognises cPanel/WHM, DirectAdmin, Plesk, CyberPanel or a bare machine; Apache, NGINX, LiteSpeed, OpenLiteSpeed or Caddy; CSF, Imunify360, fail2ban, nftables, UFW, firewalld or plain iptables — and speaks to whichever it finds rather than demanding loyalty to one. Cloudflare and search-engine crawlers are whitelisted by default, because swatting a bot by blocking Google is how you lose the plot.

Paranoia is configurable, which matters more than it sounds. A dry-run mode runs the entire detection engine log-only, so you can watch a week of would-be verdicts before enforcing anything. Every category — thirteen of them, from credential stuffing to AI dataset scraping — toggles independently, custom sections cover the worst habits of a particular stack, and any change previews through a replay command before it touches production. When I say simple I mean auditable: transparent files and a single control command for previews, nothing else to take on faith.

What it watches

The interesting artefact is the taxonomy of hostility that falls out of live data. At the time of writing, just under a third of currently blocked addresses are AI-powered exploit-scanner agents — crawlers behaving like an unsupervised penetration test. Eighteen per cent hunt secrets: environment files, committed credential bundles, the stray gcp-key.json that ships to production with the Christmas decorations. Seventeen per cent probe web exploits outright, fourteen per cent knock on exposed source-control repositories, nine per cent fuzz directories in bursts, eight per cent pick locks on CMS components. The remainder sweep multiple unrelated domains in one visit and go shopping for database dumps. Beneath all of it sit 662 maintained master rules, refreshed daily, and four public feeds — a plaintext blocklist, an nftables set, a hostile /24 list and the master rules file — so any other machine can subscribe to the conclusions.

Two days of receipts

Counters on the public site started moving on 1 December. By this writing 195 addresses stood actively blocked, 153 unique attacking IPs in the current UTC day, each with a public dossier: the paths it fetched, the platforms it probed, a risk score. Sixty-one per cent confidence on an Indonesian prober sweeping /wp-content/upgrade/; seventy-four on a Brazilian machine looking for misplaced GCP credentials. Modest numbers, honestly disclosed. Publishing them was a deliberate choice. A blocklist nobody can inspect is a rumour.

The mix tells the truer story than the volume does. Nothing exotic lands on these machines: the workhorse of the current noise is ordinary requests, at unremarkable individual ambition, sustained for weeks from rotating networks. That is precisely what cheap defence is good at. The countermeasure that wins is the dull one, tuned relentlessly, run permanently.

What it will not do

A tool this size owes an honest account of its edges. TrapGuard quiets the great automated majority — scanners, stuffers, spray-and-pray — and does nothing about a patient, funded human adversary, nor about the fundamentals: patched software, sane permissions, backups you have actually restored from once. Think of it as the moat; patching remains the castle.

It is open source on purpose. The code is at github.com/tsjc/trapguard-firewall, the counters, rule playground and install line at trapguardfirewall.com. One command puts a Linux server under protection:

curl -fsSL https://trapguardfirewall.com/install.sh | sudo bash

Run the dry-run first, as advertised, and read the week of would-be blocks before letting it act.

Somewhere along the way I stopped hoping the scanning would stop. It will not; the economics guarantee the crowd. What changed this month is that the noise now ends in a wall that costs almost nothing to run, at a throughput figure my busiest machine cannot exceed, built the way I like my businesses — simple mechanisms you can see straight through, doing steady work while everybody sleeps. There is a specific satisfaction in the morning report. The night shift happened, the wall caught it, and eighteen megabytes remembers the names.