Fix sshfp record printing
Previously if you ran `sshfp.py foo.opendev.org x.y.z.a` it would spit out records that look like: foo.opendev.org IN SSHFP 1 1 stuffstuffstuff The problem with this is when you copy this output into the zone file the lack of a terminating '.' means the record will actually be for foo.opendev.org.opendev.org. We address this by splitting on '.' and taking the first element. This will still be broken for hosts named foo.bar.opendev.org but for now is a decent improvement. Change-Id: Ib12f66c30e20a62d14d0d0ddd485e28f7f7ab518
This commit is contained in:
parent
8998ee96b2
commit
5f4b5000c8
@ -38,9 +38,10 @@ def generate_sshfp_records(hostname, ip, local):
|
||||
|
||||
ret = ''
|
||||
first = True
|
||||
dns_hostname = hostname.split('.')[0]
|
||||
for f in fingerprints:
|
||||
ret += '%s%s\t\tIN\tSSHFP\t%s %s %s' % \
|
||||
("\n" if not first else '', hostname, f[0], f[1], f[2])
|
||||
("\n" if not first else '', dns_hostname, f[0], f[1], f[2])
|
||||
first = False
|
||||
return ret
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user