diff --git a/.codespellrc b/.codespellrc index 9ff01cdc..44a5bb83 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,6 +1,6 @@ [codespell] # THANKS - names -skip = .git,*.pdf,*.svg,venv,.codespellrc,THANKS,*test*.log,logs +skip = .git,*.pdf,*.svg,venv,.codespellrc,.typos.toml,THANKS,*test*.log,logs check-hidden = true # Ignore all acronyms etc as plenty e.g. in fail2ban/server/strptime.py # Try to identify incomplete words which are part of a regex, hence having [] at the beginning diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 00000000..f7ef8ae1 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,35 @@ +[files] +extend-exclude = [ + ".git/", + ".codespellrc", + "fail2ban/tests/files/logs/", +] +ignore-hidden = false + +[default] +extend-ignore-re = [ + "Christoph Theis", + "\\[[0-9a-f]{7,8}\\]", + "hash_[0-9a-f]{38}", + "\t[0-9.-]+[ A-Z]+", + "Erreur d'authentification", + "WebEMailExtrac", + "ssh2: RSA 14:ba:xx", + "\\[Cc\\]lient", + "\\[Gg\\]ot", + "\\[nN\\]ot", + "\\[Uu\\]nknown", + "\\[uU\\]ser", + "\\[Uu\\]\\(\\?:ser", +] + +[default.extend-words] +"alls" = "alls" +"helo" = "helo" + +[default.extend-identifiers] +"failManager2nd" = "failManager2nd" +"log2nd" = "log2nd" +"routeros" = "routeros" +"REFERERS" = "REFERERS" +"tre_search" = "tre_search" diff --git a/ChangeLog b/ChangeLog index 0e4790a3..62f2ee7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2633,7 +2633,7 @@ ver. 0.3.1 (2005/03/31) - 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 - Removed `sshd.py` because it is no more needed - Fixed a bug when exiting with IP in the ban list diff --git a/config/action.d/complain.conf b/config/action.d/complain.conf index 4d73b058..3e135efc 100644 --- a/config/action.d/complain.conf +++ b/config/action.d/complain.conf @@ -16,7 +16,7 @@ # # Please do not use this action unless you are certain that fail2ban # 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 # of administration personnel responsible for handling (verified) legit # complains. diff --git a/config/action.d/ipthreat.conf b/config/action.d/ipthreat.conf index 5a14fa3d..1672ecb6 100644 --- a/config/action.d/ipthreat.conf +++ b/config/action.d/ipthreat.conf @@ -15,7 +15,7 @@ # Reporting an IP is a serious action. Make sure that it is legit. # Consider using this action only for: # * 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 # # Example: diff --git a/fail2ban/client/configreader.py b/fail2ban/client/configreader.py index 6b65e71a..71dce228 100644 --- a/fail2ban/client/configreader.py +++ b/fail2ban/client/configreader.py @@ -406,7 +406,7 @@ class DefinitionInitConfigReader(ConfigReader): if cond: n, cond = cond.groups() ignore.add(n) - # substiture options already specified direct: + # substitute options already specified direct: opts = substituteRecursiveTags(combinedopts, ignore=ignore, addrepl=self.getCombOption) if not opts: diff --git a/fail2ban/client/fail2banregex.py b/fail2ban/client/fail2banregex.py index 0708ba64..3b5ba1c8 100644 --- a/fail2ban/client/fail2banregex.py +++ b/fail2ban/client/fail2banregex.py @@ -106,7 +106,7 @@ usage = lambda: "%s [OPTIONS] [IGNOREREGEX]" % sys.argv[0] class _f2bOptParser(OptionParser): def format_help(self, *args, **kwargs): - """ Overwritten format helper with full ussage.""" + """ Overwritten format helper with full usage.""" self.usage = '' return "Usage: " + usage() + "\n" + __doc__ + """ LOG: diff --git a/fail2ban/server/database.py b/fail2ban/server/database.py index 294164c3..4eba7848 100644 --- a/fail2ban/server/database.py +++ b/fail2ban/server/database.py @@ -725,7 +725,7 @@ class Fail2BanDb(object): failures = 0 tickdata = {} 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) if maxadd > 0: if len(m) <= maxadd: diff --git a/fail2ban/server/jailthread.py b/fail2ban/server/jailthread.py index d87f8ed0..ccb3fe5c 100644 --- a/fail2ban/server/jailthread.py +++ b/fail2ban/server/jailthread.py @@ -114,7 +114,7 @@ class JailThread(Thread): def join(self): """ 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 self.active is not None: diff --git a/fail2ban/tests/actionstestcase.py b/fail2ban/tests/actionstestcase.py index 9c9add65..6a3792ca 100644 --- a/fail2ban/tests/actionstestcase.py +++ b/fail2ban/tests/actionstestcase.py @@ -66,7 +66,7 @@ class ExecuteActions(LogCaptureTestCase): self.__actions.add('test') self.assertTrue(self.__actions['test']) self.assertIn('test', self.__actions) - self.assertNotIn('nonexistant action', self.__actions) + self.assertNotIn('nonexistent action', self.__actions) self.__actions.add('test1') del self.__actions['test'] del self.__actions['test1'] @@ -287,7 +287,7 @@ class ExecuteActions(LogCaptureTestCase): # no flush for inet4 (already successfully flushed): self.assertNotLogged("ERROR", "stdout: %r" % 'ip flush inet4', - 'Unban tickets each individualy', + 'Unban tickets each individually', all=True) def testActionsConsistencyCheckDiffFam(self): @@ -401,7 +401,7 @@ class ExecuteActions(LogCaptureTestCase): # no flush for inet4 (already successfully flushed): self.assertNotLogged("ERROR", "stdout: %r" % 'ip flush inet4', - 'Unban tickets each individualy', + 'Unban tickets each individually', all=True) @with_alt_time diff --git a/fail2ban/tests/clientreadertestcase.py b/fail2ban/tests/clientreadertestcase.py index 02627978..4fdaeca3 100644 --- a/fail2ban/tests/clientreadertestcase.py +++ b/fail2ban/tests/clientreadertestcase.py @@ -564,7 +564,7 @@ class FilterReaderTest(LogCaptureTestCase): self.assertNotEqual(opts['maxlines'], 'X'); # wrong int value 'X' for 'maxlines' 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=']] filterReader = FilterReader('substitution', "jailname", {}, share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR) @@ -584,7 +584,7 @@ class FilterReaderTest(LogCaptureTestCase): opts = filterReader.getCombined() self.assertTrue('sshd' in opts['failregex']) - def testFilterReaderSubstitionSet(self): + def testFilterReaderSubstitutionSet(self): output = [['set', 'jailname', 'addfailregex', 'to=sour@example.com fromip=']] filterReader = FilterReader('substitution', "jailname", {'honeypot': 'sour@example.com'}, share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR) @@ -593,7 +593,7 @@ class FilterReaderTest(LogCaptureTestCase): c = filterReader.convert() self.assertSortedEqual(c, output) - def testFilterReaderSubstitionKnown(self): + def testFilterReaderSubstitutionKnown(self): output = [['set', 'jailname', 'addfailregex', '^to=test,sweet@example.com,test2,sweet@example.com fromip=$']] filterName, filterOpt = extractOptions( 'substitution[failregex="^$", honeypot=",", sweet="test,,test2"]') @@ -604,7 +604,7 @@ class FilterReaderTest(LogCaptureTestCase): c = filterReader.convert() self.assertSortedEqual(c, output) - def testFilterReaderSubstitionSection(self): + def testFilterReaderSubstitutionSection(self): output = [['set', 'jailname', 'addfailregex', '^\\s*to=fail2ban@localhost fromip=\\s*$']] filterName, filterOpt = extractOptions( 'substitution[failregex="^\\s*\\s*$", honeypot=""]') @@ -615,7 +615,7 @@ class FilterReaderTest(LogCaptureTestCase): c = filterReader.convert() self.assertSortedEqual(c, output) - def testFilterReaderSubstitionFail(self): + def testFilterReaderSubstitutionFail(self): # directly subst the same var : filterReader = FilterReader('substitution', "jailname", {'honeypot': ''}, share_config=TEST_FILES_DIR_SHARE_CFG, basedir=TEST_FILES_DIR) diff --git a/fail2ban/tests/datedetectortestcase.py b/fail2ban/tests/datedetectortestcase.py index fc43677a..925cc25b 100644 --- a/fail2ban/tests/datedetectortestcase.py +++ b/fail2ban/tests/datedetectortestcase.py @@ -580,7 +580,7 @@ class CustomDateFormatsTest(unittest.TestCase): else: # pragma: no cover 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.setDefaultPattern("%b %d %H:%M:%S") # diff --git a/fail2ban/tests/fail2banregextestcase.py b/fail2ban/tests/fail2banregextestcase.py index e9877a44..28ec9e30 100644 --- a/fail2ban/tests/fail2banregextestcase.py +++ b/fail2ban/tests/fail2banregextestcase.py @@ -148,7 +148,7 @@ class Fail2banRegexTest(LogCaptureTestCase): self.assertLogged("Unable to compile regular expression") self.assertLogged("unknown group name", "at position 23", all=False); # details of failed compilation - def testWrongIngnoreRE(self): + def testWrongIgnoreRE(self): self.assertFalse(_test_exec( "--datepattern", "{^LN-BEG}EPOCH", "test", r".*? from $", r".**" @@ -581,7 +581,7 @@ class Fail2banRegexTest(LogCaptureTestCase): FILENAME_ZZZ_GEN, FILENAME_ZZZ_GEN )) - def testWronChar(self): + def testWrongChar(self): unittest.F2B.SkipIfCfgMissing(stock=True) self.assertTrue(_test_exec( "-l", "notice", # put down log-level, because of too many debug-messages @@ -596,7 +596,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[32547]: pam_succeed_if(sshd:auth): error retrieving information about user llinco') - def testWronCharDebuggex(self): + def testWrongCharDebuggex(self): unittest.F2B.SkipIfCfgMissing(stock=True) self.assertTrue(_test_exec( "-l", "notice", # put down log-level, because of too many debug-messages diff --git a/fail2ban/tests/files/config/apache-auth/README b/fail2ban/tests/files/config/apache-auth/README index b25a30b2..eed9bd76 100644 --- a/fail2ban/tests/files/config/apache-auth/README +++ b/fail2ban/tests/files/config/apache-auth/README @@ -4,7 +4,7 @@ Apache Auth. This directory contains the configuration file of Apache's Web Server to 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. diff --git a/fail2ban/tests/filtertestcase.py b/fail2ban/tests/filtertestcase.py index 25e58e21..20945b78 100644 --- a/fail2ban/tests/filtertestcase.py +++ b/fail2ban/tests/filtertestcase.py @@ -1521,7 +1521,7 @@ def get_monitor_failures_journal_testcase(Filter_): # pragma: systemd no cover @with_alt_time def test_grow_file_with_db(self): - def _gen_falure(ip): + def _gen_failure(ip): # insert new failures ans check it is monitored: fields = self.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.waitForTicks(2) # 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()) # 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) MyTime.setTime(time.time() + 20) # 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()) # now reset DB, so we'd find all messages before filter entering in operation mode: