Les adhrents n'ont pas d'adresse IP, simplifications.
darcs-hash:20060401001858-68412-1939db9c3ffdf7edc756099e40c051749d06f1d1.gz
This commit is contained in:
parent
fcd1c61fc2
commit
1efa27ecaf
1 changed files with 20 additions and 11 deletions
|
@ -668,26 +668,35 @@ class firewall_komaz(firewall_crans) :
|
||||||
%(ip,proto,port))
|
%(ip,proto,port))
|
||||||
|
|
||||||
def blacklist(self):
|
def blacklist(self):
|
||||||
""" Construit les chaines de blackliste (BLACKLIST_{DST,SRC}) """
|
""" Construit les chaînes de blackliste (BLACKLIST_{DST,SRC}) """
|
||||||
self.anim = anim("\tBlackliste")
|
self.anim = anim("\tBlackliste")
|
||||||
iptables('-F BLACKLIST_DST')
|
iptables('-F BLACKLIST_DST')
|
||||||
iptables('-F BLACKLIST_SRC')
|
iptables('-F BLACKLIST_SRC')
|
||||||
|
|
||||||
blacklist=[]
|
# Peut-être à mettre dans config.py ?
|
||||||
|
blacklist_sanctions = ('upload', 'warez', 'p2p', 'autodisc_p2p', 'autodisc_upload')
|
||||||
|
|
||||||
|
blacklist = []
|
||||||
|
|
||||||
# Recherche sur le champ ablacklist (clubs compris)
|
# Recherche sur le champ ablacklist (clubs compris)
|
||||||
search = db.search('ablacklist=*&paiement=%s'% ann_scol)
|
search = db.search('ablacklist=*&paiement=%s' % ann_scol)
|
||||||
for entite in search['adherent']+search['club']:
|
for entite in search['adherent'] + search['club']:
|
||||||
self.anim.cycle()
|
self.anim.cycle()
|
||||||
sanctions = entite.blacklist_actif()
|
sanctions = entite.blacklist_actif()
|
||||||
if 'upload' in sanctions or 'warez' in sanctions or 'p2p' in sanctions or 'autodisc_p2p' in sanctions or 'autodisc_upload' in sanctions :
|
for s in blacklist_sanctions:
|
||||||
blacklist+=entite.machines()
|
if s in sanctions:
|
||||||
# Recherche sur le champ mblacklist (clubs aussi compris mais on extrait pas les résultats)
|
blacklist.extend(entite.machines())
|
||||||
search = db.search('mblacklist=*&paiement=%s'% ann_scol)
|
break
|
||||||
for entite in search['adherent']+search['club']+search['machine']:
|
|
||||||
|
# Recherche sur le champ mblacklist
|
||||||
|
search = db.search('mblacklist=*&paiement=%s' % ann_scol)
|
||||||
|
for entite in search['machine']:
|
||||||
self.anim.cycle()
|
self.anim.cycle()
|
||||||
sanctions = entite.blacklist_actif()
|
sanctions = entite.blacklist_actif()
|
||||||
if 'upload' in sanctions or 'warez' in sanctions or 'p2p' in sanctions or 'autodisc_p2p' in sanctions or 'autodisc_upload' in sanctions :
|
for s in blacklist_sanctions:
|
||||||
blacklist+=[entite]
|
if s in sanctions:
|
||||||
|
blacklist.append(entite)
|
||||||
|
break
|
||||||
|
|
||||||
for machine in blacklist:
|
for machine in blacklist:
|
||||||
iptables("-A BLACKLIST_DST -d %s -j REJECT --reject-with icmp-host-prohibited" % machine.ip())
|
iptables("-A BLACKLIST_DST -d %s -j REJECT --reject-with icmp-host-prohibited" % machine.ip())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue