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))
|
||||
|
||||
def blacklist(self):
|
||||
""" Construit les chaines de blackliste (BLACKLIST_{DST,SRC}) """
|
||||
""" Construit les chaînes de blackliste (BLACKLIST_{DST,SRC}) """
|
||||
self.anim = anim("\tBlackliste")
|
||||
iptables('-F BLACKLIST_DST')
|
||||
iptables('-F BLACKLIST_SRC')
|
||||
|
||||
# Peut-être à mettre dans config.py ?
|
||||
blacklist_sanctions = ('upload', 'warez', 'p2p', 'autodisc_p2p', 'autodisc_upload')
|
||||
|
||||
blacklist = []
|
||||
|
||||
# Recherche sur le champ ablacklist (clubs compris)
|
||||
search = db.search('ablacklist=*&paiement=%s' % ann_scol)
|
||||
for entite in search['adherent'] + search['club']:
|
||||
self.anim.cycle()
|
||||
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 :
|
||||
blacklist+=entite.machines()
|
||||
# Recherche sur le champ mblacklist (clubs aussi compris mais on extrait pas les résultats)
|
||||
for s in blacklist_sanctions:
|
||||
if s in sanctions:
|
||||
blacklist.extend(entite.machines())
|
||||
break
|
||||
|
||||
# Recherche sur le champ mblacklist
|
||||
search = db.search('mblacklist=*&paiement=%s' % ann_scol)
|
||||
for entite in search['adherent']+search['club']+search['machine']:
|
||||
for entite in search['machine']:
|
||||
self.anim.cycle()
|
||||
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 :
|
||||
blacklist+=[entite]
|
||||
for s in blacklist_sanctions:
|
||||
if s in sanctions:
|
||||
blacklist.append(entite)
|
||||
break
|
||||
|
||||
for machine in blacklist:
|
||||
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