tinydns-edit

## Name

tinydns-edit — edit the source data file used by a content DNS server

## Synopsis

`tinydns-edit` {`data`} {`tmp`} {add} {`type`} {`name`} {`addr`}

## Description

tinydns-edit atomically modifies a database source file, the input compiled by tinydns-data(1), with the given modification. It reads the data file `data`, modifies it, and writes it to `tmp`. Then it atomically renames `tmp` to `data`. The two files must, of course, reside on the same volume in order that this can be achieved.

On success, tinydns-edit returns zero. If, for any reason, an error occurs it will exit with a non-zero code and `data` will not be changed.

The add verb is the only supported verb in this version. In response to it, tinydns-edit adds a record to the database for fully-qualified domain name `name` of type `type` with IP address `addr`.

`type` can be one of

`ns`

  A `.` record is created to describe a content DNS server. This record specifies that the domain `name` is published by a DNS content server that is listening on the IP address `addr`. The name of the DNS content server is not directly specifiable.

`childns`

  A `&` record is created describing a delegation. This record specifies that queries for names in the domain `name` should be referred to a ("child") DNS content server that is listening on the IP address `addr`. The name of the DNS content server is not directly specifiable.

`mx`

  A `@` record is created describing a mail exchanger. This record specifies that mail to names in the domain `name` should be sent to an SMTP server that is listening on the IP address `addr`. The name of the SMTP server is not directly specifiable.

  It is not possible to specify the distance value for the SMTP server. tinydns-edit will leave that field blank, meaning that tinydns-data (8) will use whatever the default value is.

`host`

  A `=` record is created describing a bidirectional name to address mapping. This record specifies that the name `name` maps to the IP address `addr` and vice versa.

`alias`

  A `+` record is created describing a unidirectional name to address mapping. This record specifies that the name `name` maps to the IP address `addr`address but that there is no reverse mapping.

Intermediate domain names are assigned by tinydns-edit itself. For `ns` and `childns` records there is an intermediate domain name of the form ``a`.ns.`name``. For `mx` records there is an intermediate domain name of the form ``a`.mx.`name``. `a` is a letter from "a" to "z". tinydns-edit checks existing records of the same pattern and for the record being added picks the first available unused letter. It aborts if there are no letters left.

For `host` records it aborts if there is already a `=` record that has either `name` or `addr`. By the nature of `alias` records, tinydns-edit will not abort if there happen to already be existing records that use `addr`.

If any existing `ns`, `childns`, and `mx` records are found when adding that type, it copies their TTL for the record being added. Otherwise, where no existing records exist and for other types of records, a fixed default TTL is used. This is 1 day for all records, except for `ns` and `childns` records for which it is 3 days.

## History

tinydns-edit was originally part of Daniel J. Bernstein's djbdns toolset in 2000. This manual page was written on 2001-04-06, and revised in 2001-04-26, and again in 2017.

## Author

Original code by Daniel J. Bernstein. Documentation by Jonathan de Boyne Pollard.