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 2022-09-07 18:33:15 +02:00 committed by Sunil Mohan Adapa
parent 9a0be419f5
commit 663cd4ac22
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 5 additions and 0 deletions

View File

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

View File

@ -0,0 +1,3 @@
[wordpress-auth-freedombox]
enabled = true
filter = wordpress-auth-freedombox