Score:1

Specifying an IPv6 MX record via djbdns or djbdns-fefe?

by flag

I'm trying to set up IPv6 MX records in my djbdns environment. I also am experimenting with djbdns-fefe for this same purpose.

According to the djbnds-fefe documentation, "... tinydns-edit won't accept IPv6 addresses for NS or MX records yet". Furthermore, I don't know of a way to set up IPv6 records in the traditional djbdns environment.

I've been searching for a solution to this issue, but I haven't been able to find anything.

I don't want to completely abandon dbjdns or djbdns-fefe, so does anyone know of a way that I can set up IPv6 MX records in a djbdns or djbdns-fefe environment?

... or is this simply impossible?

Thank you in advance.

UPDATE:

To be clear, the specification for a djbdns-created MX record takes ...

  1. the top-level DNS name of the MX record, (e.g., "example.com");

  2. the IP address to assign to the MX domain name that it will generate, (e.g., "10.11.12.13");

  3. a prefix for the MX domain name that it will generate (e.g., "x");

  4. a priority (e.g., 0).

In this example, it would create the following "MX" record:

example.com. IN MX 86400 0 x.mx.example.com.

And it also automatically creates a second record: an "A" record:

x.mx.example.com. IN A 86400 10.11.12.13

The problem is that the syntax in djbdns for creating an MX record will never accept an IPv6 address for item 2 above, and it will never automatically create any AAAA record as a result of its MX record specification.

And although the djbdns-fefe software allows the direct creation of AAAA records, neither djbdns-fefe nor the original djbdns provides any way to create an MX record that references the IPv6-based domain name that is specified in that AAAA record.

I'm trying to find a workaround for this limitation so that I can still use djbdns to create an IPv6-based MX record, if possible.

These are the specs for the original djbdns syntax ...

https://cr.yp.to/djbdns/tinydns-data.html

And this is the documentation for the djbdns-fefe IPv6 enhancement ...

https://www.fefe.de/dns/

user1686 avatar
fr flag
The premise of this question confuses me a bit – normally IP addresses do not go in NS or MX records _at all,_ only domain names do. Is this some djbdns-specific shortcut?
HippoMan avatar
by flag
Yes, djbdns syntax takes IP addresses for the construction of MX records. It doesn't even accept domain names. I realize that this is not "standard", but it's what I have to live with unless I move away from djbdns.
user1686 avatar
fr flag
That's interesting. Does it make up some temporary domain names for that purpose? (I mean it's not just about what you put in DNS, it's about what clients *see* in DNS in the end, so if they see an autogenerated subdomain then that's fine standards-wise, if *quite* odd... but not accepting domain names in the zonefile is *extremely* odd.)
HippoMan avatar
by flag
To be clear, the specification for a djbdns-created MX record takes (1) the top-level DNS name of the MX record, (e.g., "example.com"); (2) the IP addr to assign to the MX domain name, (e.g., "10.11.12.13'); (3) a prefix for the resulting MX domain name (e.g., "x"); (4) a priority (e.g. 0). In this case, it creates the following record: `example.com. IN MX 86400 0 x.mx.example.com.`. It also creates another entry: `x.mx.example.com. IN A 86400 10.11.12.13`. The problem is that djbdns will not accept an IPv6 addr for item (2) above, and it doesn't create any AAAA record.
HippoMan avatar
by flag
I also added more clarification in the "UPDATE" to my original question, above.
Score:0
by flag

I have to undo this as an Answer, because after running with this for a few days, I see that it doesn't work the way I was hoping. The auto-generated afxr bind9 output has a few limitations, and many of my subdomains cannot be accessed.

For the time being, I have switched back to tinydns, and I am just not using IPv6 for the moment.

I'll leave this original answer here, in case someone who reads it might be able to see the flaw(s) and possibly suggest something that will actually work.

I apologize.

Original Answer Which Turns Out Not To Work

This isn't quite a positive answer to my question, but it's the best that I've been able to come up with.

It seems like I am totally out of luck regarding djbdns and djbdns-fefe offering syntax for specifying IPv6 MX records, and after much searching, I still haven't found any hacks or workarounds which would allow me to do this exactly in the way that I have been asking here.

However, I found an indirect way to do this without completely abandoning my djbdns tinydns-based configuration info.

First of all, it's important for me to explain that years ago, I wrote a custom utility to generate tinydns commands based on a more user-friendly syntax (where the particular user I'm being friendly to is "me" ... LOL). For the time being, I want to continue to use this utility.

My "solution" to the IPv6 MX issue is to continue to use that old, custom utility, and now to also write a new utility that will allow me to generate bind9 configuration files based upon my current djbdns configuration, and then switch to using bind9 instead of djbdns. In bind9, I can then indeed get the IPv6 MX records set up.

Some day, I'll re-write my old, original custom utility so that it will directly generate bind9-specific records without my having to go through the intermediate step of djbdns-configuration-to-bind9-configuration conversion. But I don't have time to do that now, so here is the new utility I wrote to convert djbdns configuration information to bind9 configuration files ...

This new utility is a complicated python script which is too long to list here in its entirety, so I'll just summarize its workings. And in any case, a lot of it is specific to my particular host, and so I doubt that the script as written will run anywhere but on my own host. But in general, it functions as follows ...

(1) Install and set up a working bind9 service.

(2) Even though I'm now using bind9, the djbdjs server still needs to be running in order for my script to work. I set it up as a "dummy" DNS server which only listens on a private, local-only address.

(3) In the python script, I created a list called "email_hosts" which contains the names of the top-level domains which will need IPv6 MX records.

(4) When this new script is started, it first fires off a daemon via the python "multiprocessing" package which runs this comand ...

/command/envuidgid root /usr/bin/tcpserver -vDHRl0 [DNSSERVERADDR] 53 /command/axfrdns

... where [DNSSERVERADDR] is the private, local-only address that the dummy djbdns server is listening on.

(5) The script waits until that daemon is up and running, and it then fires off another daemon via the python "multiprocessing" package which loops through the names of all the domains that I am hosting, and for each domain (which I'll call [DOMAINNAME], below), it runs this command ...

/usr/bin/dig axfr [DOMAINNAME] @[DNSSERVERADDR]

(6) The output of each "dig" call is captured, and then I loop through all the lines in that output. If I encounter an AAAA record for any of the domains whose names I have stored in the "email_hosts" list mentioned above, I do the following ...

(7) Take the domain name of that particular AAAA record, which I'll call [DOMAINNAME], and prepend the prefix "mx." to that domain name. I'll call that result [MXNAME]. For example, if [DOMAINNAME] is "myhost.example.com", then [MXNAME] will contain the name "mx.myhost.example.com".

(8) I then add the following additional lines to the output list, assuming that the IPv6 address of "myhost.example.com" in its AAAA record is [IPV6ADDRESS]:

mx.myhost.example.com 86400 IN AAAA [IPV6ADDRESS]
myhost.example.com    86400 IN MX   mx.myhost.example.com 10

(9) I concatenate all these output lines for the given domain, including the two new lines that I might have created, and then I write the result to a file called "db.[DOMAINNAME]" in the /var/lib/bind directory (whose original contents I have previously backed up as /var/lib/bind.backup).

(10) In addition, for each [DOMAINNAME] processed in this dig-axfr-output-based client, I also append the following text to a new /etc/bind/named.conf.local file (after having backed up the current version as /etc/bind/named.conf.local.backup) ...

zone "[DOMAINNAME]" {
  type master;
  file "/var/lib/bind/db.[DOMAINNAME]";
};

Also note that the top of this newly created /etc/bind/named.local.conf file looks like this:

include "/etc/bind/zones.rfc1918";

(11) After I have processed all of the domains in this manner, I terminate both of the daemons that I had started via python's "multiprocessing" mechanism.

(12) I then restart the "named" daemon.

This way, I can continue to use the same utility that I have written years ago for simplifying the generation of tinydns commands, but at the same time, I'm actually utilizing bind9 as my DNS server now.

And as I mentioned above, I'll eventually rewrite that utility to directly generate bind9-specific records. Then, this entire axfr-based procedure will go away.

As much as I have been happy with djbdns for all these years, I have to admit that I think I'm better off nowadays using bind9.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.