[gen_confs/bind] Dans la méthode add_sshfp_record, on rattrape les exceptions du à des sshFingerprint mal formé

This commit is contained in:
Valentin Samir 2014-02-21 18:05:02 +01:00
parent 470fa70f14
commit e579798fdc

View file

@ -254,17 +254,22 @@ class Zone(ZoneBase):
def add_sshfp_record(self, nom, machine): def add_sshfp_record(self, nom, machine):
for sshkey in machine.get('sshFingerprint', []): for sshkey in machine.get('sshFingerprint', []):
algo_txt, key = str(sshkey).split()[:2] try:
algo=config.sshfs_ralgo[algo_txt][1] algo_txt, key = str(sshkey).split()[:2]
for hash in config.sshfp_hash.keys(): algo=config.sshfs_ralgo[algo_txt][1]
self.add(SSHFP(nom, hash, algo, key)) for hash in config.sshfp_hash.keys():
if self.ipv4 and self.ipv6: self.add(SSHFP(nom, hash, algo, key))
if nom == '@': if self.ipv4 and self.ipv6:
self.add(SSHFP("v4", hash, algo, key)) if nom == '@':
self.add(SSHFP("v6", hash, algo, key)) self.add(SSHFP("v4", hash, algo, key))
else: self.add(SSHFP("v6", hash, algo, key))
self.add(SSHFP("%s.v4" % nom, hash, algo, key)) else:
self.add(SSHFP("%s.v6" % nom, hash, algo, key)) self.add(SSHFP("%s.v4" % nom, hash, algo, key))
self.add(SSHFP("%s.v6" % nom, hash, algo, key))
# KeyError is l'algo dans ldap n'est pas connu
# TypeError si la clef n'est pas bien en base64
except (KeyError, TypeError):
pass
def add_machine(self, machine): def add_machine(self, machine):
for host in machine['host']: for host in machine['host']: