Hardening a Server in Two Steps: Fail2ban for the Host, SafeLine for the App
If "secure my server" feels like a bottomless to-do list, here's the shortest path that actually covers the two layers attackers go after: the host and the web app. Two tools, two steps, no overlap.
Step 1 — Lock down the host with Fail2ban
Fail2ban watches your service logs and bans IPs that show hostile behavior — most usefully, repeated failed SSH logins. On a typical Linux box:
sudo apt install fail2ban # or: yum install fail2ban sudo systemctl enable --now fail2ban By default it enables a jail for sshd. After a few failed logins from one IP, that IP is blocked at the firewall. You've now closed the brute-force door on the host.
What it does: bans bad IPs at the network layer based on log patterns.
What it doesn't: it never looks at the content of your web requests.
Step 2 — Filter the app with SafeLine
Now put a filter in front of your web application. SafeLine is a self-hosted WAF that runs as a reverse proxy and inspects every HTTP request:
bash -c "$(curl -fsSLk https://waf.chaitin.com/release/latest/manager.sh)" -- --en Open the console at https://<your-server-ip>:9443, point it at your app, and traffic flows through SafeLine first. Its semantic detection engine blocks SQL injection, XSS, and malicious bots — even from an IP with a clean reputation.
What it does: blocks malicious payloads at the application layer.
What it doesn't: it doesn't ban IPs at the host firewall.
Why both, in this order
Start with the host because it's nearly free and stops the most common noise (SSH brute force). Then add the app-layer filter so the requests that do reach your service are inspected. Neither step duplicates the other: Fail2ban decides which IPs are allowed near your host; SafeLine decides which requests reach your app.
A quick checklist
- [ ] Fail2ban installed and running;
sshdjail active - [ ] SafeLine installed; your app's traffic routed through it
- [ ] A test malicious payload (e.g., a basic SQLi string in a form field) is blocked, not passed to your app
- [ ] Logs reviewed once: confirm bans and blocks look right, then let them run
That's it. Two steps, two layers, and a server that's far harder to surprise.
Host-level banning and app-level filtering aren't competitors — they're the two halves of a sane baseline.
- ⭐ SafeLine WAF on GitHub — give it a star if you find it useful
- 🔗 Official Docs — installation guide, configuration, and API reference
- 🧪 Live Demo — see the dashboard in action (no login required)