SaltDns.Propagation (Salt v1.0.0)

What the public DNS says about a zone after its name servers moved: who the parent delegates it to, whether every delegated server answers, and whether they answer with the serial Salt's primary has.

This is the question an owner asks after changing the NS records at the registrar, and it cannot be answered from Salt's database. It reads:

  1. The parent's referral — SaltDns.Resolver.delegation/1, the NS names the parent's own servers publish for the zone (a recursive resolver would ask the zone, which may not be served yet).
  2. Which of those are Salt's — the configured nameservers (config :salt_dns, :nameservers, the names customers delegate to). A delegated name that is not one of them is another provider, and that is exactly the "the old provider still answers" case.
  3. Each delegated server — every address of every delegated name is asked for the zone's SOA, directly and without recursion, and the serial is compared with the primary's (SaltDns.Knot). An address this host cannot reach (no IPv6 route, for example) is :unchecked, never "no answer".

Nothing is changed and no key is needed. The resolver, the address lookup and the SOA asker are injectable for tests through :resolver, :addresses, :prober and :primary.

Summary

Functions

Checks zone as the public DNS sees it. Options: :resolver (default SaltDns.Resolver), :nameservers (default the configured ones), :addresses (a function from a name to its addresses), :prober (a function (address, port, zone) -> {:ok, serial} | {:error, reason}), :primary (a function from the zone name to the primary's serial, or a number, or nil) and :port (default 53).

Types

server()

@type server() :: %{
  host: String.t(),
  address: String.t() | nil,
  serial: non_neg_integer() | nil,
  state: state(),
  detail: String.t() | nil
}

state()

@type state() ::
  :current
  | :behind
  | :ahead
  | :answered
  | :no_answer
  | :refused
  | :servfail
  | :unchecked

t()

@type t() :: %{
  zone: String.t(),
  configured: [String.t()],
  delegation: {:ok, [String.t()]} | {:error, atom()},
  matched: [String.t()],
  foreign: [String.t()],
  missing: [String.t()],
  servers: [server()],
  primary: non_neg_integer() | nil,
  verdict: :ok | :waiting | :mixed | :wrong | :unavailable
}

Functions

check(zone, opts \\ [])

@spec check(String.t(), keyword()) :: t()

Checks zone as the public DNS sees it. Options: :resolver (default SaltDns.Resolver), :nameservers (default the configured ones), :addresses (a function from a name to its addresses), :prober (a function (address, port, zone) -> {:ok, serial} | {:error, reason}), :primary (a function from the zone name to the primary's serial, or a number, or nil) and :port (default 53).