Fail2Ban remains the most effective tool against brute force attacks in 2026. Ubuntu 24.04 brings updated systemd integration. Here is the complete setup.
Step 1 — Install Fail2Ban
apt install fail2ban -y
systemctl enable fail2ban --now
Step 2 — Create Local Config
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
nano /etc/fail2ban/jail.local
Step 3 — Configure SSH Protection
[sshd]
enabled = true
port = ssh
logpath = /var/log/auth.log
maxretry = 3
bantime = 86400
findtime = 3600
Step 4 — Configure Nginx Protection
[nginx-http-auth]
enabled = true
port = http,https
logpath = /var/log/nginx/error.log
maxretry = 5
[nginx-botsearch]
enabled = true
port = http,https
logpath = /var/log/nginx/access.log
maxretry = 2
Step 5 — Configure WordPress Login Protection
[wordpress]
enabled = true
port = http,https
filter = wordpress
logpath = /var/log/nginx/access.log
maxretry = 5
bantime = 86400
Step 6 — Reload and Monitor
systemctl reload fail2ban
fail2ban-client status
fail2ban-client status sshd
Conclusion
Fail2Ban with these rules blocks the majority of automated attacks. Our team provides complete server security hardening.

Comments