mirror of
https://github.com/fail2ban/fail2ban.git
synced 2025-11-26 14:20:19 +08:00
New ignorecommand that is added to the ignoreip list from output of an external program
ignorecommand update man and fix protocol help ENH: run ignore command only after internal list has been examined. Change interface on ignorecommand to take IP as environment variable and return true if it is to be banned ENH: ignore IP command to take tagged command DOC: man pages for ingorecommand TST: add test cases for ignorecommand
This commit is contained in:
@@ -171,7 +171,6 @@ class IgnoreIP(LogCaptureTestCase):
|
||||
ipList = "127.0.0.1", "192.168.0.1", "255.255.255.255", "99.99.99.99"
|
||||
for ip in ipList:
|
||||
self.filter.addIgnoreIP(ip)
|
||||
|
||||
self.assertTrue(self.filter.inIgnoreIPList(ip))
|
||||
|
||||
def testIgnoreIPNOK(self):
|
||||
@@ -201,6 +200,11 @@ class IgnoreIP(LogCaptureTestCase):
|
||||
self.assertFalse(self._is_logged('Ignore 192.168.1.32'))
|
||||
self.assertTrue(self._is_logged('Requested to manually ban an ignored IP 192.168.1.32. User knows best. Proceeding to ban it.'))
|
||||
|
||||
def testIgnoreCommand(self):
|
||||
self.filter.setIgnoreCommand("testcases/files/ignorecommand.py <ip>")
|
||||
self.assertTrue(self.filter.inIgnoreIPList("10.0.0.1"))
|
||||
self.assertFalse(self.filter.inIgnoreIPList("10.0.0.0"))
|
||||
|
||||
|
||||
class IgnoreIPDNS(IgnoreIP):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user