Super quick guide on how to set up fail2ban to protect your server from WordPress brute force attacks. This guide assumes use of Apache and CentOS.
Install fail2ban if it is not installed already, then add this configuration file:
and these contents:
[Definition] failregex = ^<HOST> .* "POST /wp-login.php.*$ ignoreregex =
Append or add this file:
and the contents:
[wp-login] enabled = true filter = wp-login action = iptables-multiport[name=NoAuthFailures, port="https,https"] logpath = /var/log/httpd/*access*.log findtime = 60 bantime = 86400 maxretry = 3
fail2ban uses the sites access logs to check. This is set up to check all access logs in the /var/log/httpd folder. Adjust this rule based on your server’s log location and configuration (not the wildcard *).
Finally restart fail2ban
service fail2ban restart
systemctl restart fail2ban
TRIPS BE BURYING THOSE BOTS!