SaltDns. Import. Axfr
(Salt v1.0.0)
A zone transfer (AXFR, RFC 5936) client over TCP, for importing a zone from an existing primary.
Axfr.transfer("example.com", address: "192.0.2.53", port: 53,
tsig: %{name: "key", algorithm: "hmac-sha256", secret: "base64"})It talks to exactly one address and port, the ones given (an IP literal:
names are not resolved here, so nothing is redirected or looked up behind
the caller's back; DNS has no redirects). :address_filter lets the caller
refuse addresses (for example private ones) before any connection is made.
Protocol rules applied (RFC 5936 section 2.2)
- The query has RD clear and no EDNS; the response must have the query's
ID, QR set, opcode 0 and RCODE 0 (otherwise
{:rcode, name}). - The first record must be the zone's SOA. The transfer ends at the next
SOA, which must have the same serial (
:soa_serial_mismatch) and the zone's name; data after it is an error. Intermediate messages carry none, so a second SOA always ends the transfer. - Duplicate records are ignored. The returned list holds the SOA once, first.
- Out-of-order data is fine: the zone is an unordered set of RRs.
TSIG
With :tsig, the algorithm must be one SaltDns.Auth.TsigPolicy allows,
the request is signed and every response message is verified as RFC 8945
section 5.3.1 prescribes (SaltDns.Import.Axfr.TsigStream); the first and
last messages must be signed. Nothing is returned unless the whole
transfer verified. An unsigned error response is reported as its RCODE
only.
Limits
:max_records (default 200 000 distinct records), :max_message_size
(default 65 535 bytes, the TCP maximum), :max_bytes (default 64 MiB in
all), :timeout (default 60 000 ms for the whole transfer, connect
included).
Summary
Functions
Transfers zone. See the moduledoc for the options.
Types
@type error() :: :invalid_address | :address_not_allowed | :invalid_tsig | :algorithm_not_allowed | :invalid_secret | {:connect, term()} | :timeout | :closed | {:rcode, atom() | non_neg_integer()} | :malformed | :unexpected_message | :first_record_not_soa | :soa_serial_mismatch | :soa_name_mismatch | :data_after_final_soa | :too_many_records | :too_large | {:tsig, SaltDns.Import.Axfr.TsigStream.error()} | {:socket, term()}
Functions
@spec transfer(String.t(), keyword()) :: {:ok, SaltDns.Import.Axfr.Result.t()} | {:error, error()}
Transfers zone. See the moduledoc for the options.