mirror of https://github.com/fail2ban/fail2ban
manually added attempts inform the observer module (take the known ban-count of bad IPs into account);
closes gh-3845pull/3607/head
parent
89970d2e3e
commit
0bf1106d72
|
@ -482,6 +482,9 @@ class Filter(JailThread):
|
|||
# Perform the ban if this attempt is resulted to:
|
||||
if attempts >= self.failManager.getMaxRetry():
|
||||
self.performBan(ip)
|
||||
# report to observer - failure was found, for possibly increasing of it retry counter (asynchronous)
|
||||
if Observers.Main is not None:
|
||||
Observers.Main.add('failureFound', self.jail, ticket)
|
||||
|
||||
return 1
|
||||
|
||||
|
|
|
@ -559,6 +559,12 @@ class BanTimeIncrDB(LogCaptureTestCase):
|
|||
self.assertEqual(restored_tickets[1].getBanTime(), -1)
|
||||
self.assertEqual(restored_tickets[1].getBanCount(), 1)
|
||||
|
||||
self.pruneLog('[test-phase 2] manually attempt must inform observer')
|
||||
jail.filter.addAttempt(ip)
|
||||
obs.wait_empty(5)
|
||||
self.assertLogged("Observer: failure found %s" % ip,
|
||||
"Found %s, bad" % ip, wait=True)
|
||||
|
||||
# stop observer
|
||||
obs.stop()
|
||||
|
||||
|
|
Loading…
Reference in New Issue