wordpress: Add fail2ban filter and jail

- I tested the changes with the VirtualBox image with a bridged network adapter.
After ten failed authentication attempts, my IP got blocked as expected.

- This setup uses apache's logs to filter the attempts. A wordpress
[plugin](https://wordpress.org/plugins/wp-fail2ban/) exists for redirecting the
logs to syslog, but that needs to be packaged.

Signed-off-by: nbenedek <contact@nbenedek.me>
[sunil: Drop logpath as logs are expected to go to journald]
[sunil: Update regex to match only failures and not successful logins]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
nbenedek authored and Sunil Mohan Adapa committed 2022-09-23 14:18:54 -07:00
1 parent 9a0be419f5
commit 663cd4ac22
2 files changed
+5

No files matched your search

@@ -0,0 +1,2 @@
[Definition]
failregex = .* <HOST> .* "POST /wordpress/wp-login.php HTTP/\S+" 200
@@ -0,0 +1,3 @@
[wordpress-auth-freedombox]
enabled = true
filter = wordpress-auth-freedombox