[gen_confs/squid.py] On passage à squid3
darcs-hash:20090603171843-bd074-7f0d1fd6219968d70b1a5af31da16d33010f2dba.gz
This commit is contained in:
parent
ecb713cc85
commit
9aaaae7e6a
1 changed files with 12 additions and 12 deletions
|
@ -13,14 +13,14 @@ from config import bl_carte_et_actif
|
||||||
class squid(gen_config) :
|
class squid(gen_config) :
|
||||||
db = crans_ldap()
|
db = crans_ldap()
|
||||||
actif = True # la sanction est elle active ?
|
actif = True # la sanction est elle active ?
|
||||||
restart_cmd = '/etc/init.d/squid reload'
|
restart_cmd = '/etc/init.d/squid3 reload'
|
||||||
|
|
||||||
def __str__(self) :
|
def __str__(self) :
|
||||||
return str(self.__class__).replace('_','-').split('.')[2]
|
return str(self.__class__).replace('_','-').split('.')[2]
|
||||||
|
|
||||||
def _gen(self) :
|
def _gen(self) :
|
||||||
self._mklist()
|
self._mklist()
|
||||||
|
|
||||||
def _mklist(self) :
|
def _mklist(self) :
|
||||||
fic = self._open_conf(self.FICHIER)
|
fic = self._open_conf(self.FICHIER)
|
||||||
|
|
||||||
|
@ -32,15 +32,15 @@ class squid(gen_config) :
|
||||||
# chaine de tri spéciale
|
# chaine de tri spéciale
|
||||||
liste = self.db.search("paiement=ok&%s"%self.chaine)
|
liste = self.db.search("paiement=ok&%s"%self.chaine)
|
||||||
l_proprio = liste["adherent"] + liste["club"]
|
l_proprio = liste["adherent"] + liste["club"]
|
||||||
l_machine = liste["machine"]
|
l_machine = liste["machine"]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# recherche dans les adhérents blacklistés
|
# recherche dans les adhérents blacklistés
|
||||||
liste = self.db.search("paiement=ok&ablacklist=*%s*"%self.chaine)
|
liste = self.db.search("paiement=ok&ablacklist=*%s*"%self.chaine)
|
||||||
l_proprio = liste["adherent"] + liste["club"]
|
l_proprio = liste["adherent"] + liste["club"]
|
||||||
l_proprio = [ x for x in l_proprio if self.chaine in x.blacklist_actif() ]
|
l_proprio = [ x for x in l_proprio if self.chaine in x.blacklist_actif() ]
|
||||||
|
|
||||||
# recherche dans les machines blacklistés
|
# recherche dans les machines blacklistés
|
||||||
liste = self.db.search("paiement=ok&mblacklist=*%s*"%self.chaine)
|
liste = self.db.search("paiement=ok&mblacklist=*%s*"%self.chaine)
|
||||||
l_machine = liste["machine"]
|
l_machine = liste["machine"]
|
||||||
l_machine = [ m for m in l_machine if self.chaine in m.blacklist_actif() ]
|
l_machine = [ m for m in l_machine if self.chaine in m.blacklist_actif() ]
|
||||||
|
@ -48,11 +48,11 @@ class squid(gen_config) :
|
||||||
# on ajoute les machines des proprios aux autres machines
|
# on ajoute les machines des proprios aux autres machines
|
||||||
for proprio in l_proprio :
|
for proprio in l_proprio :
|
||||||
l_machine += proprio.machines()
|
l_machine += proprio.machines()
|
||||||
|
|
||||||
# on colle toutes les machines dans le fichier
|
# on colle toutes les machines dans le fichier
|
||||||
self.anim.iter=len(l_machine)
|
self.anim.iter=len(l_machine)
|
||||||
for m in l_machine:
|
for m in l_machine:
|
||||||
self.anim.cycle()
|
self.anim.cycle()
|
||||||
fic.write( m.Nom() + '\n' )
|
fic.write( m.Nom() + '\n' )
|
||||||
fic.close()
|
fic.close()
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class squid_virus(squid) :
|
||||||
""" Genère le fichier blacklist-virus pour squid """
|
""" Genère le fichier blacklist-virus pour squid """
|
||||||
FICHIER = "/etc/squid/blacklist_virus"
|
FICHIER = "/etc/squid/blacklist_virus"
|
||||||
chaine = "virus"
|
chaine = "virus"
|
||||||
|
|
||||||
class squid_warez(squid) :
|
class squid_warez(squid) :
|
||||||
""" Genère le fichier blacklist-warez pour squid """
|
""" Genère le fichier blacklist-warez pour squid """
|
||||||
FICHIER = "/etc/squid/blacklist_warez"
|
FICHIER = "/etc/squid/blacklist_warez"
|
||||||
|
@ -90,7 +90,7 @@ class squid_bloq(squid) :
|
||||||
""" Genère le fichier blacklist-bloq pour squid """
|
""" Genère le fichier blacklist-bloq pour squid """
|
||||||
FICHIER = "/etc/squid/blacklist_bloq"
|
FICHIER = "/etc/squid/blacklist_bloq"
|
||||||
chaine = "bloq"
|
chaine = "bloq"
|
||||||
|
|
||||||
class squid_carte(squid) :
|
class squid_carte(squid) :
|
||||||
""" Genère le fichier blacklist-carte pour squid """
|
""" Genère le fichier blacklist-carte pour squid """
|
||||||
actif = bl_carte_et_actif
|
actif = bl_carte_et_actif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue