"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fail2ban/tests/fail2banregextestcase.py" between
fail2ban-0.10.3.1.tar.gz and fail2ban-0.10.4.tar.gz

About: fail2ban scans log files and bans (via firewall rules) IP-addresses that makes too many access failures. It updates firewall rules to reject the IP address. Experimental version.

fail2banregextestcase.py  (fail2ban-0.10.3.1):fail2banregextestcase.py  (fail2ban-0.10.4)
skipping to change at line 210 skipping to change at line 210
) )
self.assertTrue(fail2banRegex.start(args)) self.assertTrue(fail2banRegex.start(args))
self.assertLogged('Lines: 13 lines, 0 ignored, 5 matched, 8 misse d') self.assertLogged('Lines: 13 lines, 0 ignored, 5 matched, 8 misse d')
self.assertLogged('141.3.81.106 Sun Aug 14 11:53:59 2005') self.assertLogged('141.3.81.106 Sun Aug 14 11:53:59 2005')
self.assertLogged('141.3.81.106 Sun Aug 14 11:54:59 2005') self.assertLogged('141.3.81.106 Sun Aug 14 11:54:59 2005')
def testVerboseFullSshd(self): def testVerboseFullSshd(self):
(opts, args, fail2banRegex) = _Fail2banRegex( (opts, args, fail2banRegex) = _Fail2banRegex(
"-l", "notice", # put down log-level, because of too many debug-messages "-l", "notice", # put down log-level, because of too many debug-messages
"-v", "--verbose-date", "--print-all-matched", "-v", "--verbose-date", "--print-all-matched", "--print-a ll-ignored",
"-c", CONFIG_DIR, "-c", CONFIG_DIR,
Fail2banRegexTest.FILENAME_SSHD, "sshd" Fail2banRegexTest.FILENAME_SSHD, "sshd"
) )
self.assertTrue(fail2banRegex.start(args)) self.assertTrue(fail2banRegex.start(args))
# test failure line and not-failure lines both presents: # test failure line and not-failure lines both presents:
self.assertLogged("[29116]: User root not allowed because account is locked", self.assertLogged("[29116]: User root not allowed because account is locked",
"[29116]: Received disconnect from 1.2.3.4", all=True) "[29116]: Received disconnect from 1.2.3.4", all=True)
def testFastSshd(self): def testFastSshd(self):
(opts, args, fail2banRegex) = _Fail2banRegex( (opts, args, fail2banRegex) = _Fail2banRegex(
skipping to change at line 347 skipping to change at line 347
r"llinco[^\\]" r"llinco[^\\]"
) )
self.assertTrue(fail2banRegex.start(args)) self.assertTrue(fail2banRegex.start(args))
self.assertLogged('Error decoding line') self.assertLogged('Error decoding line')
self.assertLogged('Lines: 4 lines, 1 ignored, 2 matched, 1 missed ') self.assertLogged('Lines: 4 lines, 1 ignored, 2 matched, 1 missed ')
self.assertLogged('https://') self.assertLogged('https://')
def testExecCmdLine_Usage(self): def testExecCmdLine_Usage(self):
self.assertNotEqual(_test_exec_command_line(), 0) self.assertNotEqual(_test_exec_command_line(), 0)
self.pruneLog()
self.assertEqual(_test_exec_command_line('-V'), 0)
self.assertLogged(fail2banregex.normVersion())
self.pruneLog()
self.assertEqual(_test_exec_command_line('--version'), 0)
def testExecCmdLine_Direct(self): def testExecCmdLine_Direct(self):
self.assertEqual(_test_exec_command_line( self.assertEqual(_test_exec_command_line(
'-l', 'info', '-l', 'info',
"Dec 31 11:59:59 [sshd] error: PAM: Authentication failur e for kevin from 192.0.2.0", "Dec 31 11:59:59 [sshd] error: PAM: Authentication failur e for kevin from 192.0.2.0",
r"Authentication failure for .*? from <HOST>$" r"Authentication failure for .*? from <HOST>$"
), 0) ), 0)
self.assertLogged('Lines: 1 lines, 0 ignored, 1 matched, 0 missed ') self.assertLogged('Lines: 1 lines, 0 ignored, 1 matched, 0 missed ')
def testExecCmdLine_MissFailID(self): def testExecCmdLine_MissFailID(self):
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)