Skip to content

Commit

Permalink
Merge pull request #2027 from yarikoptic/bf-0.10-review
Browse files Browse the repository at this point in the history
Minor spelling typos etc
  • Loading branch information
sebres committed Jan 23, 2018
2 parents 8cfd97a + 527bb9a commit 3ac6166
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion bin/fail2ban-server
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Fail2Ban reads log file that contains password failure report
and bans the corresponding IP addresses using firewall rules.
This tools starts/stops fail2ban server or does client/server communication,
This tool starts/stops fail2ban server or does client/server communication
to change/read parameters of the server or jails.
"""
Expand Down
2 changes: 1 addition & 1 deletion bin/fail2ban-testcases
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import time
import unittest

# Check if local fail2ban module exists, and use if it exists by
# modifying the path. This is such that tests can be used in dev
# modifying the path. This is done so that tests can be used in dev
# environment.
if os.path.exists("fail2ban/__init__.py"):
sys.path.insert(0, ".")
Expand Down
32 changes: 16 additions & 16 deletions config/action.d/helpers-common.conf
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[DEFAULT]
# Usage:
# _grep_logs_args = 'test'
# (printf %%b "Log-excerpt contains 'test':\n"; %(_grep_logs)s; printf %%b "Log-excerpt contains 'test':\n") | mail ...
#
_grep_logs = logpath="<logpath>"; grep <grepopts> -E %(_grep_logs_args)s $logpath | <greplimit>
_grep_logs_args = "(^|[^0-9a-fA-F:])$(echo '<ip>' | sed 's/\./\\./g')([^0-9a-fA-F:]|$)"
# Used for actions, that should not by executed if ticket was restored:
_bypass_if_restored = if [ '<restored>' = '1' ]; then exit 0; fi;
[Init]
greplimit = tail -n <grepmax>
grepmax = 1000
grepopts = -m <grepmax>
[DEFAULT]

# Usage:
# _grep_logs_args = 'test'
# (printf %%b "Log-excerpt contains 'test':\n"; %(_grep_logs)s; printf %%b "Log-excerpt contains 'test':\n") | mail ...
#
_grep_logs = logpath="<logpath>"; grep <grepopts> -E %(_grep_logs_args)s $logpath | <greplimit>
_grep_logs_args = "(^|[^0-9a-fA-F:])$(echo '<ip>' | sed 's/\./\\./g')([^0-9a-fA-F:]|$)"

# Used for actions, that should not by executed if ticket was restored:
_bypass_if_restored = if [ '<restored>' = '1' ]; then exit 0; fi;

[Init]
greplimit = tail -n <grepmax>
grepmax = 1000
grepopts = -m <grepmax>
2 changes: 1 addition & 1 deletion fail2ban/client/configparserinc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Author: Yaroslav Halchenko
# Modified: Cyril Jaquier

__author__ = 'Yaroslav Halhenko, Serg G. Brester (aka sebres)'
__author__ = 'Yaroslav Halchenko, Serg G. Brester (aka sebres)'
__copyright__ = 'Copyright (c) 2007 Yaroslav Halchenko, 2015 Serg G. Brester (aka sebres)'
__license__ = 'GPL'

Expand Down
2 changes: 1 addition & 1 deletion fail2ban/client/fail2banregex.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def __getitem__(self, key):
class Fail2banRegex(object):

def __init__(self, opts):
# set local protected memebers from given options:
# set local protected members from given options:
self.__dict__.update(dict(('_'+o,v) for o,v in opts.__dict__.iteritems()))
self._maxlines_set = False # so we allow to override maxlines in cmdline
self._datepattern_set = False
Expand Down
4 changes: 2 additions & 2 deletions fail2ban/client/fail2banserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ def startServerAsync(conf):
def getServerPath():
startdir = sys.path[0]
exe = os.path.abspath(os.path.join(startdir, SERVER))
if not os.path.isfile(exe): # may be uresolved in test-cases, so get relative starter (client):
if not os.path.isfile(exe): # may be unresolved in test-cases, so get relative starter (client):
startdir = os.path.dirname(sys.argv[0])
exe = os.path.abspath(os.path.join(startdir, SERVER))
if not os.path.isfile(exe): # may be uresolved in test-cases, so try to get relative bin-directory:
if not os.path.isfile(exe): # may be unresolved in test-cases, so try to get relative bin-directory:
startdir = os.path.dirname(os.path.abspath(__file__))
startdir = os.path.join(os.path.dirname(os.path.dirname(startdir)), "bin")
exe = os.path.abspath(os.path.join(startdir, SERVER))
Expand Down
2 changes: 1 addition & 1 deletion fail2ban/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


PREFER_ENC = locale.getpreferredencoding()
# correct prefered encoding if lang not set in environment:
# correct preferred encoding if lang not set in environment:
if PREFER_ENC.startswith('ANSI_'): # pragma: no cover
if all((os.getenv(v) in (None, "") for v in ('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG'))):
PREFER_ENC = 'UTF-8';
Expand Down
12 changes: 6 additions & 6 deletions fail2ban/server/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def __subclasshook__(cls, C):

def __setattr__(self, name, value):
if not name.startswith('_') and not self.__init and not callable(value):
# special case for some pasrameters:
# special case for some parameters:
if name in ('timeout', 'bantime'):
value = str(MyTime.str2seconds(value))
# parameters changed - clear properties and substitution cache:
Expand All @@ -337,7 +337,7 @@ def __delattr__(self, name):
def _properties(self):
"""A dictionary of the actions properties.
This is used to subsitute "tags" in the commands.
This is used to substitute "tags" in the commands.
"""
# if we have a properties - return it:
if self.__properties is not None:
Expand Down Expand Up @@ -383,7 +383,7 @@ def _executeOperation(self, tag, operation, family=[]):
except ValueError as e:
raise RuntimeError("Error %s action %s/%s: %r" % (operation, self._jail, self._name, e))

COND_FAMILIES = {'inet4':1, 'inet6':1}
COND_FAMILIES = ('inet4', 'inet6')

@property
def _startOnDemand(self):
Expand Down Expand Up @@ -460,13 +460,13 @@ def flush(self):
"""Executes the "actionflush" command.
Command executed in order to flush all bans at once (e. g. by stop/shutdown
the system), instead of unbunning of each single ticket.
the system), instead of unbanning of each single ticket.
Replaces the tags in the action command with actions properties
and executes the resulting command.
"""
family = []
# cumulate started families, if started on demand (conditional):
# collect started families, if started on demand (conditional):
if self._startOnDemand:
for f in CommandAction.COND_FAMILIES:
if self.__started.get(f) == 1: # only real started:
Expand All @@ -482,7 +482,7 @@ def stop(self):
and executes the resulting command.
"""
family = []
# cumulate started families, if started on demand (conditional):
# collect started families, if started on demand (conditional):
if self._startOnDemand:
for f in CommandAction.COND_FAMILIES:
if self.__started.get(f) == 1: # only real started:
Expand Down
2 changes: 1 addition & 1 deletion fail2ban/server/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def __checkBan(self):
diftm = ticket.getTime() - bTicket.getTime()
# log already banned with following level:
# DEBUG - before 3 seconds - certain interval for it, because of possible latency by recognizing in backends, etc.
# NOTICE - before 60 seconds - may still occurre if action are slow, or very high load in backend,
# NOTICE - before 60 seconds - may still occur if action is slow, or very high load in backend,
# WARNING - after 60 seconds - very long time, something may be wrong
ll = logging.DEBUG if diftm < 3 \
else logging.NOTICE if diftm < 60 \
Expand Down
6 changes: 3 additions & 3 deletions fail2ban/server/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,11 +927,11 @@ def getFailures(self, filename):
if e.errno != 2: # errno.ENOENT
logSys.exception(e)
return False
except OSError as e: # pragma: no cover - requires race condition to tigger this
except OSError as e: # pragma: no cover - requires race condition to trigger this
logSys.error("Error opening %s", filename)
logSys.exception(e)
return False
except Exception as e: # pragma: no cover - Requires implemention error in FileContainer to generate
except Exception as e: # pragma: no cover - Requires implementation error in FileContainer to generate
logSys.error("Internal error in FileContainer open method - please report as a bug to https://github.com/fail2ban/fail2ban/issues")
logSys.exception(e)
return False
Expand Down Expand Up @@ -1039,7 +1039,7 @@ def seekToTime(self, container, date, accuracy=3):
movecntr -= 1
if movecntr <= 0:
break
# we have found large area without any date mached
# we have found large area without any date matched
# or end of search - try min position (because can be end of previous line):
if minp != lastPos:
lastPos = tryPos = minp
Expand Down
2 changes: 1 addition & 1 deletion fail2ban/server/filterpoll.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def isModified(self, filename):
self.__prevStats[filename] = stats
return True
except Exception as e:
# stil alive (may be deleted because multi-threaded):
# still alive (may be deleted because multi-threaded):
if not self.getLog(filename) or self.__prevStats.get(filename) is None:
logSys.warning("Log %r seems to be down: %s", filename, e)
return False
Expand Down
2 changes: 1 addition & 1 deletion fail2ban/tests/config/filter.d/test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ where = conf
failregex = failure <_daemon> <one> (filter.d/test.%(where)s) <HOST>

[Init]
# test parameter, should be overriden in jail by "filter=test[one=1,...]"
# test parameter, should be overridden in jail by "filter=test[one=1,...]"
one = *1*

0 comments on commit 3ac6166

Please sign in to comment.