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() -