[firewall4] Methode pour recharger une "chaine"
This commit is contained in:
parent
c5e45fea98
commit
5e8c54a0fc
1 changed files with 24 additions and 22 deletions
|
@ -178,6 +178,25 @@ class firewall_base(object) :
|
||||||
str += 'COMMIT\n'
|
str += 'COMMIT\n'
|
||||||
return str
|
return str
|
||||||
|
|
||||||
|
def reload(self, func_name):
|
||||||
|
if squeeze and self.reloadable[func_name] in self.use_ipset:
|
||||||
|
anim('\tVidage de %s' % self.reloadable[func_name]())
|
||||||
|
for table in ['raw', 'mangle', 'filter', 'nat']:
|
||||||
|
self.flush(table, self.reloadable[func_name]())
|
||||||
|
self.restore(noflush=True)
|
||||||
|
print OK
|
||||||
|
|
||||||
|
for table in ['raw', 'mangle', 'filter', 'nat']:
|
||||||
|
self.reloadable[func_name](table)
|
||||||
|
if self.reloadable[func_name] in self.use_ipset:
|
||||||
|
self.reloadable[func_name](fill_ipset=True)
|
||||||
|
if self.reloadable[func_name] in self.use_tc:
|
||||||
|
self.reloadable[func_name](run_tc=True)
|
||||||
|
|
||||||
|
anim('\tRestoration d\'iptables')
|
||||||
|
self.restore(noflush=True)
|
||||||
|
print OK
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
global conn
|
global conn
|
||||||
#initialisation des structures communes : récupération des ipset
|
#initialisation des structures communes : récupération des ipset
|
||||||
|
@ -237,7 +256,7 @@ class firewall_base(object) :
|
||||||
|
|
||||||
if squeeze:
|
if squeeze:
|
||||||
anim('\tVidage du pare-feu')
|
anim('\tVidage du pare-feu')
|
||||||
fw.restore()
|
self.restore()
|
||||||
print OK
|
print OK
|
||||||
|
|
||||||
self.raw_table()
|
self.raw_table()
|
||||||
|
@ -246,14 +265,14 @@ class firewall_base(object) :
|
||||||
self.nat_table()
|
self.nat_table()
|
||||||
|
|
||||||
anim('\tRestoration d\'iptables')
|
anim('\tRestoration d\'iptables')
|
||||||
fw.restore()
|
self.restore()
|
||||||
print OK
|
print OK
|
||||||
return
|
return
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
"""Vide les règles du pare-feu"""
|
"""Vide les règles du pare-feu"""
|
||||||
fw.delete()
|
self.delete()
|
||||||
fw.restore()
|
self.restore()
|
||||||
return
|
return
|
||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
|
@ -1199,21 +1218,4 @@ Pour reconfiguration d'IPs particulières, utiliser generate. """ % \
|
||||||
elif arg == 'restart':
|
elif arg == 'restart':
|
||||||
fw.restart()
|
fw.restart()
|
||||||
else:
|
else:
|
||||||
|
fw.reload(arg)
|
||||||
if squeeze:
|
|
||||||
anim('\tVidage de %s' % fw.reloadable[arg]())
|
|
||||||
for table in ['raw', 'mangle', 'filter', 'nat']:
|
|
||||||
fw.flush(table, fw.reloadable[arg]())
|
|
||||||
fw.restore(noflush=True)
|
|
||||||
print OK
|
|
||||||
|
|
||||||
for table in ['raw', 'mangle', 'filter', 'nat']:
|
|
||||||
fw.reloadable[arg](table)
|
|
||||||
if fw.reloadable[arg] in fw.use_ipset:
|
|
||||||
fw.reloadable[arg](fill_ipset=True)
|
|
||||||
if fw.reloadable[arg] in fw.use_tc:
|
|
||||||
fw.reloadable[arg](run_tc=True)
|
|
||||||
|
|
||||||
anim('\tRestoration d\'iptables')
|
|
||||||
fw.restore(noflush=True)
|
|
||||||
print OK
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue