From 29840511dbc46bdac6c34e7841b1c409cc3fe0bf Mon Sep 17 00:00:00 2001 From: lostcontrol Date: Mon, 4 Sep 2006 19:18:57 +0000 Subject: [PATCH] - Moved "logpath" and "maxtime" to "jail.conf" git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@320 a942ae1a-1317-0410-a47c-b1dcaea8d605 --- client/filterreader.py | 17 ++++------------- client/jailreader.py | 10 ++++++++-- config/filter.d/apache-auth.conf | 12 ------------ config/filter.d/couriersmtp.conf | 12 ------------ config/filter.d/sshd.conf | 12 ------------ config/filter.d/vsftpd.conf | 12 ------------ config/jail.conf | 1 + 7 files changed, 13 insertions(+), 63 deletions(-) diff --git a/client/filterreader.py b/client/filterreader.py index 1e2b28a9..f8384d2f 100644 --- a/client/filterreader.py +++ b/client/filterreader.py @@ -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 \ No newline at end of file diff --git a/client/jailreader.py b/client/jailreader.py index 6bd712a2..3483582a 100644 --- a/client/jailreader.py +++ b/client/jailreader.py @@ -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()) diff --git a/config/filter.d/apache-auth.conf b/config/filter.d/apache-auth.conf index 3bd2c0f8..479f3ae8 100644 --- a/config/filter.d/apache-auth.conf +++ b/config/filter.d/apache-auth.conf @@ -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} diff --git a/config/filter.d/couriersmtp.conf b/config/filter.d/couriersmtp.conf index ec35528b..4b54bca3 100644 --- a/config/filter.d/couriersmtp.conf +++ b/config/filter.d/couriersmtp.conf @@ -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} diff --git a/config/filter.d/sshd.conf b/config/filter.d/sshd.conf index 67870017..bfa2306f 100644 --- a/config/filter.d/sshd.conf +++ b/config/filter.d/sshd.conf @@ -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} diff --git a/config/filter.d/vsftpd.conf b/config/filter.d/vsftpd.conf index 1d759b41..d35f9279 100644 --- a/config/filter.d/vsftpd.conf +++ b/config/filter.d/vsftpd.conf @@ -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] diff --git a/config/jail.conf b/config/jail.conf index c8b94c0b..dab9d671 100644 --- a/config/jail.conf +++ b/config/jail.conf @@ -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