suppression de trailing whitespaces
darcs-hash:20081002165739-bd074-d426f3830f4c7d2203eb80c94c5ccc7c38e9ba86.gz
This commit is contained in:
parent
c57212cb58
commit
7b7b88acb0
4 changed files with 34 additions and 31 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# The authors of this code are
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# The authors of this code are
|
||||
# Manuel Sabban <manu@feyd-rautha.org>
|
||||
# Frédéric Pauget <pauget@crans.ens-cachan.fr>
|
||||
# Mathieu Segaud <matt@minas-morgul.org>
|
||||
|
@ -112,17 +112,17 @@ class firewall_crans :
|
|||
vlan_adm = NETs['vlan-adm'][0]
|
||||
|
||||
adm_users = [ "root", "identd", "daemon", "postfix", "freerad", "amavis", "nut", "respbats", "list", "sqlgrey", "ntpd", "lp" ]
|
||||
|
||||
|
||||
limit = " -m limit --limit 10/s --limit-burst 10 "
|
||||
log_template = '-m limit --limit 1/s --limit-burst 1 -j LOG --log-level notice --log-prefix '
|
||||
filtre_flood = '-m hashlimit --hashlimit 20 --hashlimit-mode srcip --hashlimit-name flood'
|
||||
|
||||
|
||||
machines = []
|
||||
debug = 1
|
||||
|
||||
def exception_catcher(self,tache) :
|
||||
""" Exécute la tache founie en gérant les diverses exceptions
|
||||
pouvant survenir
|
||||
pouvant survenir
|
||||
Retourne 1 en cas d'erreur et 0 sinon """
|
||||
try :
|
||||
tache()
|
||||
|
@ -185,9 +185,9 @@ class firewall_crans :
|
|||
""" Rédémarrage du firewall """
|
||||
cprint(u'Redémarrage firewall', 'gras')
|
||||
self.start(False)
|
||||
|
||||
|
||||
def start(self,aff_txt_intro=True) :
|
||||
""" Construction du firewall
|
||||
""" Construction du firewall
|
||||
aff_txt_intro s'occupe uniquement de l'esthétisme
|
||||
"""
|
||||
if aff_txt_intro: cprint(u'Démarrage firewall', 'gras')
|
||||
|
@ -248,7 +248,7 @@ class firewall_crans :
|
|||
|
||||
|
||||
def __test_mac_ip(self,machine):
|
||||
ip=machine.ip()
|
||||
ip=machine.ip()
|
||||
mac=machine.mac()
|
||||
|
||||
insert = '-I'
|
||||
|
@ -266,7 +266,7 @@ class firewall_crans :
|
|||
else:
|
||||
# Machine fixe
|
||||
iptables("-t nat %s TEST_MAC-IP -s "%(insert)+\
|
||||
"%s -m mac --mac-source %s -j RETURN"%(ip,mac))
|
||||
"%s -m mac --mac-source %s -j RETURN"%(ip,mac))
|
||||
|
||||
def serveurs_maj(self):
|
||||
pass
|
||||
|
@ -280,7 +280,7 @@ class firewall_crans :
|
|||
def port_maj(self,ip_list) :
|
||||
""" Mise à jour des ports pour les ip fournies """
|
||||
# Note : système bourrin (on efface les chaînes et on refait)
|
||||
# mais rapide et efficace (si qqn veut se casser le cul à
|
||||
# mais rapide et efficace (si qqn veut se casser le cul à
|
||||
# un système aussi délicat que pour la correspondance MAC-IP...)
|
||||
# -- Fred
|
||||
serveur_maj = False
|
||||
|
@ -295,7 +295,7 @@ class firewall_crans :
|
|||
to_do=[]
|
||||
if serveur_maj :
|
||||
self.exception_catcher(self.serveurs_maj_list_to_do)
|
||||
|
||||
|
||||
if adh_maj :
|
||||
self.exception_catcher(self.adh_maj_list_to_do)
|
||||
|
||||
|
@ -366,7 +366,7 @@ class firewall_crans :
|
|||
self.__test_mac_ip(machine)
|
||||
# Supression de l'ancienne ligne
|
||||
iptables("-t nat -D TEST_MAC-IP -s %s -m mac --mac-source %s -j RETURN" % (ip, mac))
|
||||
|
||||
|
||||
# Toutes les autres occurences devront être détruites
|
||||
mac_ip_maj[ip]=None
|
||||
|
||||
|
@ -375,7 +375,7 @@ class firewall_crans :
|
|||
|
||||
# Ajout des machines qui n'étaient pas dans le firewall
|
||||
for machine in mac_ip_maj.values() :
|
||||
if machine :
|
||||
if machine :
|
||||
self.__test_mac_ip(machine)
|
||||
if warn :
|
||||
print WARNING
|
||||
|
@ -383,7 +383,7 @@ class firewall_crans :
|
|||
else :
|
||||
print OK
|
||||
|
||||
self.exception_catcher(procedure)
|
||||
self.exception_catcher(procedure)
|
||||
|
||||
def build_chaine_adherent(self,chaine,methode) :
|
||||
# On construit d'abord les autorisations particulières
|
||||
|
@ -600,6 +600,7 @@ class firewall_komaz(firewall_crans) :
|
|||
"-j CLASSIFY --set-class 1:%(class_id)s" % locals())
|
||||
iptables("-t mangle -A SUBNET-%(subnet)s -o ens -s %(ip)s "
|
||||
"-j CLASSIFY --set-class 1:%(class_id)s" % locals())
|
||||
|
||||
self.anim.reinit()
|
||||
print OK
|
||||
|
||||
|
@ -652,7 +653,7 @@ class firewall_komaz(firewall_crans) :
|
|||
print OK
|
||||
|
||||
def classes_p2p_maj(self, ip_list):
|
||||
""" Mise à jour de la classification pour les ip fournies
|
||||
""" Mise à jour de la classification pour les ip fournies
|
||||
On ne crée que les règles iptables pour classer les paquets, les
|
||||
classes correspondantes ne sont à créer que toutes à la fois """
|
||||
## Que faut-il faire ?
|
||||
|
@ -738,7 +739,7 @@ class firewall_komaz(firewall_crans) :
|
|||
|
||||
for class_id in scheduled_del:
|
||||
# TODO: supprimer les classes qui sont vraiment vides
|
||||
pass
|
||||
pass
|
||||
|
||||
if warn:
|
||||
print WARNING
|
||||
|
@ -746,7 +747,7 @@ class firewall_komaz(firewall_crans) :
|
|||
else:
|
||||
print OK
|
||||
|
||||
self.exception_catcher(procedure)
|
||||
self.exception_catcher(procedure)
|
||||
|
||||
def post_start_hook(self) :
|
||||
self.anim = anim("\tMise en place du routage")
|
||||
|
@ -805,7 +806,7 @@ class firewall_komaz(firewall_crans) :
|
|||
self.anim.cycle()
|
||||
self.anim.reinit()
|
||||
print OK
|
||||
|
||||
|
||||
def test_virus_flood(self) :
|
||||
""" Construction de la chaîne TEST_VIRUS """
|
||||
iptables('-t nat -F TEST_VIRUS_FLOOD')
|
||||
|
@ -830,7 +831,7 @@ class firewall_komaz(firewall_crans) :
|
|||
def serveurs_vers_ext(self) :
|
||||
""" Reconstruit la chaîne SERVEURS_VERS_EXT """
|
||||
if not self.build_chaine('SERVEURS_VERS_EXT', self.__serveurs_vers_ext) :
|
||||
self.anim.reinit()
|
||||
self.anim.reinit()
|
||||
print OK
|
||||
|
||||
def ext_vers_serveurs(self) :
|
||||
|
@ -870,7 +871,7 @@ class firewall_komaz(firewall_crans) :
|
|||
return
|
||||
|
||||
mac = machine.mac()
|
||||
ports = { 'tcp' : machine.portTCPout(),
|
||||
ports = { 'tcp' : machine.portTCPout(),
|
||||
'udp' : machine.portUDPout() }
|
||||
|
||||
for proto in [ 'tcp', 'udp' ] :
|
||||
|
@ -884,7 +885,7 @@ class firewall_komaz(firewall_crans) :
|
|||
# C'est une machine adhérent, rien à faire ici
|
||||
return
|
||||
|
||||
ports = { 'tcp' : machine.portTCPin(),
|
||||
ports = { 'tcp' : machine.portTCPin(),
|
||||
'udp' : machine.portUDPin() }
|
||||
|
||||
for proto in [ 'tcp', 'udp' ] :
|
||||
|
@ -898,7 +899,7 @@ class firewall_komaz(firewall_crans) :
|
|||
# C'est un serveur, rien à faire ici
|
||||
return
|
||||
|
||||
ports = { 'tcp' : machine.portTCPout(),
|
||||
ports = { 'tcp' : machine.portTCPout(),
|
||||
'udp' : machine.portUDPout() }
|
||||
|
||||
for proto in [ 'tcp', 'udp' ] :
|
||||
|
@ -912,7 +913,7 @@ class firewall_komaz(firewall_crans) :
|
|||
# C'est un serveur, rien à faire ici
|
||||
return
|
||||
|
||||
ports = { 'tcp' : machine.portTCPin(),
|
||||
ports = { 'tcp' : machine.portTCPin(),
|
||||
'udp' : machine.portUDPin() }
|
||||
|
||||
for proto in [ 'tcp', 'udp' ] :
|
||||
|
@ -1054,7 +1055,7 @@ class firewall_zamok(firewall_crans) :
|
|||
iptables("-t filter -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT")
|
||||
iptables("-t filter -A OUTPUT -o %s -j SERV_OUT_ADM" % self.eth_adm)
|
||||
|
||||
iptables("-t nat -P PREROUTING ACCEPT")
|
||||
iptables("-t nat -P PREROUTING ACCEPT")
|
||||
iptables("-t filter -P OUTPUT ACCEPT")
|
||||
print OK
|
||||
|
||||
|
@ -1084,7 +1085,7 @@ class firewall_rouge(firewall_crans) :
|
|||
INPUT (policy par défaut : ACCEPT)
|
||||
|
||||
"""
|
||||
|
||||
|
||||
# interfaces physiques
|
||||
eth_pub = "eth0"
|
||||
eth_adm = "eth0.2"
|
||||
|
@ -1158,12 +1159,13 @@ class firewall_sable(firewall_rouge):
|
|||
iptables("-t mangle -F PREROUTING")
|
||||
|
||||
# Pour le proxy transparent
|
||||
iptables("-t mangle -i eth0.2 -A PREROUTING -p tcp --destination-port 3128 " +
|
||||
"--destination 10.231.136.9 " +
|
||||
iptables("-t mangle -i eth0.2 -A PREROUTING -p tcp --destination-port 3128 " +
|
||||
"--destination 10.231.136.9 " +
|
||||
"-m mac --mac-source %s " % mac_komaz +
|
||||
"-j MARK --set-mark %s" % conf_fw.mark['proxy'])
|
||||
iptables("-t mangle -A PREROUTING -m mark --mark %s -j ACCEPT" % conf_fw.mark['proxy'])
|
||||
|
||||
|
||||
if_defaut = "eth0"
|
||||
if_radin = "eth0.%d" % vlans["radin"]
|
||||
if_accueil = "eth0.%d" % vlans["accueil"]
|
||||
|
||||
|
|
|
@ -192,7 +192,10 @@ class main(ModuleBase):
|
|||
crans.cp.log("lancerImpression : %s" % str(e), 'IMPRESSION', 1)
|
||||
return {"erreur":str(e)}
|
||||
crans.cp.log("impression", 'IMPRESSION')
|
||||
return {'code':str(crans.impression.digicode.gen_code(cherrypy.session['uid'])) + "#"}
|
||||
return {
|
||||
'code':str(crans.impression.digicode.gen_code(cherrypy.session['uid'])) + "#",
|
||||
'code_bat_j': cherrypy.config.get('crans.impression.codes.batJ', u"Non disponible")
|
||||
}
|
||||
lancerImpression.exposed = True
|
||||
|
||||
#
|
||||
|
|
|
@ -357,7 +357,6 @@ Impression.AJAX.finImpression = function(AJAXResp)
|
|||
Impression.popup.popupImpression(AJAXResp.code);
|
||||
}
|
||||
Impression.AJAX.updateSolde();
|
||||
|
||||
}
|
||||
|
||||
Impression.AJAX.getPrinterState = function()
|
||||
|
|
|
@ -21,7 +21,6 @@ class main(ModuleBase):
|
|||
return crans.utils.quota.getUserQuota(cherrypy.session['uid'])
|
||||
#return [{'%': 33.9, 'quota': 390.62, 'label': u'Dossier personnel', 'limite': 585.94, 'filesystem': '/home', 'usage': 420.32}, {'%': 0.1, 'quota': 100.00, 'label': u'Boite de r\xe9ception', 'limite': 150.00, 'filesystem': '/var/mail', 'usage': 0.06}]
|
||||
|
||||
|
||||
##########################
|
||||
# affichage
|
||||
##########################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue