From: Peter Palfrader Date: Fri, 7 Jun 2013 17:02:14 +0000 (+0200) Subject: Allow incoming-mx remapping in ud-generate X-Git-Tag: userdir-ldap-0.3.85~50 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=commitdiff_plain;h=76b0b3995616eae1e623593077ee348d550cf742 Allow incoming-mx remapping in ud-generate --- diff --git a/debian/changelog b/debian/changelog index 7214594..f676b6a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -58,6 +58,7 @@ userdir-ldap (0.3.80) UNRELEASED; urgency=low * ud-generate: Allow more than one email address in userForward. Quite useful for role accounts. * ud-generate: Support writing gitolite config for just one user-group. + * ud-generate: Support MX remapping. [ Stephen Gran ] * Fix deprecation warnings for sha module by using hashlib module instead diff --git a/ud-generate b/ud-generate index 6e857b9..a2b28f9 100755 --- a/ud-generate +++ b/ud-generate @@ -71,6 +71,7 @@ isSSHFP = re.compile("^\s*IN\s+SSHFP") DNSZone = ".debian.net" Keyrings = ConfModule.sync_keyrings.split(":") GitoliteSSHRestrictions = getattr(ConfModule, "gitolitesshrestrictions", None) +MX_remap = json.loads(ConfModule.MX_remap) def prettify(elem): """Return a pretty-printed XML string for the Element. @@ -855,7 +856,11 @@ def ExtractDNSInfo(x): if x[1].has_key("mXRecord"): for I in x[1]["mXRecord"]: - DNSInfo.append("%sIN\tMX\t%s" % (TTLprefix, I)) + if I in MX_remap: + for e in MX_remap[I]: + DNSInfo.append("%sIN\tMX\t%s" % (TTLprefix, e)) + else: + DNSInfo.append("%sIN\tMX\t%s" % (TTLprefix, I)) return DNSInfo diff --git a/userdir-ldap.conf b/userdir-ldap.conf index 4efd923..28f3189 100644 --- a/userdir-ldap.conf +++ b/userdir-ldap.conf @@ -88,3 +88,5 @@ countrylist = "/var/www/userdir-ldap/domains.tab"; # only create sshfp and A records for hostnames matching this: dns_hostmatch = "[a-zA-Z0-9\.]+\.debian\.org$" + +MX_remap = '{"INCOMING-MX": ["10 mailly.debian.org.", "10 merikanto.debian.org.", "10 muffat.debian.org."]}'