1

I'm trying to set up a custom filter for fail2ban on a wordpress site. I've been following this tutorial but when I try to test my custom filter, I get the error: server.failregex.RegexException: No 'host' group in '/etc/...

I've been researching this problem and I see that filters are supposed to be wrapped in (?P ... ) as per the documentation

So my file looks like this:

# Fail2Ban filter for Wordpress
#

# WP brute force attacks filter
[Definition]
failregex = (?P<host> ^ .* "POST )  /wp-login.php
ignoreregex =

I've tried different permutations of placing the (?P ... ) around different parts of the regex but after looking around, I'm honestly not sure what the correct syntax is. Can someone explain the syntax to me so that I can get this up and running?

I'm not sure if these details matter but, my server is running Apache/PHP and has cloudflare running on it.

Thanks in advance.

  • Test your regex with the cli tool fail2ban-regex. – sebix Dec 13 '15 at 15:22

Your Answer

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

Browse other questions tagged or ask your own question.