- Added a "reload" option which reload the configuration

- Added "stop all" which stop all jails but do not exit

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@277 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.x
Cyril Jaquier 19 years ago
parent 2455cb4f8a
commit 64ddab56c8

@ -131,6 +131,14 @@ class Fail2banClient:
except ServerExecutionException:
logSys.error("Could not start server. Try -x option")
return False
elif cmd[0] == "reload" and len(cmd) == 1:
if self.ping():
self.readConfig()
self.processCmd(['stop', 'all'])
# Configure the server
self.processCmd(self.stream)
else:
logSys.error("Could not find server")
else:
return self.processCmd([cmd])

@ -47,8 +47,7 @@ class Server:
self.transm.start(force)
def quit(self):
for jail in self.jails.copy():
self.stopJail(jail)
self.stopAllJail()
self.transm.stop()
def addJail(self, name):
@ -74,6 +73,10 @@ class Server:
else:
raise ServerUnknownJail(name)
def stopAllJail(self):
for jail in self.jails.copy():
self.stopJail(jail)
def isActive(self, name):
if self.jails.has_key(name):
return self.jails[name].isActive()

@ -75,6 +75,8 @@ class Transmitter:
return "pong"
elif action[0] == "add":
name = action[1]
if name == "all":
raise Exception("Reserved name")
self.server.addJail(name)
return name
elif action[0] == "start":
@ -84,6 +86,8 @@ class Transmitter:
elif action[0] == "stop":
if len(action) == 1:
self.server.quit()
elif action[1] == "all":
self.server.stopAllJail()
else:
name = action[1]
self.server.stopJail(name)

Loading…
Cancel
Save