dnssec (dns_erlang v4.2.0)

View Source

The dnssec module exports functions used for generating NSEC responses, signing and verifying RRSIGs, and adding keytags to DNSKEY records.

For example, the sign_rr/6 function can be given a collection of resource records, the signer name, keytag, signing algorithm, private key, and a collection of options and it will return a list of RRSIG records. Currently only DSA and RSA algorithms are supported for signing RRSETs.

Summary

Functions

Generates and appends a DNS Key records key tag.

Converts a resource record data record to DNSSEC canonical form.

Generate NSEC3 records from a list of dns:rr/0.

Generate NSEC records from a list of dns:rr/0.

Generate NSEC records.

NSEC3 iterative hash function

Signs a list of dns:rr/0 of the same class and type.

Provides primitive verification of an RR set.

Types

gen_nsec3_opts()

-type gen_nsec3_opts() :: gen_nsec_opts().

gen_nsec_opts()

-type gen_nsec_opts() :: #{base_types => [dns:type()]}.

key()

-type key() :: [binary()].

keytag()

-type keytag() :: integer().

nsec3_hashalg()

-type nsec3_hashalg() :: 1.

nsec3_hashalg_fun()

-type nsec3_hashalg_fun() :: fun((iodata()) -> binary()).

nsec3_iterations()

-type nsec3_iterations() :: non_neg_integer().

nsec3_salt()

-type nsec3_salt() :: binary().

sigalg()

-type sigalg() :: 3 | 6 | 5 | 7 | 8 | 10.

sign_rr_opts()

-type sign_rr_opts() :: #{inception => dns:unix_time(), expiration => dns:unix_time()}.

verify_rrsig_opts()

-type verify_rrsig_opts() :: #{now => dns:unix_time()}.

Functions

add_keytag_to_cdnskey/1

-spec add_keytag_to_cdnskey(dns:rr()) -> dns:rr().

add_keytag_to_dnskey/1

-spec add_keytag_to_dnskey(dns:rr()) -> dns:rr().

Generates and appends a DNS Key records key tag.

canonical_rrdata_form/1

-spec canonical_rrdata_form(dns:rrdata()) -> dns:rrdata().

Converts a resource record data record to DNSSEC canonical form.

gen_nsec3(RRs)

-spec gen_nsec3([dns:rr()]) -> [dns:rr()].

Equivalent to gen_nsec3(RRs, #{}).

gen_nsec3(RRs, Opts)

-spec gen_nsec3([dns:rr()], gen_nsec3_opts()) -> [dns:rr()].

Generate NSEC3 records from a list of dns:rr/0.

The list must contain a SOA dns:rr/0 to source the zone name and TTL from as well as as an NSEC3Param dns:rr/0 to source the hash algorithm, iterations and salt from.

gen_nsec(RR)

-spec gen_nsec([dns:rr()]) -> [dns:rr()].

Generate NSEC records from a list of dns:rr/0.

The list must contain a SOA dns:rr/0 which is used to determine zone name and TTL.

gen_nsec(ZoneName, RR, TTL)

-spec gen_nsec(dns:dname(), [dns:rr()], dns:ttl()) -> [dns:rr()].

Equivalent to gen_nsec(ZoneName, RR, TTL, #{}).

gen_nsec(ZoneNameM, RR, TTL, Opts)

-spec gen_nsec(dns:dname(), [dns:rr()], dns:ttl(), gen_nsec_opts()) -> [dns:rr()].

Generate NSEC records.

ih/4

NSEC3 iterative hash function

sign_rr(RR, SignerName, KeyTag, Alg, Key)

-spec sign_rr([dns:rr()], dns:dname(), keytag(), sigalg(), key()) -> [dns:rr()].

Equivalent to sign_rr(RR, SignerName, KeyTag, Alg, Key, []).

sign_rr(RR, SignerName, KeyTag, Alg, Key, Opts)

-spec sign_rr([dns:rr()], dns:dname(), keytag(), sigalg(), key(), sign_rr_opts()) -> [dns:rr()].

Signs a list of dns:rr/0.

sign_rrset(RRSet, SignerName, KeyTag, Alg, Key)

-spec sign_rrset([dns:rr(), ...], dns:dname(), keytag(), sigalg(), key()) -> dns:rr().

Equivalent to sign_rrset(RRSet, SignerName, KeyTag, Alg, Key, []).

sign_rrset/6

-spec sign_rrset([dns:rr(), ...], dns:dname(), keytag(), sigalg(), key(), sign_rr_opts()) -> dns:rr().

Signs a list of dns:rr/0 of the same class and type.

verify_rrsig/4

-spec verify_rrsig(dns:rr(), [dns:rr()], [dns:rr()], verify_rrsig_opts()) -> boolean().

Provides primitive verification of an RR set.