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