- Moved "logpath" and "maxtime" to "jail.conf"

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@320 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.x
Cyril Jaquier 18 years ago
parent 761d50610e
commit f1f12518c8

@ -53,28 +53,19 @@ class FilterReader(ConfigReader):
ConfigReader.read(self, "filter.d/" + self.file)
def getOptions(self, pOpts):
opts = [["string", "logpath", "/var/log/sshd.log"],
["string", "timeregex", ""],
opts = [["string", "timeregex", ""],
["string", "timepattern", ""],
["string", "failregex", ""],
["int", "maxtime", 600],
["int", "maxretry", 3]]
["string", "failregex", ""]]
self.opts = ConfigReader.getOptions(self, "Definition", opts, pOpts)
def convert(self):
stream = list()
for opt in self.opts:
if opt == "logpath":
stream.append(["set", self.name, "logpath", self.opts[opt]])
elif opt == "timeregex":
if opt == "timeregex":
stream.append(["set", self.name, "timeregex", self.opts[opt]])
elif opt == "timepattern":
stream.append(["set", self.name, "timepattern", self.opts[opt]])
elif opt == "failregex":
stream.append(["set", self.name, "failregex", self.opts[opt]])
elif opt == "maxtime":
stream.append(["set", self.name, "maxtime", self.opts[opt]])
elif opt == "maxretry":
stream.append(["set", self.name, "maxretry", self.opts[opt]])
stream.append(["set", self.name, "failregex", self.opts[opt]])
return stream

@ -56,7 +56,9 @@ class JailReader(ConfigReader):
def getOptions(self):
opts = [["bool", "enabled", "false"],
["int", "maxretry", None],
["string", "logpath", "/var/log/messages"],
["int", "maxretry", 3],
["int", "maxtime", 600],
["int", "bantime", 600],
["string", "filter", ""],
["string", "action", ""]]
@ -83,8 +85,12 @@ class JailReader(ConfigReader):
def convert(self):
stream = [["add", self.name]]
for opt in self.opts:
if opt == "maxretry":
if opt == "logpath":
stream.append(["set", self.name, "logpath", self.opts[opt]])
elif opt == "maxretry":
stream.append(["set", self.name, "maxretry", self.opts[opt]])
elif opt == "maxtime":
stream.append(["set", self.name, "maxtime", self.opts[opt]])
elif opt == "bantime":
stream.append(["set", self.name, "bantime", self.opts[opt]])
stream.extend(self.filter.convert())

@ -7,18 +7,6 @@
[Definition]
# Option: maxretry
# Notes.: number of failures before IP gets banned.
# Values: NUM Default: 5
#
maxretry = 5
# Option: logfile
# Notes.: logfile to monitor.
# Values: FILE Default: /var/log/httpd/access_log
#
logfile = /var/log/httpd/access_log
# Option: timeregex
# Notes.: regex to match timestamp in Apache logfile. For TAI64N format,
# use timeregex = @[0-9a-f]{24}

@ -7,18 +7,6 @@
[Definition]
# Option: maxretry
# Notes.: number of failures before IP gets banned.
# Values: NUM Default: 5
#
maxretry = 5
# Option: logpath
# Notes.: logfile to monitor.
# Values: FILE Default: /var/log/messages
#
logpath = /var/log/messages
# Option: timeregex
# Notes.: regex to match timestamp in the logfile. For TAI64N format,
# use timeregex = @[0-9a-f]{24}

@ -7,18 +7,6 @@
[Definition]
# Option: maxretry
# Notes.: number of failures before IP gets banned.
# Values: NUM Default: 5
#
maxretry = 5
# Option: logpath
# Notes.: logfile to monitor.
# Values: FILE Default: /var/log/secure
#
logpath = /var/log/secure
# Option: timeregex
# Notes.: regex to match timestamp in SSH logfile. For TAI64N format,
# use timeregex = @[0-9a-f]{24}

@ -7,18 +7,6 @@
[Definition]
# Option: maxretry
# Notes.: number of failures before IP gets banned.
# Values: NUM Default: 5
#
maxretry = 5
# Option: logfile
# Notes.: logfile to monitor.
# Values: FILE Default: /var/log/vsftpd.log
#
logfile = /var/log/vsftpd.log
# Option: timeregex
# Notes.: regex to match timestamp in VSFTPD logfile.
# Values: [Mar 7 17:53:28]

@ -11,5 +11,6 @@ enabled = false
filter = sshd
action = hostsdeny[file=/tmp/hosts.deny]
mail[name=SSH, dest=cyril.jaquier@bluewin.ch]
logpath = /home/cyril/workspace/fail2ban-unstable/testcases/files/testcase01.log
maxretry = 2
bantime = 10

Loading…
Cancel
Save