From SSH Brute Force to SQL Injection: How SafeLine and Fail2ban Split the Work
Most server compromises start with one of two things: someone guessing a password, or someone slipping a malicious payload into a web request. Those two attacks live on completely different layers — which is exactly why Fail2ban and SafeLine aren't competitors. Walk through both attack paths and it becomes obvious where each tool belongs.
Attack path 1: SSH brute force
What happens: a bot hammers your SSH port with thousands of password attempts.
Who stops it: Fail2ban reads your authentication logs, counts the failures, and bans the offending IP by pushing a rule into your firewall (iptables, nftables, or firewalld).
Why SafeLine isn't in the loop: SafeLine sits in front of your web app, inspecting HTTP traffic. SSH isn't HTTP, so it never sees the attempt. That's not a limitation — it's scope. Fail2ban owns the host; SafeLine owns the app.
What happens: a crafted POST hits /login carrying a malicious payload designed to manipulate your database query.
Who stops it: SafeLine reads the request, and its semantic detection engine recognizes the injection attempt for what it is — regardless of the IP's reputation — and drops the request before it reaches your code.
Why Fail2ban struggles here: it sees an IP making a POST that returned a 200, which looks perfectly normal in a log. It has no visibility into the payload, so it can't tell a legitimate login from a malicious one.
The split, stated plainly
| Fail2ban | SafeLine |
| Sees | IPs and log patterns | The actual HTTP request |
| Stops | Brute force, scanners, repeat offenders | Injection, XSS, malicious bots |
| Layer | Host / network (L3–L4) | Application (L7) |
| Acts by | Banning the IP at the firewall | Dropping the bad request |
Same server, two doors. Fail2ban locks the side door (SSH and service brute force); SafeLine locks the front door (your web app).
A sane setup order
- Expose only what you must. Close unused ports; that alone shrinks your attack surface.
- Fail2ban on the host. Protect SSH and any other services with login attempts. Tune the filters to your logs.
- SafeLine in front of the web app. Install it as a reverse proxy and point your app's traffic through it:
bash -c "$(curl -fsSLk https://waf.chaitin.com/release/latest/manager.sh)" -- --en
Your app keeps running exactly as before — it's just now shielded by a filter that understands what a request is trying to do.
FAQ
No. Fail2ban can't inspect request payloads; SafeLine doesn't ban IPs at the host level. They cover different layers.
Does SafeLine protect SSH?
No — and it's not meant to. SSH is handled by host-level tools like Fail2ban. SafeLine focuses on your web traffic.
Is Fail2ban open source?
Yes, Fail2ban is open-source and widely used for host intrusion prevention. SafeLine is a self-hosted WAF with a free Community Edition (up to 10 apps at 800 QPS).
If I only pick one, which?
If your risk is a public web app, start with SafeLine — that's where application attacks land. If your risk is SSH or service brute force, start with Fail2ban. Most servers end up with both.
Different attacks, different layers, different tools — used together, they close both doors.