From ce64087cfde96cea951f7d016aff0128fb7cf678 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 18 Oct 2009 12:44:55 +0200 Subject: [PATCH] Add dnsTTL host attribute to override the zone default TTL for A and AAAA records. Also for MX, HINFO and SSHFP --- debian/changelog | 7 +++++++ ud-generate | 17 ++++++++++------- ud-host | 4 +++- userdir-ldap.schema | 8 +++++++- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index b58c1eb..d1789e0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +userdir-ldap (0.3.73) unstable; urgency=low + + * Add dnsTTL host attribute to override the zone default TTL + for A and AAAA records. Also for MX, HINFO and SSHFP. + + -- Peter Palfrader Sun, 18 Oct 2009 12:38:51 +0200 + userdir-ldap (0.3.72) unstable; urgency=low [ Peter Palfrader ] diff --git a/ud-generate b/ud-generate index 549c744..795816c 100755 --- a/ud-generate +++ b/ud-generate @@ -823,14 +823,17 @@ def GenDNS(File): def ExtractDNSInfo(x): - DNSInfo = [] + TTLprefix="\t" + if 'dnsTTL' in x[1]: + TTLprefix="%s\t"%(x[1]["dnsTTL"][0]) + DNSInfo = [] if x[1].has_key("ipHostNumber"): for I in x[1]["ipHostNumber"]: if IsV6Addr.match(I) != None: - DNSInfo.append("IN\tAAAA\t%s" % (I)) + DNSInfo.append("%sIN\tAAAA\t%s" % (TTLprefix, I)) else: - DNSInfo.append("IN\tA\t%s" % (I)) + DNSInfo.append("%sIN\tA\t%s" % (TTLprefix, I)) Host = GetAttr(x, "hostname") Arch = GetAttr(x, "architecture") @@ -845,16 +848,16 @@ def ExtractDNSInfo(x): if Algorithm == None: continue Fingerprint = sha.new(base64.decodestring(Split[1])).hexdigest() - DNSInfo.append("IN\tSSHFP\t%u 1 %s" % (Algorithm, Fingerprint)) + DNSInfo.append("%sIN\tSSHFP\t%u 1 %s" % (TTLprefix, Algorithm, Fingerprint)) Mach = "" if x[1].has_key("machine"): Mach = " " + GetAttr(x, "machine") - DNSInfo.append("IN\tHINFO\t\"%s%s\" \"%s\"" % (Arch, Mach, "Debian GNU/Linux")) + 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"]: - DNSInfo.append("IN\tMX\t%s" % (I)) + DNSInfo.append("%sIN\tMX\t%s" % (TTLprefix, I)) return DNSInfo @@ -1080,7 +1083,7 @@ PasswdAttrs.sort(lambda x, y: cmp((GetAttr(x, "uid")).lower(), (GetAttr(y, "uid" # Fetch all the hosts HostAttrs = l.search_s(HostBaseDn, ldap.SCOPE_ONELEVEL, "objectClass=debianServer",\ ["hostname", "sshRSAHostKey", "purpose", "allowedGroups", "exportOptions",\ - "mXRecord", "ipHostNumber", "machine", "architecture"]) + "mXRecord", "ipHostNumber", "dnsTTL", "machine", "architecture"]) if HostAttrs == None: raise UDEmptyList, "No Hosts" diff --git a/ud-host b/ud-host index f6d6c56..0e98182 100755 --- a/ud-host +++ b/ud-host @@ -58,7 +58,8 @@ AttrInfo = {"description": ["Machine Descr.", 1], "exportOptions": ["Export-Opts", 18], "ipHostNumber": ["IP Address", 19], "mXRecord": ["MXRecord", 20], - "sshdistAuthKeysHost": ["extra authkeys ip", 21], + "dnsTTL": ["dnsTTL", 21], + "sshdistAuthKeysHost": ["extra authkeys ip", 22], } AttrPrompt = {"description": ["Purpose of the machine"], @@ -81,6 +82,7 @@ AttrPrompt = {"description": ["Purpose of the machine"], "exportOptions": ["additional export options"], "ipHostNumber": ["IP Addresses(es) of the machine"], "mXRecord": ["Mail Exchanger for this machine"], + "dnsTTL": ["dns TTL value"], "sshdistAuthKeysHost": ["additional hosts for sshdist's authkeys file"], }; diff --git a/userdir-ldap.schema b/userdir-ldap.schema index b1fd76b..01c0130 100644 --- a/userdir-ldap.schema +++ b/userdir-ldap.schema @@ -107,6 +107,7 @@ # .39 - allowedGroups # .40 - exportOptions # .41 - sshdistAuthKeysHost +# .42 - dnsTTL # # .3 - experimental LDAP objectClasses # .1 - debianDeveloper @@ -493,6 +494,11 @@ attributetype ( 1.3.6.1.4.1.9586.100.4.2.41 NAME ( 'sshdistAuthKeysHost' ) SUP ipHostNumber ) +attributetype ( 1.3.6.1.4.1.9586.100.4.4.42 + NAME 'dnsTTL' + DESC 'DNS Time To Live value' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) # Public object classes @@ -533,7 +539,7 @@ objectclass ( 1.3.6.1.4.1.9586.100.4.3.2 MUST ( host $ hostname ) MAY ( c $ access $ admin $ architecture $ bandwidth $ description $ disk $ distribution $ l $ machine $ memory $ sponsor $ - sponsor-admin $ status $ physicalHost $ ipHostNumber $ + sponsor-admin $ status $ physicalHost $ ipHostNumber $ dnsTTL $ sshRSAHostKey $ purpose $ allowedGroups $ exportOptions $ MXRecord $ sshdistAuthKeysHost ) ) -- 2.20.1