From 817d3682bcb864f7cc3be7a57f40a76a21fbce15 Mon Sep 17 00:00:00 2001 From: pauget Date: Sun, 17 Oct 2004 16:22:48 +0200 Subject: [PATCH] Gnration du fichier blacklist.cf darcs-hash:20041017142248-41617-a9fb9ec1792e0480ac42c19e54ff09d7ba1f6173.gz --- gestion/gen_confs/firewall.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gestion/gen_confs/firewall.py b/gestion/gen_confs/firewall.py index eeb3ec1e..6a0d0ffe 100755 --- a/gestion/gen_confs/firewall.py +++ b/gestion/gen_confs/firewall.py @@ -8,6 +8,7 @@ Licence : GPLv2 """ from gen_confs import gen_config +from ldap_crans import crans_ldap from time import localtime class firewall(gen_config) : @@ -33,7 +34,7 @@ class firewall(gen_config) : class bl_upload_fw(gen_config) : """ Génère le fichier de blackliste d'upload pour le firewall""" # Fichier - BL_UPLOAD = '/tmp/bl_upload_fw' + BL_UPLOAD = '/CRANS/confs/blacklist.cf' restart_cmd = '/etc/init.d/firewall blacklist' @@ -41,15 +42,15 @@ class bl_upload_fw(gen_config) : return "blackliste upload firewall" def _gen(self) : + db = crans_ldap() upload = self._open_conf( self.BL_UPLOAD, '#' ) - - base = self.base.search('paiement=ok') - for adh in ( [ self.crans ] + base['adherent'] + base['club'] ): + base = db.search('paiement=ok&blacklist=*upload*') + liste = base['adherent'] + base['club'] + self.anim.iter=len(liste) + for adh in liste : + self.anim.cycle() for machine in adh.machines() : - self.anim.cycle() bl = machine.blacklist_actif() - if 'bl_upload' in bl and not 'bloq' in bl : + if 'upload' in bl and not 'bloq' in bl : upload.write( '%s:smtp,smtps,pop3,pop3s,imap,imaps,http\n' % machine.nom() ) - upload.close() -