Skip to content

Apache2 - ban if too many 404 requests #3639

Closed Answered by sebres
francwalter asked this question in Q&A
Discussion options

You must be logged in to vote

The snippet of logfile with errors you provide is from the stop sequence. There are no messages from the start, so probably it doesn't start at all due to config error.
I guess the error occurs on the client side by ?sudo? fail2ban-client start and it is probably "No 'host' group in ...".
Simply because your regex doesn't contain any address tag like <ADDR> or <HOST> (so f2b would not know what should be banned if messages matched the regex). Additionally it is vulnerable due to catch-alls, no anchors (^.* as well as .*$ make anchors ^ and $ to neglect), etc.

I don't know your log format, but for typical accesslog the RE may be something like that:

[Definition]
# baduri = [^\"]*
baduri = …

Replies: 6 comments 6 replies

Comment options

You must be logged in to vote
0 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 francwalter
Comment options

You must be logged in to vote
2 replies
@sebres
Comment options

@sebres
Comment options

Comment options

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

Comment options

You must be logged in to vote
2 replies
@sebres
Comment options

@francwalter
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