From ef2c02a99a42092702d11d8828df7329f94df958 Mon Sep 17 00:00:00 2001 From: segaud Date: Tue, 17 May 2005 11:15:19 +0200 Subject: [PATCH] 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 --- gestion/gen_confs/firewall_crans.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/gestion/gen_confs/firewall_crans.py b/gestion/gen_confs/firewall_crans.py index 394c9b66..53aed0b7 100755 --- a/gestion/gen_confs/firewall_crans.py +++ b/gestion/gen_confs/firewall_crans.py @@ -135,10 +135,26 @@ class firewall_crans : remove_lock('firewall') def nat_table(self) : - print 'bla' + self.anim = anim(' Structure de la table nat') + 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) : + self.anim = anim(' Structure de la table filter') + print OK + + def filter_table_tweaks(self) : return def start_fw_funcs(self) : @@ -177,10 +193,10 @@ class firewall_crans : cprint(" -> fin de la procédure de démarrage",'vert') def __start(self) : - self.anim = anim(' Structure de la table nat') self.nat_table() - self.anim = anim(' Structure de la table filter') + self.nat_table_tweaks() self.filter_table() + self.filter_table_tweaks def reseaux_non_routables(self) : """ Construction de RESEAUX_NON_ROUTABLES_{DST,SRC} """