SaltDns. Resolver. Delegation
(Salt v1.0.0)
The delegation of a zone as its parent publishes it.
A recursive resolver answers NS <zone> from the zone's own nameservers,
so it says nothing for a zone that is delegated but not served yet (a
pending zone is deliberately not served on the public edge). The parent's
referral is what proves the delegation, and it is read here directly:
- The parent zone cut. The SOA of the zone's parent name is asked
from the recursive resolver; the owner of the SOA record, in the answer
or in the authority section of a negative answer, is the apex of the
enclosing zone. Names without an SOA move one label up, to
max_depthsteps. - The parent's servers. The recursive resolver gives the NS names of
that apex and their A and AAAA addresses. Only addresses that pass
SaltDns.AddressFilterare ever queried (public addresses plus the configured allowlist, which the test environment sets to the development stack's network), at mostmax_serversof them. - The referral. Each server is asked directly (recursion off) for
NS <zone>until one gives a definite answer: the NS set of the authority section (a referral), or of the answer section when the parent also serves the child. An answer without NS and with an SOA (or an authoritative flag) means "not delegated here": an empty set. Timeouts, SERVFAIL, REFUSED, and replies from a server that is not authoritative for the parent (neither an NS set nor an SOA) are inconclusive for that server and the next one is tried; when none answers definitely the result is an error.
The whole walk has a deadline (delegation_timeout, default 10 000 ms) and
every question is capped by it. Settings (config :salt_dns, SaltDns.Resolver.DNS): max_depth 4, max_servers 6,
delegation_timeout, and authoritative_port (53; tests use another).
Summary
Functions
The TXT strings at name as the authoritative servers of its zone say
them (recursion off), not as a resolver's cache does. The zone is found as
for the parent's servers above (the SOA owner at or above the name's parent),
its servers' addresses come from the recursive resolvers and only addresses
that pass SaltDns.AddressFilter are asked, so a hostile zone cannot aim
the check at a private address.
The TXT strings at name from every authoritative server of its zone
(found as for authoritative_txt/1), one entry per server address with that
server's own answer. The servers are the zone's NS names as the public DNS
gives them, so secondaries and edges that receive the zone by transfer are
asked too. A server that does not answer has {:error, reason}; the list is
{:error, reason} only when the servers cannot be found at all.
The DS records the parent zone publishes for name, read from each of the
parent's authoritative servers (recursion off), not from a resolver's
cache. Every server must answer for the result to be definite; a server that
times out, refuses, fails or is not authoritative makes the whole lookup
{:error, reason}, because "the parent has no DS" must be true everywhere
before a signed zone may be unsigned.
The NS names (lower case, no trailing dot) the parent delegates name to.
The CAA records at the apex of zone as each address of each nameserver the
zone is delegated to says them, in the same shape and with the same errors as
zone_txt_each/2. Each record is its presentation form (0 issue "ca.test").
The TXT strings at name, a name inside the zone zone, from every
address of every nameserver the public DNS delegates zone to. This is the
DNS-01 case: the challenge record lives in the zone Salt DNS serves, below
the delegation point, and a certificate authority asks the zone's own
servers. (authoritative_txt_each/1 is for names whose record lives in the
parent zone, such as the ownership challenge, and must not be used for
this: it asks the parent's servers, which are lame for the child.)
Functions
@spec authoritative_txt(String.t()) :: SaltDns.Resolver.result()
The TXT strings at name as the authoritative servers of its zone say
them (recursion off), not as a resolver's cache does. The zone is found as
for the parent's servers above (the SOA owner at or above the name's parent),
its servers' addresses come from the recursive resolvers and only addresses
that pass SaltDns.AddressFilter are asked, so a hostile zone cannot aim
the check at a private address.
The first server that has a record decides ({:ok, strings}); if every
server that answers definitely has none, {:ok, []}; when no server gave a
definite answer, {:error, reason}.
@spec authoritative_txt_each(String.t()) :: {:ok, [%{server: String.t(), result: SaltDns.Resolver.result()}]} | {:error, SaltDns.Resolver.reason()}
The TXT strings at name from every authoritative server of its zone
(found as for authoritative_txt/1), one entry per server address with that
server's own answer. The servers are the zone's NS names as the public DNS
gives them, so secondaries and edges that receive the zone by transfer are
asked too. A server that does not answer has {:error, reason}; the list is
{:error, reason} only when the servers cannot be found at all.
@spec ds(String.t()) :: {:ok, SaltDns.Resolver.ds_result()} | {:error, SaltDns.Resolver.reason()}
The DS records the parent zone publishes for name, read from each of the
parent's authoritative servers (recursion off), not from a resolver's
cache. Every server must answer for the result to be definite; a server that
times out, refuses, fails or is not authoritative makes the whole lookup
{:error, reason}, because "the parent has no DS" must be true everywhere
before a signed zone may be unsigned.
Returns {:ok, %{servers: n, results: [...]}} where each result is
%{ds: [ds], ttl: ttl | nil, negative_ttl: ttl | nil} for one server, in
server order. SaltDns.Dnssec.Observe interprets it.
@spec lookup(String.t()) :: SaltDns.Resolver.result()
The NS names (lower case, no trailing dot) the parent delegates name to.
@spec zone_caa_each(String.t()) :: {:ok, [SaltDns.Resolver.server_answer()]} | {:error, SaltDns.Resolver.reason()}
The CAA records at the apex of zone as each address of each nameserver the
zone is delegated to says them, in the same shape and with the same errors as
zone_txt_each/2. Each record is its presentation form (0 issue "ca.test").
@spec zone_txt_each(String.t(), String.t()) :: {:ok, [SaltDns.Resolver.server_answer()]} | {:error, SaltDns.Resolver.reason()}
The TXT strings at name, a name inside the zone zone, from every
address of every nameserver the public DNS delegates zone to. This is the
DNS-01 case: the challenge record lives in the zone Salt DNS serves, below
the delegation point, and a certificate authority asks the zone's own
servers. (authoritative_txt_each/1 is for names whose record lives in the
parent zone, such as the ownership challenge, and must not be used for
this: it asks the parent's servers, which are lame for the child.)
The servers are found as a validating authority finds them: the NS set the
parent's referral gives for zone (lookup/1), then each host's A and AAAA
addresses from the recursive resolvers, filtered by SaltDns.AddressFilter.
Every address is asked directly, recursion off, in parallel. Returns
{:ok, [%{host:, address:, server:, result:}]}, one entry per address (a
host without a usable address has one entry with address: nil and
{:error, :no_address}); result is {:ok, strings} (possibly empty),
{:error, :timeout}, {:error, :unreachable} (this host has no route or no
socket for the address family), {:error, :lame} (not authoritative),
:refused or :servfail.
{:error, :not_delegated} when the parent names no nameserver for zone:
no provider can validate an undelegated zone. Other errors mean the
delegation could not be read right now (:unavailable, :timeout, ...).