Skip to content

Blocking a strange address and how to find all addresses were banned with this error #3257

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

You must be logged in to vote

fail2ban bans host "235.24.17.591" instead "198.235.24.17"!!!

Your regex was and still is a bit "vulnerable" (because unanchored), so <HOST> found something other as expected (and/or think it is a hostname and can resolve them). Better is to use <ADDR> instead of <HOST> (if it must find IP only) and anchor them.
So you can rewrite it to something like ^\s*<ADDR>.
PoC:

$ fail2ban-regex -v 'Apr 15 01:50:47.249031 192.0.2.123.59165 > 192.0.2.1.3389: tcp 0' '^\s*<ADDR>'

Running tests
=============

Use   failregex line : ^\s*<ADDR>
Use      single line : Apr 15 01:50:47.249031 192.0.2.123.59165 > 192.0.2...


Results
=======

Failregex: 1 total
|-  #) [# of hits] regular expression
|   1) …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sebres
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