Le code de la mac ip est dans la classe firewall_crans.
plus de factorisation, pour viter les choses trop bancales... les specificites de chaque machine sont a mettre dans les methodes nat_table_tweaks et filter_table_tweaks. TODO: mettre le code de la blacklist dans firewall_crans darcs-hash:20050517091519-f163d-44fcc1bb361adc2745bd3bea0c7cec4b25261943.gz
This commit is contained in:
parent
82062f5ff2
commit
ef2c02a99a
1 changed files with 20 additions and 4 deletions
|
@ -135,10 +135,26 @@ class firewall_crans :
|
||||||
remove_lock('firewall')
|
remove_lock('firewall')
|
||||||
|
|
||||||
def nat_table(self) :
|
def nat_table(self) :
|
||||||
print 'bla'
|
self.anim = anim(' Structure de la table nat')
|
||||||
return
|
for chaine in [ 'TEST_MAC-IP', 'RESEAUX_NON_ROUTABLES_SRC', 'RESEAUX_NON_ROUTABLES_DST' ] :
|
||||||
|
iptables('-t nat -N %s' % chaine)
|
||||||
|
|
||||||
|
iptables("-t nat -P PREROUTING -j ACCEPT")
|
||||||
|
iptables("-t nat -A PREROUTING -i lo -j ACCEPT")
|
||||||
|
iptables("-t nat -A PREROUTING -d 224.0.0.0/4 -j DROP")
|
||||||
|
iptables("-t nat -A PREROUTING -j RESEAUX_NON_ROUTABLES_DST")
|
||||||
|
iptables("-t nat -A PREROUTING -j RESEAUX_NON_ROUTABLES_SRC")
|
||||||
|
iptables("-t nat -A PREROUTING -j TEST_MAC-IP")
|
||||||
|
iptables("-t nat -P PREROUTING DROP")
|
||||||
|
print OK
|
||||||
|
|
||||||
|
def nat_table_tweaks(self) :
|
||||||
|
return
|
||||||
def filter_table(self) :
|
def filter_table(self) :
|
||||||
|
self.anim = anim(' Structure de la table filter')
|
||||||
|
print OK
|
||||||
|
|
||||||
|
def filter_table_tweaks(self) :
|
||||||
return
|
return
|
||||||
|
|
||||||
def start_fw_funcs(self) :
|
def start_fw_funcs(self) :
|
||||||
|
@ -177,10 +193,10 @@ class firewall_crans :
|
||||||
cprint(" -> fin de la procédure de démarrage",'vert')
|
cprint(" -> fin de la procédure de démarrage",'vert')
|
||||||
|
|
||||||
def __start(self) :
|
def __start(self) :
|
||||||
self.anim = anim(' Structure de la table nat')
|
|
||||||
self.nat_table()
|
self.nat_table()
|
||||||
self.anim = anim(' Structure de la table filter')
|
self.nat_table_tweaks()
|
||||||
self.filter_table()
|
self.filter_table()
|
||||||
|
self.filter_table_tweaks
|
||||||
|
|
||||||
def reseaux_non_routables(self) :
|
def reseaux_non_routables(self) :
|
||||||
""" Construction de RESEAUX_NON_ROUTABLES_{DST,SRC} """
|
""" Construction de RESEAUX_NON_ROUTABLES_{DST,SRC} """
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue