diff --git a/fail2ban/server/jail.py b/fail2ban/server/jail.py index 673b6454..2c84e475 100644 --- a/fail2ban/server/jail.py +++ b/fail2ban/server/jail.py @@ -295,7 +295,7 @@ class Jail(object): ): try: #logSys.debug('restored ticket: %s', ticket) - if self.filter.inIgnoreIPList(ticket.getIP(), log_ignore=True): continue + if self.filter.inIgnoreIPList(ticket.getID(), log_ignore=True): continue # mark ticked was restored from database - does not put it again into db: ticket.restored = True # correct start time / ban time (by the same end of ban): diff --git a/fail2ban/tests/tickettestcase.py b/fail2ban/tests/tickettestcase.py index 945da7bd..771d2b50 100644 --- a/fail2ban/tests/tickettestcase.py +++ b/fail2ban/tests/tickettestcase.py @@ -118,6 +118,17 @@ class TicketTests(unittest.TestCase): self.assertEqual(ft2.getTime(), ft.getTime()) self.assertEqual(ft2.getBanTime(), ft.getBanTime()) + def testDiffIDAndIPTicket(self): + tm = MyTime.time() + # different ID (string) and IP: + t = Ticket('123-456-678', tm, data={'ip':'192.0.2.1'}) + self.assertEqual(t.getID(), '123-456-678') + self.assertEqual(t.getIP(), '192.0.2.1') + # different ID (tuple) and IP: + t = Ticket(('192.0.2.1', '5000'), tm, data={'ip':'192.0.2.1'}) + self.assertEqual(t.getID(), ('192.0.2.1', '5000')) + self.assertEqual(t.getIP(), '192.0.2.1') + def testTicketFlags(self): flags = ('restored', 'banned') ticket = Ticket('test', 0)