Bring your own secondaries
Salt publishes its zones to its own edges. You can also let nameservers you already run (BIND, NSD, Knot, PowerDNS) serve the same zones as secondaries, through ordinary zone transfers (AXFR/IXFR with TSIG) and catalog zones (RFC 9432): new zones appear on your server by themselves and deleted ones go away.
How it works
- Each organisation has a catalog zone,
o<id>.catalog.invalid(the name is not public). It lists the organisation's active zones, and only those: pending zones are in no catalog. - You register a secondary in the console (Organisation settings → Secondaries, since secondaries copy every active zone) or
through the API (
/api/v1/secondaries). Only owners and admins, or tokens with a grant for zoneanyand actionmanage, can. Give it a name and the addresses (IP literals) it transfers from. - Salt generates a TSIG key for it (
hmac-sha256) and shows the secret once, with ready-made configuration for BIND, NSD, Knot and PowerDNS. Lose it and you rotate the key. - Salt then configures the primary: the key, the secondary as a NOTIFY target, and a transfer rule for your organisation's zones and catalog that needs both the secondary's address and its key. Other organisations' zones are never transferable with your key.
- Your server reads the catalog from
SALT_DNS_TRANSFER_HOST(portSALT_DNS_TRANSFER_PORT, see configuration.md) and follows it. A change is announced with NOTIFY and fetched by IXFR (PowerDNS by AXFR).
The primary's transfer address must be reachable by your servers. It may be a
public address (the transfer is refused without your key and your address,
see the primary) or a private one
that you reach over a VPN or with a firewall rule; SALT_DNS_TRANSFER_HOST and
SALT_DNS_TRANSFER_PORT must name the address your servers really use.
A secondary that cannot receive NOTIFY
NOTIFY travels from the primary to the secondary's registered address. A secondary behind NAT or a firewall that drops it still works: it transfers from the primary (an outgoing connection) every time its timer says so (the zone's SOA refresh, 3 hours by default), so changes reach it late, not never.
A NOTIFY to an address that does not answer waits for a timeout on the primary (1 s in the example configuration). That cannot hold up or lose a change on the edges: they also ask the primary every 5 s (keeping the edges current). Remove a secondary you no longer use all the same.
A secondary whose transfers arrive from another address
A container platform or a load balancer in front of the secondary can rewrite the source of its queries to an address that is not the secondary's own (a Docker or Swarm ingress gateway, for example). The transfer then comes from that address, and the ACL that lets the secondary in does not match it.
Extra source addresses (the console's form field, or extra_sources in the
API) list those addresses or networks, one per line, for example 10.0.1.1 or
10.0.1.0/24. They widen the transfer ACL only:
- the TSIG key is still required, so a wrong client on that network gets nothing;
- they are not used as a NOTIFY destination (that stays the registered address);
- private addresses are allowed here, unlike the addresses themselves, because an ingress gateway is a private one;
- each is checked to be an IP address or network; eight at most.
Salt logs every change to them with the secondary's id and organisation, and
the secondary's line on the page shows also accepted from …. The NOTIFY side
is the secondary's own configuration: a PowerDNS secondary needs
allow-notify-from for the same address in its own settings.
BIND
Needs 9.18 or newer (catalog zones, schema versions 1 and 2). The console shows
the catalog-zones clause for the options block and the key and zone
statements; reload with rndc reconfig.
NSD
Needs 4.9 or newer. A catalog consumer zone with catalog-member-pattern.
NSD follows one consumer catalog, so one NSD server can be a secondary of one
organisation. Apply with nsd-control reconfig.
Knot DNS
A zone with catalog-role: interpret and a catalog-template. Merge into
knot.conf and knotc reload. Knot does not answer queries for a catalog zone it
interprets; check the member zones instead.
PowerDNS
Needs 4.7 or newer with a SQL backend. Register the TSIG key and a Consumer
zone through the HTTP API (the console prints the two curl calls).
PowerDNS 4.9 cannot sign the transfers of catalog member zones, so register this
secondary with sign_zone_transfers: false: your zones are then transferable from
your registered addresses without a key, and the catalog still needs the key.
PowerDNS fetches zones by AXFR.
Checking that it works
- From the secondary's address:
dig @<transfer host> -p <port> o<id>.catalog.invalid AXFR -y hmac-sha256:<key name>:<secret>lists your zones; without the key (or from another address) it is refused. - Compare serials:
dig +short SOA example.org @<primary>and@<your server>. - The console lists each secondary with its key name and address.
Removing one
Delete it in the console or with DELETE /api/v1/secondaries/{id}: its key,
remote and transfer rule are removed from the primary, and its transfers are
refused from then on.