From this question I followed this answered.

I make a filter and enabled it inside the fail2ban config file. This is the filter:

# Fail2Ban filter to web requests for home directories on Apache servers


before = apache-common.conf


failregex = ^<HOST> -.*"(GET|POST).*/wp-login.php/.*$
ignoreregex =

Fail2ban can't start because of error (I can not see the error specifically from the log), what's wrong in my syntax?


Delimiters like slashes and dots used in things like "test.php" need escaping for regexes. Testing yours on a testing site gives the following error:

/ An unescaped delimiter must be escaped with a backslash ()

Adding the backslashes would correct the syntax error, but you would still need to test it to see if it matches the request correctly. Hope this helps!

^<HOST> -.*"(GET|POST).*\/wp-login.php\/.*$

**Edit - I saw the link to the regexes Fail2ban uses, which is the Python regex, found here. It is good reading for fail2ban.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.