knot-dns/tests-extra/tests/modules/alias/data/example.zone
Bron Gondwana 2946fe16f2 mod-alias: synthesise ALIAS records from locally-served targets
Add the `mod-alias` query module which synthesises answers for ALIAS
records (type 65401) at query time by looking up the ALIAS target in
the server's zone database and copying the target's records into the
response with the original query name as the owner.

The module hooks at KNOTD_STAGE_PREANSWER and is attached at zone
scope (typically via a template).  Behaviour:

  * Fires for A/AAAA queries, any others passed through to the
    standard resolver.
  * ALIAS is additive: direct rrsets on the alias node are merged
    with the synthesised target rrsets.
  * Multiple ALIAS rdata on a node are followed and their results
    merged.
  * TTL = min(alias_ttl, all contributing source TTLs).
  * Targets not served by a zone in this server are ignored;
    external resolution is out of scope.
  * Synthesised records are not signed; pair with mod-onlinesign
    if signed answers are required.

The integration test runs in two random modes per invocation
(plain and DNSSEC-via-mod-onlinesign) so both code paths are
exercised over time.

Co-authored-by: Daniel Salzman <daniel.salzman@nic.cz>
2026-05-10 23:36:27 -04:00

49 lines
1.7 KiB
Dns

$ORIGIN example.
$TTL 300
@ IN SOA ns.example. mail.example. ( 1 3600 900 604800 300 )
@ IN NS ns.example.
ns IN A 192.0.2.254
mx IN A 192.0.2.253
; Basic: pure ALIAS to a locally-served target.
www 600 IN ALIAS web._ips.example.
; ALIAS plus direct MX on the same node — both must be returnable.
www 300 IN MX 10 mail.example.
; ALIAS to a non-local target; should yield NODATA.
external 300 IN ALIAS web.external.tld.
; Multiple ALIAS rdata on one node; both targets' A records should merge.
multi 300 IN ALIAS web._ips.example.
multi 300 IN ALIAS alt._ips.example.
; Self-referential ALIAS with no A on target — NODATA.
loop 300 IN ALIAS loop.example.
; Self-referential ALIAS with coexisting direct A.
loop2 300 IN ALIAS loop2.example.
loop2 300 IN A 10.0.0.4
; Coexisting ALIAS + direct A; additive.
both 300 IN ALIAS web._ips.example.
both 300 IN A 10.0.0.3
; TTL cap demonstration: alias_ttl=600, target_ttl=300 → synthesised ttl=300.
lowttl 600 IN ALIAS web._ips.example.
; Wildcard ALIAS plus a specific plain-A override.
*.wild1 300 IN ALIAS web._ips.example.
over.wild1 300 IN A 10.0.0.1
; Wildcard plain A plus a specific ALIAS override.
*.wild2 300 IN A 10.0.0.2
login.wild2 300 IN ALIAS web._ips.example.
; Wildcard ALIAS with a specific ALIAS override pointing at a different target.
*.wild3 300 IN ALIAS web._ips.example.
other.wild3 300 IN ALIAS alt._ips.example.
; MX query on an ALIAS node has no effect — only direct MX record
mixmx 300 IN ALIAS mail._ips.example.
mixmx 300 IN MX 20 mx.example.