mirror of https://github.com/fail2ban/fail2ban
Merge branch '0.10' into 0.11
commit
5c2fba0398
|
@ -448,9 +448,9 @@ class FilterReaderTest(unittest.TestCase):
|
||||||
self.assertSortedEqual(c, output)
|
self.assertSortedEqual(c, output)
|
||||||
|
|
||||||
def testFilterReaderSubstitionSection(self):
|
def testFilterReaderSubstitionSection(self):
|
||||||
output = [['set', 'jailname', 'addfailregex', '^\s*to=fail2ban@localhost fromip=<IP>\s*$']]
|
output = [['set', 'jailname', 'addfailregex', '^\\s*to=fail2ban@localhost fromip=<IP>\\s*$']]
|
||||||
filterName, filterOpt = extractOptions(
|
filterName, filterOpt = extractOptions(
|
||||||
'substition[failregex="^\s*<Definition/failregex>\s*$", honeypot="<default/honeypot>"]')
|
'substition[failregex="^\\s*<Definition/failregex>\\s*$", honeypot="<default/honeypot>"]')
|
||||||
filterReader = FilterReader('substition', "jailname", filterOpt,
|
filterReader = FilterReader('substition', "jailname", filterOpt,
|
||||||
share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR)
|
share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR)
|
||||||
filterReader.read()
|
filterReader.read()
|
||||||
|
|
|
@ -341,7 +341,9 @@ def with_foreground_server_thread(startextra={}):
|
||||||
# wait for end sign:
|
# wait for end sign:
|
||||||
Utils.wait_for(lambda: phase.get('end', None) is not None, MAX_WAITTIME)
|
Utils.wait_for(lambda: phase.get('end', None) is not None, MAX_WAITTIME)
|
||||||
self.assertTrue(phase.get('end', None))
|
self.assertTrue(phase.get('end', None))
|
||||||
self.assertLogged("Shutdown successful", "Exiting Fail2ban", all=True)
|
self.assertLogged("Shutdown successful", "Exiting Fail2ban", all=True, wait=MAX_WAITTIME)
|
||||||
|
# set to NOP: avoid dual call
|
||||||
|
self.stopAndWaitForServerEnd = lambda *args, **kwargs: None
|
||||||
self.stopAndWaitForServerEnd = _stopAndWaitForServerEnd
|
self.stopAndWaitForServerEnd = _stopAndWaitForServerEnd
|
||||||
# wait for start thread:
|
# wait for start thread:
|
||||||
Utils.wait_for(lambda: phase.get('start', None) is not None, MAX_WAITTIME)
|
Utils.wait_for(lambda: phase.get('start', None) is not None, MAX_WAITTIME)
|
||||||
|
@ -362,7 +364,6 @@ def with_foreground_server_thread(startextra={}):
|
||||||
# so don't kill (same process) - if success, just wait for end of worker:
|
# so don't kill (same process) - if success, just wait for end of worker:
|
||||||
if phase.get('end', None):
|
if phase.get('end', None):
|
||||||
th.join()
|
th.join()
|
||||||
self.stopAndWaitForServerEnd = None
|
|
||||||
tearDownMyTime()
|
tearDownMyTime()
|
||||||
return wrapper
|
return wrapper
|
||||||
return _deco_wrapper
|
return _deco_wrapper
|
||||||
|
|
|
@ -292,7 +292,7 @@ class Fail2banRegexTest(LogCaptureTestCase):
|
||||||
|
|
||||||
def testRegexEpochPatterns(self):
|
def testRegexEpochPatterns(self):
|
||||||
(opts, args, fail2banRegex) = _Fail2banRegex(
|
(opts, args, fail2banRegex) = _Fail2banRegex(
|
||||||
"-r", "-d", "^\[{LEPOCH}\]\s+", "--maxlines", "5",
|
"-r", "-d", r"^\[{LEPOCH}\]\s+", "--maxlines", "5",
|
||||||
"[1516469849] 192.0.2.1 FAIL: failure\n"
|
"[1516469849] 192.0.2.1 FAIL: failure\n"
|
||||||
"[1516469849551] 192.0.2.2 FAIL: failure\n"
|
"[1516469849551] 192.0.2.2 FAIL: failure\n"
|
||||||
"[1516469849551000] 192.0.2.3 FAIL: failure\n"
|
"[1516469849551000] 192.0.2.3 FAIL: failure\n"
|
||||||
|
|
Loading…
Reference in New Issue