Skip to content

fail2ban and openlitespeed #3745

Answered by sebres
alebalweb asked this question in Q&A
May 11, 2024 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

I don't see whether the messages should be matched by stock apache-badbots (due to agents that are normally not in badbots, neither in badbotscustom)...
But OK... to match second format also, you have to rewrite the RE:

- failregex = ^<HOST> -.*"(GET|POST).*HTTP.*".*(?:%(badbots)s|%(badbotscustom)s).*"$
+ failregex = ^(?:\[[^\]]*\] )?<HOST> -.*"(GET|POST).*HTTP.*".*(?:%(badbots)s|%(badbotscustom)s).*"$

However this filter is (and always was) a bit strange - (a bit vulnerable due to mant catch-alls, checks only for get and post methods, etc).
I'd use something like that instead:

failregex = ^(?:\[[^\]]*\] )?<ADDR> [^"]*"[^"]*" \d+ \S+ "[^"]*" "[^"]*(?:%(badbots)s|%(badbotscustom)s)[^"]*"$

B…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@sebres
Comment options

Answer selected by sebres
Comment options

You must be logged in to vote
1 reply
@sebres
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants