mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-08-27 03:46:05 +00:00
- 0.7.0 soon
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@251 a942ae1a-1317-0410-a47c-b1dcaea8d605
This commit is contained in:
parent
12c222bd1c
commit
7048e19995
18 changed files with 276 additions and 63 deletions
|
|
@ -32,9 +32,10 @@ logSys = logging.getLogger("fail2ban.client.config")
|
|||
|
||||
class ActionReader(ConfigReader):
|
||||
|
||||
def __init__(self, file, name):
|
||||
def __init__(self, action, name):
|
||||
ConfigReader.__init__(self)
|
||||
self.file = file
|
||||
self.file = action[0]
|
||||
self.cInfo = action[1]
|
||||
self.name = name
|
||||
|
||||
def setFile(self, file):
|
||||
|
|
@ -58,7 +59,12 @@ class ActionReader(ConfigReader):
|
|||
["string", "actioncheck", ""],
|
||||
["string", "actionban", ""],
|
||||
["string", "actionunban", ""]]
|
||||
self.opts = ConfigReader.getOptions(self, "DEFAULT", opts, pOpts)
|
||||
self.opts = ConfigReader.getOptions(self, "Definition", opts, pOpts)
|
||||
|
||||
if self.has_section("Init"):
|
||||
for opt in self.options("Init"):
|
||||
if not self.cInfo.has_key(opt):
|
||||
self.cInfo[opt] = self.get("Init", opt)
|
||||
|
||||
def convert(self):
|
||||
head = ["set", self.name]
|
||||
|
|
@ -75,5 +81,10 @@ class ActionReader(ConfigReader):
|
|||
stream.append(head + ["actionban", self.file, self.opts[opt]])
|
||||
elif opt == "actionunban":
|
||||
stream.append(head + ["actionunban", self.file, self.opts[opt]])
|
||||
# cInfo
|
||||
if self.cInfo:
|
||||
for p in self.cInfo:
|
||||
stream.append(head + ["setcinfo", self.file, p, self.cInfo[p]])
|
||||
|
||||
return stream
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue