SaltDns.Import.ZoneFile (Salt v1.0.0)

Parses an uploaded zone file (RFC 1035 section 5 master file format) with dns_zone from dns_erlang: $ORIGIN, $TTL, relative names, parentheses, @, repeated owners.

The text is untrusted, so:

  • it is limited to :max_bytes (default 5 MiB) and :max_records (default 200 000);
  • $INCLUDE (would read the server's files) and $GENERATE (would expand without bound) are refused before parsing;
  • only class IN is accepted (dns_zone default).

dns_zone reads a trailing hex field of SSHFP, TLSA and DS records as a number or a domain name, so a line ending in one bare hex token has that token quoted first; the data is unchanged.

Returns dns_erlang #dns_rr{} tuples, the same shape the AXFR client returns, for SaltDns.Import.

Summary

Functions

Parses text for the zone origin (absolute, with or without a trailing dot). Options: :max_bytes, :max_records, :default_ttl (for files with no $TTL, default 3600).

Types

error()

@type error() ::
  :too_large
  | :too_many_records
  | {:directive_not_allowed, String.t()}
  | {:parse_error, %{message: String.t(), line: pos_integer() | nil}}
  | :invalid_origin

Functions

parse(text, origin, opts \\ [])

@spec parse(term(), term(), keyword()) :: {:ok, [tuple()]} | {:error, error()}

Parses text for the zone origin (absolute, with or without a trailing dot). Options: :max_bytes, :max_records, :default_ttl (for files with no $TTL, default 3600).