diff --git a/gestion/gen_confs/bind.py b/gestion/gen_confs/bind.py index 4335ba72..e929abd2 100755 --- a/gestion/gen_confs/bind.py +++ b/gestion/gen_confs/bind.py @@ -254,17 +254,22 @@ class Zone(ZoneBase): def add_sshfp_record(self, nom, machine): for sshkey in machine.get('sshFingerprint', []): - algo_txt, key = str(sshkey).split()[:2] - algo=config.sshfs_ralgo[algo_txt][1] - for hash in config.sshfp_hash.keys(): - self.add(SSHFP(nom, hash, algo, key)) - if self.ipv4 and self.ipv6: - if nom == '@': - self.add(SSHFP("v4", hash, algo, key)) - self.add(SSHFP("v6", hash, algo, key)) - else: - self.add(SSHFP("%s.v4" % nom, hash, algo, key)) - self.add(SSHFP("%s.v6" % nom, hash, algo, key)) + try: + algo_txt, key = str(sshkey).split()[:2] + algo=config.sshfs_ralgo[algo_txt][1] + for hash in config.sshfp_hash.keys(): + self.add(SSHFP(nom, hash, algo, key)) + if self.ipv4 and self.ipv6: + if nom == '@': + self.add(SSHFP("v4", hash, algo, key)) + self.add(SSHFP("v6", hash, algo, key)) + else: + 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): for host in machine['host']: