Storing ASCII art in the DNS

2014-02-05 16:38

From time to time, I like to do some quick DNS related experiments, and storing ASCII art in the DNS had been on my idea list for quite a while.

The naive approach to this problem would be to simply use TXT records, but there are a couple of issues with this method. First, it's not possible to specify the order of priority of TXT records, and results seem to vary depending on implementations. But moreover, there is no way to have several times the exact same line, as the records would be identical and only one would be taken into account when parsing the zone.

On the other hand, NAPTR records look like the perfect candidates for this purpose, as they can be ordered using the Order and Preference fields (see RFC 2915, for the NAPTR RR Format).

For this experiment, the first ASCII diagram from RFC 1035 will be used.

Here is the content of the zone:

ascii NAPTR 100 10 "" " Local Host | Foreign " "" . ascii NAPTR 110 10 "" " | " "" . ascii NAPTR 120 10 "" " +---------+ +----------+ | +--------+ " "" . ascii NAPTR 130 10 "" " | | user queries | |queries | | | " "" . ascii NAPTR 140 10 "" " | User |-------------->| |---------|->|Foreign | " "" . ascii NAPTR 150 10 "" " | Program | | Resolver | | | Name | " "" . ascii NAPTR 160 10 "" " | |<--------------| |<--------|--| Server | " "" . ascii NAPTR 170 10 "" " | | user responses| |responses| | | " "" . ascii NAPTR 180 10 "" " +---------+ +----------+ | +--------+ " "" . ascii NAPTR 190 10 "" " | A | " "" . ascii NAPTR 200 10 "" " cache additions | | references | " "" . ascii NAPTR 210 10 "" " V | | " "" . ascii NAPTR 220 10 "" " +----------+ | " "" . ascii NAPTR 230 10 "" " | cache | | " "" . ascii NAPTR 240 10 "" " +----------+ | " "" .

And the result of querying the zone for NAPTR records: