diff --git a/fail2ban/server/datedetector.py b/fail2ban/server/datedetector.py index f58ab4e0..88f0f228 100644 --- a/fail2ban/server/datedetector.py +++ b/fail2ban/server/datedetector.py @@ -161,6 +161,12 @@ class DateDetector: template.setRegex("^\d{2}\d{2}\d{2} +\d{1,2}:\d{2}:\d{2}") template.setPattern("%y%m%d %H:%M:%S") self._appendTemplate(template) + # Apache Tomcat + template = DateStrptime() + template.setName("MONTH Day, Year 12hour:Minute:Second AM/PM") + template.setRegex("\S{3}\s{1,2}\d{1,2}, \d{4} \d{1,2}:\d{2}:\d{2} [AP]M") + template.setPattern("%b %d, %Y %I:%M:%S %p") + self._appendTemplate(template) finally: self.__lock.release() diff --git a/fail2ban/tests/datedetectortestcase.py b/fail2ban/tests/datedetectortestcase.py index e30027e1..23f7a174 100644 --- a/fail2ban/tests/datedetectortestcase.py +++ b/fail2ban/tests/datedetectortestcase.py @@ -86,6 +86,7 @@ class DateDetectorTest(unittest.TestCase): "2005-01-23T21:59:59-05:00Z", #ISO 8601 with TZ "<01/23/05@21:59:59>", "050123 21:59:59", # MySQL + "Jan 23, 2005 9:59:59 PM", # Apache Tomcat ): log = sdate + "[sshd] error: PAM: Authentication failure" # exclude