The sqldns framework

The sqldns series of programs are DNS servers that accepts iterative DNS queries from hosts around the Internet, and responds with information derived from a set of SQL tables.

Configuration

The program runs chrooted in the directory specified by the $ROOT environment variable, under the uid and gid specified by the $UID and $GID environment variables.

The program listens for incoming UDP packets addressed to port 53 of $IP. It does not listen for TCP queries.

It loads in the nameserver names and IPs from NS0 through NS9. Each such nameserver must consist of a fully qualified domain name, a colon, and its IP. The TTL for the additional A records is read from $NS_IP_TTL, and the TTL for the NS name records is read from $NS_NAME_TTL. Both values default to 65536.

The program serves out an automatically generated SOA record for each domain listed in the tables. The TTL, refresh, retry, expire, minimum, and mailbox values for this SOA are read from $SOA_TTL, $SOA_REFRESH, $SOA_RETRY, $SOA_EXPIRE, $SOA_MINIMUM, and $SOA_MAILBOX, which default to 2560, 4096, 256, 65536, 2560, and "hostmaster". If the mailbox name is not qualified when the SOA record is generated, the domain name is appended to it. The serial number is always set to the current UNIX epoch time.

Further details

The schema for the program is described here.

See also the documentation for djbdns, in particular the documentation for tinydns, with which this program shares many features.