Skip to content

Commit

Permalink
BF: fail2ban-regex adding duplicate lines with each regex
Browse files Browse the repository at this point in the history
This issue was caused by the fact that every "line" is processed for each
regex, meaning each line was duplicated for every regex. This caused
duplicate fail matches and the buffer filling too quickly and possibly
missing failures.
  • Loading branch information
kwirk committed May 27, 2013
1 parent 6a38013 commit e73b3dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/fail2ban-regex
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,12 @@ class Fail2banRegex:
return False
finally:
self.__filter.delFailRegex(0)
try:
del self.__filter._Filter__lineBuffer[-1]
except IndexError:
pass
logging.getLogger("fail2ban").setLevel(logging.CRITICAL)
self.__filter.processLine(line)
for regex in self.__ignoreregex:
self.__filter.delIgnoreRegex(0)

Expand Down

0 comments on commit e73b3dd

Please sign in to comment.