X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-generate;h=795816ca0e03594cc5b524fcee843fb89b143df6;hb=ce64087cfde96cea951f7d016aff0128fb7cf678;hp=3b9a6277de292897c473d8c25926c49d2d8cdd59;hpb=f713c17881194c50a838b5211075abf75470c054;p=mirror%2Fuserdir-ldap.git diff --git a/ud-generate b/ud-generate index 3b9a627..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 @@ -986,7 +989,10 @@ def GenSSHKnown(File, mode=None): for I in x[1]["sshRSAHostKey"]: if mode and mode == 'authorized_keys': - Line = 'command="rsync --server --sender -pr . /var/cache/userdir-ldap/hosts/%s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,from="%s" %s' % (Host, ",".join(HostToIP(x)), I) + hosts = HostToIP(x) + if 'sshdistAuthKeysHost' in x[1]: + hosts += x[1]['sshdistAuthKeysHost'] + Line = 'command="rsync --server --sender -pr . /var/cache/userdir-ldap/hosts/%s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,from="%s" %s' % (Host, ",".join(hosts), I) #Line = 'command="rsync --server --sender -pr . /var/cache/userdir-ldap/hosts/%s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding %s' % (Host,I) else: Line = "%s %s" %(",".join(HostNames + HostToIP(x, False)), I) @@ -1077,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"