From e73b3dd53edbd961a092a6d737b9c7e8978ce748 Mon Sep 17 00:00:00 2001 From: Steven Hiscocks Date: Mon, 27 May 2013 18:11:08 +0100 Subject: [PATCH] BF: fail2ban-regex adding duplicate lines with each regex 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. --- bin/fail2ban-regex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/fail2ban-regex b/bin/fail2ban-regex index 2b563caec..9302fd6ad 100755 --- a/bin/fail2ban-regex +++ b/bin/fail2ban-regex @@ -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)