mirror of https://github.com/fail2ban/fail2ban
Fix more typos
parent
22ce0c0536
commit
1427625528
|
@ -2558,7 +2558,7 @@ ver. 0.3.1 (2005/03/31) - beta
|
||||||
|
|
||||||
ver. 0.3.0 (2005/02/24) - beta
|
ver. 0.3.0 (2005/02/24) - beta
|
||||||
----------
|
----------
|
||||||
- Re-writting of parts of the code in order to handle several log files with
|
- Re-writing of parts of the code in order to handle several log files with
|
||||||
different rules
|
different rules
|
||||||
- Removed `sshd.py` because it is no more needed
|
- Removed `sshd.py` because it is no more needed
|
||||||
- Fixed a bug when exiting with IP in the ban list
|
- Fixed a bug when exiting with IP in the ban list
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#
|
#
|
||||||
# Please do not use this action unless you are certain that fail2ban
|
# Please do not use this action unless you are certain that fail2ban
|
||||||
# does not result in "false positives" for your deployment. False
|
# does not result in "false positives" for your deployment. False
|
||||||
# positive reports could serve a mis-favor to the original cause by
|
# positive reports could serve a misfavor to the original cause by
|
||||||
# flooding corresponding contact addresses, and complicating the work
|
# flooding corresponding contact addresses, and complicating the work
|
||||||
# of administration personnel responsible for handling (verified) legit
|
# of administration personnel responsible for handling (verified) legit
|
||||||
# complains.
|
# complains.
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# Reporting an IP is a serious action. Make sure that it is legit.
|
# Reporting an IP is a serious action. Make sure that it is legit.
|
||||||
# Consider using this action only for:
|
# Consider using this action only for:
|
||||||
# * IP that has been banned more than once
|
# * IP that has been banned more than once
|
||||||
# * High max retry to avoid user mis-typing password
|
# * High max retry to avoid user mistyping password
|
||||||
# * Filters that are unlikely to be human error
|
# * Filters that are unlikely to be human error
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
|
|
|
@ -406,7 +406,7 @@ class DefinitionInitConfigReader(ConfigReader):
|
||||||
if cond:
|
if cond:
|
||||||
n, cond = cond.groups()
|
n, cond = cond.groups()
|
||||||
ignore.add(n)
|
ignore.add(n)
|
||||||
# substiture options already specified direct:
|
# substitute options already specified direct:
|
||||||
opts = substituteRecursiveTags(combinedopts,
|
opts = substituteRecursiveTags(combinedopts,
|
||||||
ignore=ignore, addrepl=self.getCombOption)
|
ignore=ignore, addrepl=self.getCombOption)
|
||||||
if not opts:
|
if not opts:
|
||||||
|
|
|
@ -106,7 +106,7 @@ usage = lambda: "%s [OPTIONS] <LOG> <REGEX> [IGNOREREGEX]" % sys.argv[0]
|
||||||
|
|
||||||
class _f2bOptParser(OptionParser):
|
class _f2bOptParser(OptionParser):
|
||||||
def format_help(self, *args, **kwargs):
|
def format_help(self, *args, **kwargs):
|
||||||
""" Overwritten format helper with full ussage."""
|
""" Overwritten format helper with full usage."""
|
||||||
self.usage = ''
|
self.usage = ''
|
||||||
return "Usage: " + usage() + "\n" + __doc__ + """
|
return "Usage: " + usage() + "\n" + __doc__ + """
|
||||||
LOG:
|
LOG:
|
||||||
|
|
|
@ -725,7 +725,7 @@ class Fail2BanDb(object):
|
||||||
failures = 0
|
failures = 0
|
||||||
tickdata = {}
|
tickdata = {}
|
||||||
m = data.get('matches', [])
|
m = data.get('matches', [])
|
||||||
# pre-insert "maxadd" enries (because tickets are ordered desc by time)
|
# pre-insert "maxadd" entries (because tickets are ordered desc by time)
|
||||||
maxadd = self.maxMatches - len(matches)
|
maxadd = self.maxMatches - len(matches)
|
||||||
if maxadd > 0:
|
if maxadd > 0:
|
||||||
if len(m) <= maxadd:
|
if len(m) <= maxadd:
|
||||||
|
|
|
@ -114,7 +114,7 @@ class JailThread(Thread):
|
||||||
def join(self):
|
def join(self):
|
||||||
""" Safer join, that could be called also for not started (or ended) threads (used for cleanup).
|
""" Safer join, that could be called also for not started (or ended) threads (used for cleanup).
|
||||||
"""
|
"""
|
||||||
## if cleanup needed - create derivate and call it before join...
|
## if cleanup needed - create derivative and call it before join...
|
||||||
|
|
||||||
## if was really started - should call join:
|
## if was really started - should call join:
|
||||||
if self.active is not None:
|
if self.active is not None:
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ExecuteActions(LogCaptureTestCase):
|
||||||
self.__actions.add('test')
|
self.__actions.add('test')
|
||||||
self.assertTrue(self.__actions['test'])
|
self.assertTrue(self.__actions['test'])
|
||||||
self.assertIn('test', self.__actions)
|
self.assertIn('test', self.__actions)
|
||||||
self.assertNotIn('nonexistant action', self.__actions)
|
self.assertNotIn('nonexistent action', self.__actions)
|
||||||
self.__actions.add('test1')
|
self.__actions.add('test1')
|
||||||
del self.__actions['test']
|
del self.__actions['test']
|
||||||
del self.__actions['test1']
|
del self.__actions['test1']
|
||||||
|
@ -287,7 +287,7 @@ class ExecuteActions(LogCaptureTestCase):
|
||||||
# no flush for inet4 (already successfully flushed):
|
# no flush for inet4 (already successfully flushed):
|
||||||
self.assertNotLogged("ERROR",
|
self.assertNotLogged("ERROR",
|
||||||
"stdout: %r" % 'ip flush inet4',
|
"stdout: %r" % 'ip flush inet4',
|
||||||
'Unban tickets each individualy',
|
'Unban tickets each individually',
|
||||||
all=True)
|
all=True)
|
||||||
|
|
||||||
def testActionsConsistencyCheckDiffFam(self):
|
def testActionsConsistencyCheckDiffFam(self):
|
||||||
|
@ -401,7 +401,7 @@ class ExecuteActions(LogCaptureTestCase):
|
||||||
# no flush for inet4 (already successfully flushed):
|
# no flush for inet4 (already successfully flushed):
|
||||||
self.assertNotLogged("ERROR",
|
self.assertNotLogged("ERROR",
|
||||||
"stdout: %r" % 'ip flush inet4',
|
"stdout: %r" % 'ip flush inet4',
|
||||||
'Unban tickets each individualy',
|
'Unban tickets each individually',
|
||||||
all=True)
|
all=True)
|
||||||
|
|
||||||
@with_alt_time
|
@with_alt_time
|
||||||
|
|
|
@ -563,7 +563,7 @@ class FilterReaderTest(LogCaptureTestCase):
|
||||||
self.assertNotEqual(opts['maxlines'], 'X'); # wrong int value 'X' for 'maxlines'
|
self.assertNotEqual(opts['maxlines'], 'X'); # wrong int value 'X' for 'maxlines'
|
||||||
self.assertLogged("Wrong int value 'X' for 'maxlines'. Using default one:")
|
self.assertLogged("Wrong int value 'X' for 'maxlines'. Using default one:")
|
||||||
|
|
||||||
def testFilterReaderSubstitionDefault(self):
|
def testFilterReaderSubstitutionDefault(self):
|
||||||
output = [['set', 'jailname', 'addfailregex', 'to=sweet@example.com fromip=<IP>']]
|
output = [['set', 'jailname', 'addfailregex', 'to=sweet@example.com fromip=<IP>']]
|
||||||
filterReader = FilterReader('substitution', "jailname", {},
|
filterReader = FilterReader('substitution', "jailname", {},
|
||||||
share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR)
|
share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR)
|
||||||
|
@ -583,7 +583,7 @@ class FilterReaderTest(LogCaptureTestCase):
|
||||||
opts = filterReader.getCombined()
|
opts = filterReader.getCombined()
|
||||||
self.assertTrue('sshd' in opts['failregex'])
|
self.assertTrue('sshd' in opts['failregex'])
|
||||||
|
|
||||||
def testFilterReaderSubstitionSet(self):
|
def testFilterReaderSubstitutionSet(self):
|
||||||
output = [['set', 'jailname', 'addfailregex', 'to=sour@example.com fromip=<IP>']]
|
output = [['set', 'jailname', 'addfailregex', 'to=sour@example.com fromip=<IP>']]
|
||||||
filterReader = FilterReader('substitution', "jailname", {'honeypot': 'sour@example.com'},
|
filterReader = FilterReader('substitution', "jailname", {'honeypot': 'sour@example.com'},
|
||||||
share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR)
|
share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR)
|
||||||
|
@ -592,7 +592,7 @@ class FilterReaderTest(LogCaptureTestCase):
|
||||||
c = filterReader.convert()
|
c = filterReader.convert()
|
||||||
self.assertSortedEqual(c, output)
|
self.assertSortedEqual(c, output)
|
||||||
|
|
||||||
def testFilterReaderSubstitionKnown(self):
|
def testFilterReaderSubstitutionKnown(self):
|
||||||
output = [['set', 'jailname', 'addfailregex', '^to=test,sweet@example.com,test2,sweet@example.com fromip=<IP>$']]
|
output = [['set', 'jailname', 'addfailregex', '^to=test,sweet@example.com,test2,sweet@example.com fromip=<IP>$']]
|
||||||
filterName, filterOpt = extractOptions(
|
filterName, filterOpt = extractOptions(
|
||||||
'substitution[failregex="^<known/failregex>$", honeypot="<sweet>,<known/honeypot>", sweet="test,<known/honeypot>,test2"]')
|
'substitution[failregex="^<known/failregex>$", honeypot="<sweet>,<known/honeypot>", sweet="test,<known/honeypot>,test2"]')
|
||||||
|
@ -603,7 +603,7 @@ class FilterReaderTest(LogCaptureTestCase):
|
||||||
c = filterReader.convert()
|
c = filterReader.convert()
|
||||||
self.assertSortedEqual(c, output)
|
self.assertSortedEqual(c, output)
|
||||||
|
|
||||||
def testFilterReaderSubstitionSection(self):
|
def testFilterReaderSubstitutionSection(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(
|
||||||
'substitution[failregex="^\\s*<Definition/failregex>\\s*$", honeypot="<default/honeypot>"]')
|
'substitution[failregex="^\\s*<Definition/failregex>\\s*$", honeypot="<default/honeypot>"]')
|
||||||
|
@ -614,7 +614,7 @@ class FilterReaderTest(LogCaptureTestCase):
|
||||||
c = filterReader.convert()
|
c = filterReader.convert()
|
||||||
self.assertSortedEqual(c, output)
|
self.assertSortedEqual(c, output)
|
||||||
|
|
||||||
def testFilterReaderSubstitionFail(self):
|
def testFilterReaderSubstitutionFail(self):
|
||||||
# directly subst the same var :
|
# directly subst the same var :
|
||||||
filterReader = FilterReader('substitution', "jailname", {'honeypot': '<honeypot>'},
|
filterReader = FilterReader('substitution', "jailname", {'honeypot': '<honeypot>'},
|
||||||
share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR)
|
share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR)
|
||||||
|
|
|
@ -580,7 +580,7 @@ class CustomDateFormatsTest(unittest.TestCase):
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
self.assertEqual(date, None)
|
self.assertEqual(date, None)
|
||||||
|
|
||||||
# def testDefaultTempate(self):
|
# def testDefaultTemplate(self):
|
||||||
# self.__datedetector.setDefaultRegex("^\S{3}\s{1,2}\d{1,2} \d{2}:\d{2}:\d{2}")
|
# self.__datedetector.setDefaultRegex("^\S{3}\s{1,2}\d{1,2} \d{2}:\d{2}:\d{2}")
|
||||||
# self.__datedetector.setDefaultPattern("%b %d %H:%M:%S")
|
# self.__datedetector.setDefaultPattern("%b %d %H:%M:%S")
|
||||||
#
|
#
|
||||||
|
|
|
@ -148,7 +148,7 @@ class Fail2banRegexTest(LogCaptureTestCase):
|
||||||
self.assertLogged("Unable to compile regular expression")
|
self.assertLogged("Unable to compile regular expression")
|
||||||
self.assertLogged("unknown group name", "at position 23", all=False); # details of failed compilation
|
self.assertLogged("unknown group name", "at position 23", all=False); # details of failed compilation
|
||||||
|
|
||||||
def testWrongIngnoreRE(self):
|
def testWrongIgnoreRE(self):
|
||||||
self.assertFalse(_test_exec(
|
self.assertFalse(_test_exec(
|
||||||
"--datepattern", "{^LN-BEG}EPOCH",
|
"--datepattern", "{^LN-BEG}EPOCH",
|
||||||
"test", r".*? from <HOST>$", r".**"
|
"test", r".*? from <HOST>$", r".**"
|
||||||
|
@ -557,7 +557,7 @@ class Fail2banRegexTest(LogCaptureTestCase):
|
||||||
FILENAME_ZZZ_GEN, FILENAME_ZZZ_GEN
|
FILENAME_ZZZ_GEN, FILENAME_ZZZ_GEN
|
||||||
))
|
))
|
||||||
|
|
||||||
def testWronChar(self):
|
def testWrongChar(self):
|
||||||
unittest.F2B.SkipIfCfgMissing(stock=True)
|
unittest.F2B.SkipIfCfgMissing(stock=True)
|
||||||
self.assertTrue(_test_exec(
|
self.assertTrue(_test_exec(
|
||||||
"-l", "notice", # put down log-level, because of too many debug-messages
|
"-l", "notice", # put down log-level, because of too many debug-messages
|
||||||
|
@ -572,7 +572,7 @@ class Fail2banRegexTest(LogCaptureTestCase):
|
||||||
self.assertLogged('Nov 8 00:16:12 main sshd[32548]: input_userauth_request: invalid user llinco')
|
self.assertLogged('Nov 8 00:16:12 main sshd[32548]: input_userauth_request: invalid user llinco')
|
||||||
self.assertLogged('Nov 8 00:16:12 main sshd[32547]: pam_succeed_if(sshd:auth): error retrieving information about user llinco')
|
self.assertLogged('Nov 8 00:16:12 main sshd[32547]: pam_succeed_if(sshd:auth): error retrieving information about user llinco')
|
||||||
|
|
||||||
def testWronCharDebuggex(self):
|
def testWrongCharDebuggex(self):
|
||||||
unittest.F2B.SkipIfCfgMissing(stock=True)
|
unittest.F2B.SkipIfCfgMissing(stock=True)
|
||||||
self.assertTrue(_test_exec(
|
self.assertTrue(_test_exec(
|
||||||
"-l", "notice", # put down log-level, because of too many debug-messages
|
"-l", "notice", # put down log-level, because of too many debug-messages
|
||||||
|
|
|
@ -4,7 +4,7 @@ Apache Auth.
|
||||||
This directory contains the configuration file of Apache's Web Server to
|
This directory contains the configuration file of Apache's Web Server to
|
||||||
simulate authentication files.
|
simulate authentication files.
|
||||||
|
|
||||||
These assumed that /var/www/html is the web root and AllowOverides is "All".
|
These assumed that /var/www/html is the web root and AllowOverrides is "All".
|
||||||
|
|
||||||
The subdirectories here are copied to the /var/www/html directory.
|
The subdirectories here are copied to the /var/www/html directory.
|
||||||
|
|
||||||
|
|
|
@ -1521,7 +1521,7 @@ def get_monitor_failures_journal_testcase(Filter_): # pragma: systemd no cover
|
||||||
@with_alt_time
|
@with_alt_time
|
||||||
def test_grow_file_with_db(self):
|
def test_grow_file_with_db(self):
|
||||||
|
|
||||||
def _gen_falure(ip):
|
def _gen_failure(ip):
|
||||||
# insert new failures ans check it is monitored:
|
# insert new failures ans check it is monitored:
|
||||||
fields = self.journal_fields
|
fields = self.journal_fields
|
||||||
fields.update(TEST_JOURNAL_FIELDS)
|
fields.update(TEST_JOURNAL_FIELDS)
|
||||||
|
@ -1547,7 +1547,7 @@ def get_monitor_failures_journal_testcase(Filter_): # pragma: systemd no cover
|
||||||
self.filter.start()
|
self.filter.start()
|
||||||
self.waitForTicks(2)
|
self.waitForTicks(2)
|
||||||
# check new IP but no old IPs found:
|
# check new IP but no old IPs found:
|
||||||
_gen_falure("192.0.2.5")
|
_gen_failure("192.0.2.5")
|
||||||
self.assertFalse(self.jail.getFailTicket())
|
self.assertFalse(self.jail.getFailTicket())
|
||||||
|
|
||||||
# now the same with increased time (check now - findtime case):
|
# now the same with increased time (check now - findtime case):
|
||||||
|
@ -1561,7 +1561,7 @@ def get_monitor_failures_journal_testcase(Filter_): # pragma: systemd no cover
|
||||||
self.waitForTicks(2)
|
self.waitForTicks(2)
|
||||||
MyTime.setTime(time.time() + 20)
|
MyTime.setTime(time.time() + 20)
|
||||||
# check new IP but no old IPs found:
|
# check new IP but no old IPs found:
|
||||||
_gen_falure("192.0.2.6")
|
_gen_failure("192.0.2.6")
|
||||||
self.assertFalse(self.jail.getFailTicket())
|
self.assertFalse(self.jail.getFailTicket())
|
||||||
|
|
||||||
# now reset DB, so we'd find all messages before filter entering in operation mode:
|
# now reset DB, so we'd find all messages before filter entering in operation mode:
|
||||||
|
|
Loading…
Reference in New Issue