[config.py,bind.py,populate_sshFingerprint.py] Configuration pour sshfp dans config.py, ajout d'un script pour ajouter les clef des serveur dans ldap

Ignore-this: 5fe4b7490ca1f97168b6ce457374ffb5

darcs-hash:20130118011803-3a55a-2fb24947d4f3807082ae5f0da41741e0ef0086c8.gz
This commit is contained in:
Valentin Samir 2013-01-18 02:18:03 +01:00
parent 4c206f8649
commit b844853894
3 changed files with 85 additions and 8 deletions

View file

@ -284,16 +284,20 @@ zone "%(NOM_zone)s" {
# Le direct
if zone in self.zones_direct :
ligne = "%s\tIN\tA\t%s\n" % ( nom, machine.ip() )
# Si la machine est une borne wifi, on ajoute la position
# Si la machine est une borne wifi, on ajoute la position
if isinstance(machine,ldap_crans.BorneWifi) and machine.position():
ligne +="%s\tIN\tTXT\t\"LOC %s,%s\"\n" % (nom,machine.position()[0],machine.position()[1])
# Si la machine à des clefs ssh, on ajoute les champs SSFP correspondant
# Si la machine à des clefs ssh, on ajoute les champs SSFP correspondant
for sshkey in machine.sshFingerprint():
try:
[algo,key]=sshkey.split()[:2]
if algo == "ssh-rsa": algo=1
elif algo == "ssh-dss": algo=2
else: raise ValueError("Invalid Algorithms %s" % algo)
[algo_txt,key]=sshkey.split()[:2]
algo=None
for value in config.sshfp_algo.values():
if algo_txt == value[1]:
algo=value[0]
break
if not algo:
raise ValueError("Invalid Algorithms %s" % algo_txt)
key=hashlib.sha1(base64.b64decode(key)).hexdigest()
ligne +="%s\tIN\tSSHFP\t%s\t1\t%s\n" % (nom,algo,key)
except(ValueError,TypeError): pass