erldns_dnssec behaviour (erldns v13.0.0)

View Source

DNSSEC implementation.

If you want to enable DNSSEC, you need to add this module to the packet pipeline after a resolver, that being an authoritative (e.g. erldns_resolver) or recursive (e.g. erldns_resolver_recursive).

You also need to provide the zone keys for signing, during loading, see ZONES for more details.

Configuration

{erldns, [
    {dnssec, #{
        authenticated_data => false %% Set AD on answers from signed zones (default: false)
    }}
]}

RFC 4035 §3.1.6 lets an authoritative server set AD only when explicitly configured to, and only for zones it obtained by secure means: enable it only if zones reach erldns over an authenticated channel.

Delegation points

The resolver puts the delegation a response refers to in the pipeline opts as zonecut (see erldns_resolver), and a referral is completed as RFC 4035 §3.1.4 requires: the authority section carries the delegation's DS RRset and its RRSIG, or an NSEC at the delegation name proving there is none. NS RRsets at delegation points, glue, and records occluded by a cut are never signed (§2.2), and an NSEC at a delegation name advertises only NS, DS, RRSIG and NSEC (RFC 4034 §4.1.2).

NSEC type-mapper extension

When a name only carries a custom type (e.g. a record that another pipeline stage synthesizes into A/CNAME at query time), the authenticated-denial NSEC record for that name must still advertise the standard types the client will actually receive, or validating resolvers reject the answer. A mapper widens the NSEC type bitmap accordingly.

A mapper is a fun((RecordType, QType) -> [Type]) implementing the nsec_rr_type_mapper/2 callback. To register one, the owning pipeline stage calls add_nsec_type_mapper/3 from its own erldns_pipeline:prepare/1:

prepare(Opts) ->
    erldns_dnssec:add_nsec_type_mapper(Opts, [?CUSTOM_TYPE], fun ?MODULE:nsec_rr_type_mapper/2).

Summary

Callbacks

NSEC type-mapper extension callback.

Functions

Register an NSEC type mapper for the given record types into the pipeline opts.

Get signed records from a zone.

Get the records of a zone signed with the zone signing key.

Given a zone and a set of records, return the RRSIG records.

Types

nsec_type_mapper_fun()

-type nsec_type_mapper_fun() :: fun((dns:type(), dns:type()) -> [dns:type()]).

nsec_type_mappers()

-type nsec_type_mappers() :: #{dns:type() => nsec_type_mapper_fun()}.

Callbacks

nsec_rr_type_mapper(RecordType, QType)

(optional)
-callback nsec_rr_type_mapper(RecordType :: dns:type(), QType :: dns:type()) -> [dns:type()].

NSEC type-mapper extension callback.

Pipeline stages that introduce custom record types (e.g. ALIAS) implement this to widen the NSEC type bitmap: given a record type present at a name and the query type, return the standard DNS types the custom type should be advertised as. The mapper is registered into the pipeline opts with add_nsec_type_mapper/3 from the stage's erldns_pipeline:prepare/1.

Functions

add_nsec_type_mapper(Opts, RecordTypes, Fun)

-spec add_nsec_type_mapper(erldns_pipeline:opts(), [dns:type()], nsec_type_mapper_fun()) ->
                              erldns_pipeline:opts().

Register an NSEC type mapper for the given record types into the pipeline opts.

Extension pipes call this from their own erldns_pipeline:prepare/1. Because every pipe's prepare/1 contributes to the single, shared pipeline opts that is later merged into every query, the mappers are available to this module's call/2 at run-time as a plain map lookup — no global registry, no process hop.

call/2

erldns_pipeline:call/2 callback.

deps()

-spec deps() -> erldns_pipeline:deps().

erldns_pipeline:deps/0 callback.

get_signed_records/1

-spec get_signed_records(erldns:zone()) -> #{atom() => [dns:rr()]}.

Get signed records from a zone.

Key records (DNSKEY, CDS, CDNSKEY) are signed with the key signing key, everything else with the zone signing key. NS RRsets at delegation points, glue, and any other data occluded by a zone cut are not authoritative in this zone and are left unsigned (RFC 4035 §2.2); the DS RRset at a cut is the parent's own data and is signed like the rest.

get_signed_zone_records/1

-spec get_signed_zone_records(erldns:zone()) -> [dns:rr()].

Get the records of a zone signed with the zone signing key.

Same rules as get_signed_records/1, for one RRset: the zone cuts are looked up in the zone cache, where the rest of the zone is.

prepare(Opts)

erldns_pipeline:prepare/1 callback.

rrsig_for_zone_rrset(Zone, RRs)

-spec rrsig_for_zone_rrset(erldns:zone(), [dns:rr()]) -> [dns:rr()].

Given a zone and a set of records, return the RRSIG records.