From 7c5cede32fd1bae789abf4b7b3283a253d555bf4 Mon Sep 17 00:00:00 2001 From: bernat Date: Thu, 28 Oct 2004 10:48:30 +0200 Subject: [PATCH] On donne les dates, on donne aussi les anciens blacklists darcs-hash:20041028084830-d1718-f42c801b49dea2bb25952ebc5f770f7052364f14.gz --- gestion/gen_confs/firewall.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/gestion/gen_confs/firewall.py b/gestion/gen_confs/firewall.py index 6a0d0ffe..70ff9ac4 100755 --- a/gestion/gen_confs/firewall.py +++ b/gestion/gen_confs/firewall.py @@ -36,7 +36,7 @@ class bl_upload_fw(gen_config) : # Fichier BL_UPLOAD = '/CRANS/confs/blacklist.cf' - restart_cmd = '/etc/init.d/firewall blacklist' + restart_cmd = 'echo /etc/init.d/firewall blacklist' def __str__(self) : return "blackliste upload firewall" @@ -50,7 +50,22 @@ class bl_upload_fw(gen_config) : for adh in liste : self.anim.cycle() for machine in adh.machines() : - bl = machine.blacklist_actif() - if 'upload' in bl and not 'bloq' in bl : - upload.write( '%s:smtp,smtps,pop3,pop3s,imap,imaps,http\n' % machine.nom() ) - upload.close() + bl = machine.blacklist_all() + # 0 = présent, 1 = passé + for i in range(0,2): + # Si on est dans le passé, on commente la ligne + if i == 1: + commentaire = '#' + else: + commentaire = '' + # On regarde s'il y a une sanction d'upload + if 'upload' in bl[i]: + # Si on est dans le présent et que le type est bloqué, il n'existe plus + if i == 1 or not 'bloq' in bl[i] : + # Pour chaque sanction d'upload, on va écrire une ligne : + for sanction in bl[i]['upload']: + upload.write( '%s%s:smtp,smtps,pop3,pop3s,imap,imaps,http # %s:%s:\n' % (commentaire, + machine.nom(), + sanction[0].split(" ")[0], + sanction[1].split(" ")[0])) + upload.close()