erldns_dnssec behaviour (erldns v11.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.

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 signed records from a zone

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

get_signed_zone_records/1

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

Get signed records from a zone

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.