SaltDns.AddressFilter (Salt v1.0.0)

Decides which addresses the server may connect to on a user's behalf (the primary of an AXFR import). Only public, globally routable unicast addresses pass; everything an attacker could use to reach this host's own network is refused:

  • IPv4: 0.0.0.0/8 (unspecified, "this network"), 10.0.0.0/8, 100.64/10 (carrier-grade NAT), 127.0.0.0/8 (loopback), 169.254.0.0/16 (link-local), 172.16.0.0/12, 192.0.0.0/24, 192.0.2.0/24, 192.88.99.0/24, 192.168.0.0/16, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24 (special use and documentation), 224.0.0.0/4 (multicast) and 240.0.0.0/4 (reserved, with the broadcast address).
  • IPv6: only 2000::/3 can pass, minus 2001::/23 (protocol assignments, Teredo, ORCHID), 2001:db8::/32 and 3fff::/20 (documentation). Addresses that embed an IPv4 address (IPv4-mapped ::ffff:0:0/96, NAT64 64:ff9b::/96, 6to4 2002::/16) are judged by the embedded IPv4 address; the other NAT64 range, loopback, unspecified, unique-local fc00::/7, link-local fe80::/10, site-local, multicast and the IPv4-compatible ::/96 are refused by not being in 2000::/3.

A configured allowlist overrides all of that, for deployments that must import from an internal primary:

config :salt_dns, SaltDns.AddressFilter, allow: ["10.83.0.0/16"]

The test environment allows the development stack's network. Addresses are IP literals (tuples or text); names are never resolved here.

Summary

Functions

True when address may be connected to. Never raises.

:ok, or {:error, :invalid_address | :not_public}.

True when address is a public, globally routable unicast address, ignoring the configured allowlist. For callers that must never be pointed at an internal network, whatever the deployment allows for other purposes (the HTTP-01 self-check).

Types

reason()

@type reason() :: :invalid_address | :not_public

Functions

allowed?(address)

@spec allowed?(term()) :: boolean()

True when address may be connected to. Never raises.

check(address)

@spec check(term()) :: :ok | {:error, reason()}

:ok, or {:error, :invalid_address | :not_public}.

public_only?(address)

@spec public_only?(term()) :: boolean()

True when address is a public, globally routable unicast address, ignoring the configured allowlist. For callers that must never be pointed at an internal network, whatever the deployment allows for other purposes (the HTTP-01 self-check).