Generation d'un fichier supplementaire pour les bornes contenant tous
les clients qu'elles peuvent accepter darcs-hash:20041218182611-d1718-848500be98b1b05366da42288f4ab85dbf615b15.gz
This commit is contained in:
parent
c59c100795
commit
b090696f4f
1 changed files with 23 additions and 5 deletions
|
@ -16,12 +16,17 @@ class conf_wifi(gen_config) :
|
||||||
3) Phase 2 : une entrée par machine
|
3) Phase 2 : une entrée par machine
|
||||||
4) Bloc par machine suivant template
|
4) Bloc par machine suivant template
|
||||||
5) Ajout de net_crans
|
5) Ajout de net_crans
|
||||||
|
|
||||||
|
Génération également de la fonction get_clients en shell
|
||||||
|
dans /etc/wifi/wifi-update/shared/config/get_clients qui permet
|
||||||
|
d'avoir l' ensemble des clients wifi.
|
||||||
"""
|
"""
|
||||||
######################################PARTIE DE CONFIGURATION
|
######################################PARTIE DE CONFIGURATION
|
||||||
|
|
||||||
# Fichiers à écrire
|
# Fichiers à écrire
|
||||||
# Répertoire d'écriture des fichiers de zone
|
# Répertoire d'écriture des fichiers de zone
|
||||||
ISAKMPD_CONF='/etc/isakmpd/isakmpd.conf'
|
ISAKMPD_CONF='/etc/isakmpd/isakmpd.conf'
|
||||||
|
GET_CLIENTS='/etc/wifi/wifi-update/shared/config/get_clients'
|
||||||
|
|
||||||
# Config générale
|
# Config générale
|
||||||
general="""
|
general="""
|
||||||
|
@ -104,18 +109,23 @@ Netmask= 0.0.0.0
|
||||||
def __str__(self) :
|
def __str__(self) :
|
||||||
return 'wifi'
|
return 'wifi'
|
||||||
|
|
||||||
def _gen(self) :
|
def _gen(self):
|
||||||
|
# Pour isakmpd.conf
|
||||||
phase1 = self.phase1_debut
|
phase1 = self.phase1_debut
|
||||||
phase2 = self.phase2_debut
|
phase2 = self.phase2_debut
|
||||||
blocs=''
|
blocs=''
|
||||||
|
# Pour get_clients
|
||||||
|
clients = ''
|
||||||
|
|
||||||
for machine in self.db.search('host=*.wifi.crans.org&paiement=ok')['machine'] :
|
for machine in self.db.search('host=*.wifi.crans.org&paiement=ok')['machine'] :
|
||||||
self.anim.cycle()
|
self.anim.cycle()
|
||||||
if 'bloq' in machine.blacklist_actif() : continue
|
if 'bloq' in machine.blacklist_actif() : continue
|
||||||
data = { 'HOST' : machine.nom().split('.')[0] ,
|
data = { 'HOST' : machine.nom().split('.')[0] ,
|
||||||
'IP' : machine.ip() ,
|
'IP' : machine.ip() ,
|
||||||
'KEY' : machine.ipsec() }
|
'KEY' : machine.ipsec() ,
|
||||||
|
'MAC' : machine.mac().lower() }
|
||||||
|
|
||||||
|
# Pour isakmpd.conf
|
||||||
# Phase 1
|
# Phase 1
|
||||||
phase1 += self.phase1_template % data
|
phase1 += self.phase1_template % data
|
||||||
|
|
||||||
|
@ -127,8 +137,11 @@ Netmask= 0.0.0.0
|
||||||
|
|
||||||
# Blocs machine
|
# Blocs machine
|
||||||
blocs += self.host_template % data
|
blocs += self.host_template % data
|
||||||
|
|
||||||
|
# Pour get_clients
|
||||||
|
clients += "echo %(HOST)s %(IP)s %(MAC)s\n" % data
|
||||||
|
|
||||||
# Ecriture du fichier
|
# Ecriture du fichier isakmpd.conf
|
||||||
fd = self._open_conf(self.ISAKMPD_CONF,'#')
|
fd = self._open_conf(self.ISAKMPD_CONF,'#')
|
||||||
fd.write(self.general)
|
fd.write(self.general)
|
||||||
fd.write(phase1)
|
fd.write(phase1)
|
||||||
|
@ -139,6 +152,12 @@ Netmask= 0.0.0.0
|
||||||
fd.write(self.net_crans)
|
fd.write(self.net_crans)
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
|
# Ecriture du fichier get_clients
|
||||||
|
fd = self._open_conf(self.GET_CLIENTS, '#')
|
||||||
|
fd.write("get_clients () {\n\n")
|
||||||
|
fd.write(clients)
|
||||||
|
fd.write("\n}\n")
|
||||||
|
fd.close()
|
||||||
|
|
||||||
|
|
||||||
class bornes_wifi(gen_config) :
|
class bornes_wifi(gen_config) :
|
||||||
|
@ -165,7 +184,6 @@ class bornes_wifi(gen_config) :
|
||||||
#***********************************************************
|
#***********************************************************
|
||||||
|
|
||||||
## On configure la nvram de la borne selon son adresse MAC (celle inscrite sur la borne)
|
## On configure la nvram de la borne selon son adresse MAC (celle inscrite sur la borne)
|
||||||
## Modifier bornes.cf et non ce fichier qui sera modifié selon le contenu de bornes.cf
|
|
||||||
cat <<EOF | grep -i $(nvram get et0macaddr) > /tmp/params
|
cat <<EOF | grep -i $(nvram get et0macaddr) > /tmp/params
|
||||||
%(BORNES)s
|
%(BORNES)s
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue