#181

Mar 6, 2022

Books

This week I read:

Programming

My DNS server has moved on quite a bit since last week. Back then it couldn’t even recursively resolve names: now it can! Here’s a summary of the changes:

I could actually use it for my home DNS now, as a replacement for my Pi-hole: the last blocker for using existing DNS blocklists was hosts file support and that’s there now.

Before I switch over though I want to add support for zone files, so that I can read the root.hints file. Currently I specify the IPs directly in a configuration file:

root_hints:
  - "198.41.0.4"     # a.root-servers.net
  - "199.9.14.201"   # b.root-servers.net
  - "192.33.4.12"    # c.root-servers.net
  - "199.7.91.13"    # d.root-servers.net
  - "192.203.230.10" # e.root-servers.net
  - "192.5.5.241"    # f.root-servers.net
  - "192.112.36.4"   # g.root-servers.net
  - "198.97.190.53"  # h.root-servers.net
  - "192.36.148.17"  # i.root-servers.net
  - "192.58.128.30"  # j.root-servers.net
  - "193.0.14.129"   # k.root-servers.net
  - "199.7.83.42"    # l.root-servers.net
  - "202.12.27.33"   # m.root-servers.net

…but manually reading one configuration file to stick values into another isn’t a great workflow. They don’t change very often but, still, it’s not ideal.

Once I can read zone files, I’ll be able to use the root.hints file, and also specify custom records in the standard format, like:

$ORIGIN lan.

nyarlathotep      300    IN    A        10.0.0.3
*.nyarlathotep    300    IN    CNAME    nyarlathotep

Section 5 of RFC 1035 has the format. Annoyingly it’s not quite line-oriented: parentheses can be used to indicate a value extends over a multiple lines.

There are some other nice-to-haves, like dropping the config file entirely in favour of command-line arguments, improving logging, and reloading all the zone & hosts files with SIGHUP. But those can come later.