mirror of https://github.com/fail2ban/fail2ban
ENH: Default maxlines value in jail.conf, and verify value is int >0
parent
be0e8faa4e
commit
183cfa6e00
|
@ -136,13 +136,7 @@ class Fail2banRegex:
|
|||
elif opt[0] in ["-v", "--verbose"]:
|
||||
self.__verbose = True
|
||||
elif opt[0] in ["-l", "--maxlines"]:
|
||||
try:
|
||||
self.__filter.setMaxLines(int(opt[1]))
|
||||
except ValueError:
|
||||
print "Invlaid value for maxlines: %s" % (
|
||||
opt[1])
|
||||
fail2banRegex.dispUsage()
|
||||
sys.exit(-1)
|
||||
self.__filter.setMaxLines(opt[1])
|
||||
|
||||
#@staticmethod
|
||||
def logIsFile(value):
|
||||
|
|
|
@ -32,6 +32,9 @@ findtime = 600
|
|||
# "maxretry" is the number of failures before a host get banned.
|
||||
maxretry = 3
|
||||
|
||||
# "maxlines" is number of log lines to buffer for multi-line regex searches
|
||||
maxlines = 1
|
||||
|
||||
# "backend" specifies the backend used to get files modification.
|
||||
# Available options are "pyinotify", "gamin", "polling" and "auto".
|
||||
# This option can be overridden in each jail as well.
|
||||
|
|
|
@ -218,8 +218,10 @@ class Filter(JailThread):
|
|||
# @param value the line buffer size
|
||||
|
||||
def setMaxLines(self, value):
|
||||
self.__lineBufferSize = max(1, value)
|
||||
logSys.info("Set maxLines = %i" % self.__lineBufferSize)
|
||||
if int(value) <= 0:
|
||||
raise ValueError("maxlines must be integer greater than zero")
|
||||
self.__lineBufferSize = int(value)
|
||||
logSys.info("Set maxlines = %i" % self.__lineBufferSize)
|
||||
|
||||
##
|
||||
# Get the maximum line buffer size.
|
||||
|
|
Loading…
Reference in New Issue