Found this article that makes fail2ban work easily with WordPress.
Just thought I would post a segment of it for anyone interested.
Configure Fail2Ban for WordPress
To protect the WordPress admin panel with Fail2Ban, you will need to download the Fail2ban filter configuration file for WordPress. You can download it with the following command:
Crowdsec has its own wordpress plugin that communicates with crowdsec via api and is authentication via token, it also integrates with cloudflare (just read about it on there website).
Hmm don’t know why it didn’t work its direct from wordpress hmm weird.
Way back when I first installed WordPress I used:
Jail.
[wordpress]
enabled = true
ignoreip = [my primary ip I use to admin the server]
port = http,https
filter = wordpress
action = iptables-multiport[name=wordpress, port=“http,https”, protocol=tcp]
logpath = /var/log/apache2/domains/*.log
maxretry = 5
findtime = 600
bantime = 3600
I ment to do escalated banning but got busy and forgotten about it
I will check this tomorrow (or in the early hours) but I think this should work, not close to my computer at the moment having family time
I might switch to crowdsec but this all depends on how testing goes and how well the devs respond to questions, will be finding out more on that one when I find time to get on there discord (probably next week at this rate).