Intro
In 19-banalize-home-server, I set up Banalize to ban IPs that probe my server, on their first mistake.
But on the dashboard, one country stood out: Belgium. 1,338 matches from only 61 IPs, about 22 matches per IP when the US average was below 2. With a ban on the first match, how can one IP be counted 68 times?
This post is the path I followed: what the logs say, what I tried, and what’s next.
What the logs say
The Belgian scanner
- At least 55 of the 61 IPs belong to Google Cloud, Belgium region.
- Each IP does a single burst and never comes back.
- Each burst is 30 to 70 requests in less than 100 ms.
Banalize reads the access log, so it sees requests after Caddy answered them. Here is the biggest burst: the ban landed 8 ms after the first request, but 67 more requests were already in the log.
The ban is correct, but useless: that IP will never come back anyway.
What they want
Across the whole log, I found 330 attack bursts (18,873 requests): PHP probes and webshells (25%), WordPress (17%), .env files (7%), framework configs, admin panels, .git, cloud credentials…
The Belgian scanner hunts AI keys: /.claude/settings.json is in 54% of its bursts, /.cursor/mcp.json in 42%, /.env.anthropic in 38%.
Did they get anything? No. No secret-file path was ever answered with a success. All they learned is that the files don’t exist.
What I tried
Gzip bomb
HTTP lets the server compress a response and tell the client with Content-Encoding: gzip. The client decompresses it automatically. Gzip is extremely efficient on repetitive data:
head -c 10G /dev/zero | gzip -9 > bomb.gz # 10 GB of zeros → 10 MB fileI send 10 MB. A naive scanner that reads the whole body into memory tries to allocate 10 GB, and crashes. Browsers and serious tools stream or cap the body, so they’re not affected.
Mount the bomb in the Caddy container:
volumes:
- ./bomb:/etc/caddy/bomb:roThen, in the site block, before the other handle. This is a simplified version, build your own list from your logs:
@bomb {
path_regexp (?i)^/\.(?:env|git|aws)(?:/|$)
# exclude the URLs where your own files live (file sync, WebDAV…)
not path /your/file-sync/path/*
}
handle @bomb {
root * /etc/caddy/bomb
rewrite * /bomb.gz
header Content-Encoding gzip
header Content-Type text/html
file_server
}My real regex comes straight from the burst analysis: the paths that showed up the most in attack bursts, and that no real visitor would ever ask for. The exclusions matter more than the regex: my file-sync apps serve my own files, and a .git folder or a .env file there is legit. Sending a 10 GB bomb to my own sync client would be a bad day.
Two days after deployment:
| Requests | Result |
|---|---|
| 67 | bomb served |
| 8 | 405, POST probes (file_server only answers GET and HEAD) |
| 4 | 404, paths not in the list |
Did it crash anyone? I can’t tell: a 200 in my log doesn’t prove the client decompressed anything, and some scanners kept going after their first bomb. But each visit now costs them something instead of nothing.
Bandwidth
Each bomb costs 10 MB of upload. With a rate limit at 15 requests per second, a burst can take about 15 bombs, so 150 MB. Use a smaller bomb if your upload is limited.
Anubis
Anubis puts a proof-of-work challenge in front of public websites to slow down scrapers. Nextcloud, mobile apps and API endpoints must bypass it, so Caddy decides who goes through it:
It didn’t work with my setup: the scanner now gets the Anubis challenge page instead of a 404. No error reaches the log, so Banalize (like Fail2Ban, see 05-fail2ban-for-caddy) has nothing to match, and stops banning.
The gzip bomb has the same problem: it answers 200. Anything that answers instead of the error hides the scanner from the ban tool.
HAProxy: delay the requests
My idea: put HAProxy in front of Caddy, in TCP mode so certificates stay in Caddy, and hold every new connection for 150 ms. The ban should land during that wait, before the rest of the burst reaches Caddy.
frontend tls_in
mode tcp
bind :443
tcp-request inspect-delay 150ms
tcp-request content accept if WAIT_END
default_backend caddy
backend caddy
mode tcp
server caddy caddy:443 send-proxy-v2Caddy reads the real client IP from the PROXY protocol header (proxy_protocol listener wrapper), so Banalize still bans the right IP.
I simulated an outside scanner sending 50 /.env requests, three ways:
| Scanner | Reached Caddy | Blocked |
|---|---|---|
| 50 parallel HTTP/1.1 connections | 2 | 48 |
| 50 requests on one keep-alive connection | 11 | 39 |
| 50 requests multiplexed on one HTTP/2 connection | 50 | 0 |
- Parallel connections: the delay works, the ban lands while they wait.
- Keep-alive: the delay only applies when the connection opens. After that, Caddy answers until the iptables rule lands.
- HTTP/2: all 50 requests leave in the first packets, before the ban exists. The ban drops packets from the scanner, but Caddy’s answers still go back.
The delay helps only one kind of scanner, adds 150 ms to every visitor, and HTTP/3 bypasses it anyway. I removed it.
The ban is already a tarpit
Banalize uses
DROP: the banned client’s packets are silently discarded. Its open connections hang until its own timeout, for free.
Two potential solutions
Both need Banalize to match the path, not the error code, since both answer with a 200.
Canary credentials
Serve a fake /.env or /.git/config containing a canary token, for example a fake AWS key. Nobody legit will ever use it. If someone does, I get an alert with their IP, often their real infrastructure, not the disposable scanner.
The ban stays instant, and the scanner leaves with something that reports back.
Slow tarpit
Send probe paths to a tiny server that answers one byte every few seconds, tying up the scanner for minutes.
The catch: Caddy writes the log line when the response ends, so Banalize bans only when the tarpit releases the scanner. Banning earlier would cut the tarpitted connection. It’s one or the other.
Conclusion
| Layer | Stops | Doesn’t stop |
|---|---|---|
Caddy 401 for private subdomains (02-caddy-hardening) | access to private apps | — |
| Rate limit (15 req/s, 04-install-caddy-plugins) | floods from one IP | bursts under the limit |
| Banalize | the next requests of an IP | the first burst |
What I learned:
- Look at your logs before adding protections.
- Nothing leaked. The best protection against secret scanners is to not put secrets in your web root.
- A ban tool needs errors. Anything that answers instead of a
404(Anubis, a bomb, a trap) must be matched another way. - Delaying requests doesn’t stop bursts sent over a single connection.
- Keep it simple, and test every rule against your own traffic: my own file-sync URLs were the main risk in every option.
Resources
- Photo by Artem Lozina on Unsplash
- Banalize: https://github.com/aussedatlo/banalize
- Protect your Home Server with Banalize: 19-banalize-home-server
- Anubis: https://github.com/TecharoHQ/anubis
- Caddy
file_server: https://caddyserver.com/docs/caddyfile/directives/file_server - HAProxy: https://www.haproxy.org
- Caddy
proxy_protocol: https://caddyserver.com/docs/caddyfile/options#listener-wrappers - Canary tokens: https://canarytokens.org



