Gnration du fichier blacklist.cf
darcs-hash:20041017142248-41617-a9fb9ec1792e0480ac42c19e54ff09d7ba1f6173.gz
This commit is contained in:
parent
1481c22db1
commit
817d3682bc
1 changed files with 9 additions and 8 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue