From 341a5e66b972eb95c41f7ced4594a8a5c5e5098b Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Fri, 22 Jan 2010 20:16:10 +0100 Subject: [PATCH] Include a host in DNS even if we do not have both ssh keys and an arch for that host configured --- debian/changelog | 4 +++- ud-generate | 37 ++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/debian/changelog b/debian/changelog index 14122ce..ef79223 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,8 +18,10 @@ userdir-ldap (0.3.76xXx) unstable; urgency=low * ud-generate: move the regex that determines whether or not to include a host in the dns-sshfp zone snippet (for SSHFP and A, AAAA and MX records) to the config file. + * Include a host in DNS even if we do not have both ssh keys and an + arch for that host configured. - -- Peter Palfrader Sat, 09 Jan 2010 16:50:24 +0100 + -- Peter Palfrader Fri, 22 Jan 2010 20:13:18 +0100 userdir-ldap (0.3.75) unstable; urgency=low diff --git a/ud-generate b/ud-generate index 881f521..2836f5c 100755 --- a/ud-generate +++ b/ud-generate @@ -840,25 +840,26 @@ def ExtractDNSInfo(x): else: DNSInfo.append("%sIN\tA\t%s" % (TTLprefix, I)) - Host = GetAttr(x, "hostname") - Arch = GetAttr(x, "architecture") Algorithm = None - for I in x[1]["sshRSAHostKey"]: - Split = I.split() - if Split[0] == 'ssh-rsa': - Algorithm = 1 - if Split[0] == 'ssh-dss': - Algorithm = 2 - if Algorithm == None: - continue - Fingerprint = sha.new(base64.decodestring(Split[1])).hexdigest() - DNSInfo.append("%sIN\tSSHFP\t%u 1 %s" % (TTLprefix, Algorithm, Fingerprint)) + if 'sshRSAHostKey' in x[1]: + for I in x[1]["sshRSAHostKey"]: + Split = I.split() + if Split[0] == 'ssh-rsa': + Algorithm = 1 + if Split[0] == 'ssh-dss': + Algorithm = 2 + if Algorithm == None: + continue + Fingerprint = sha.new(base64.decodestring(Split[1])).hexdigest() + DNSInfo.append("%sIN\tSSHFP\t%u 1 %s" % (TTLprefix, Algorithm, Fingerprint)) - Mach = "" - if x[1].has_key("machine"): - Mach = " " + GetAttr(x, "machine") - DNSInfo.append("%sIN\tHINFO\t\"%s%s\" \"%s\"" % (TTLprefix, Arch, Mach, "Debian GNU/Linux")) + if 'architecture' in x[1]: + Arch = GetAttr(x, "architecture") + Mach = "" + if x[1].has_key("machine"): + Mach = " " + GetAttr(x, "machine") + DNSInfo.append("%sIN\tHINFO\t\"%s%s\" \"%s\"" % (TTLprefix, Arch, Mach, "Debian GNU/Linux")) if x[1].has_key("mXRecord"): for I in x[1]["mXRecord"]: @@ -876,9 +877,7 @@ def GenZoneRecords(File): global HostAttrs for x in HostAttrs: - if x[1].has_key("hostname") == 0 or \ - x[1].has_key("architecture") == 0 or\ - x[1].has_key("sshRSAHostKey") == 0: + if x[1].has_key("hostname") == 0: continue if IsDebianHost.match(GetAttr(x, "hostname")) is None: -- 2.20.1