Menage dans syslog
darcs-hash:20051110091715-d1718-69a2c5538e03c942d3a0cd65f439afa5f70f0d36.gz
This commit is contained in:
parent
1ac94fbfec
commit
eee7cac8f4
1 changed files with 5 additions and 5 deletions
|
@ -53,14 +53,14 @@ class Server:
|
|||
"""Ajout d'une IP au firewall"""
|
||||
cmd = "pfctl -t clients_hotspot_autorises -Tadd %s" % ip
|
||||
if self.execute(cmd):
|
||||
syslog(LOG_INFO | LOG_LOCAL3, "Nouveau client hotspots: %s" % ip)
|
||||
syslog(LOG_INFO | LOG_LOCAL4, "Nouveau client hotspots: %s" % ip)
|
||||
|
||||
|
||||
def del_ip(self,ip):
|
||||
"""Retire une règle du firewall"""
|
||||
cmd = "pfctl -t clients_hotspot_autorises -Tdelete %s" % ip
|
||||
if self.execute(cmd):
|
||||
syslog(LOG_INFO | LOG_LOCAL3, "Suppression du client: %s" % ip)
|
||||
syslog(LOG_INFO | LOG_LOCAL4, "Suppression du client: %s" % ip)
|
||||
|
||||
def list_ips(self):
|
||||
"""Liste les IP actuellement dans le firewall"""
|
||||
|
@ -87,7 +87,7 @@ class Server:
|
|||
self.del_ip(ip)
|
||||
deleted=True
|
||||
if deleted:
|
||||
syslog(LOG_INFO | LOG_LOCAL3, "Clients hotspots: %s" % (", ".join(self.list_ips())) or "aucun")
|
||||
syslog(LOG_INFO | LOG_LOCAL3, "Clients hotspots: %s" % (", ".join(self.list_ips()) or "aucun"))
|
||||
|
||||
def daemonize(self):
|
||||
"""Passe en arrière plan"""
|
||||
|
@ -122,9 +122,9 @@ class Server:
|
|||
result = select([s],[],[],60)[0]
|
||||
if result:
|
||||
# On a quelqu'un, on lit une ligne
|
||||
syslog(LOG_INFO | LOG_LOCAL3, "Nouvelle requête")
|
||||
syslog(LOG_INFO | LOG_LOCAL4, "Nouvelle requete")
|
||||
ip = self.socket.readline().strip()
|
||||
syslog(LOG_INFO | LOG_LOCAL3, "Nouvelle requête pour l'IP : %s" % ip)
|
||||
syslog(LOG_INFO | LOG_LOCAL4, "Nouvelle requete pour l'IP : %s" % ip)
|
||||
if re.match("^10\.231.*", ip):
|
||||
self.add_ip(ip)
|
||||
# Dans tous les cas, on vire les IP inutiles
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue