coredns/plugin/dnssec
Miek Gieben 5f41d8eb1f
reverse zone: fix Normalize (#4621)
Make normalize return multiple "hosts" (= reverse zones) when a
non-octet boundary cidr is given.

Added pkg/cidr package that holds the cidr calculation routines; felt
they didn't really fit dnsutil.

This change means the IPNet return parameter isn't needed, the hosts are
all correct. The tests that tests this is also removed: TestSplitHostPortReverse
The fallout was that zoneAddr _also_ doesn't need the IPNet member, that
in turn make it visible that zoneAddr in address.go duplicated a bunch
of stuff from register.go; removed/refactored that too.

Created a plugin.OriginsFromArgsOrServerBlock to help plugins do the
right things, by consuming ZONE arguments; this now expands reverse
zones correctly. This is mostly mechanical.

Remove the reverse test in plugin/kubernetes which is a copy-paste from
a core test (which has since been fixed).

Remove MustNormalize as it has no plugin users.

This change is not backwards compatible to plugins that have a ZONE
argument that they parse in the setup util.

All in-tree plugins have been updated.

Signed-off-by: Miek Gieben <miek@miek.nl>
2021-05-17 13:19:54 -07:00
..
black_lies.go Fix some typos (#2560) 2019-02-17 08:31:12 +00:00
black_lies_bitmap_test.go plugin/dnssec: add per server metrics (#1743) 2018-04-27 19:37:31 +01:00
black_lies_test.go presubmit: Check errorf as well (#1845) 2018-06-02 11:48:39 -07:00
cache.go check for two days of remaining validity (#4606) 2021-05-14 10:49:16 +02:00
cache_test.go plugin/dnssec: Add support for KSK/ZSK split key setups (#2196) 2018-10-20 16:35:59 +01:00
dnskey.go presubmit: check import path ordering (#3636) 2020-01-30 09:19:26 +00:00
dnssec.go check for two days of remaining validity (#4606) 2021-05-14 10:49:16 +02:00
dnssec_test.go Run gostaticheck (#3325) 2019-10-01 07:41:29 +01:00
handler.go introduce metric naming test (#3789) 2020-03-31 08:07:36 +02:00
handler_test.go Stop importing testing in the main binary (#2479) 2019-01-19 11:23:13 +00:00
log_test.go Clean up tests logging (#1979) 2018-07-19 16:23:06 +01:00
metrics.go using promauto package to ensure all created metrics are properly registered (#4025) 2020-07-25 08:06:28 -07:00
README.md plugin/dnssec: use entire RRset as key input (#4537) 2021-04-05 06:45:28 -07:00
responsewriter.go Fix some typos in comments. (#4100) 2020-09-01 09:10:45 +02:00
rrsig.go Fix some typos in comments. (#4100) 2020-09-01 09:10:45 +02:00
setup.go reverse zone: fix Normalize (#4621) 2021-05-17 13:19:54 -07:00
setup_test.go For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00

dnssec

Name

dnssec - enables on-the-fly DNSSEC signing of served data.

Description

With dnssec, any reply that doesn't (or can't) do DNSSEC will get signed on the fly. Authenticated denial of existence is implemented with NSEC black lies. Using ECDSA as an algorithm is preferred as this leads to smaller signatures (compared to RSA). NSEC3 is not supported.

This plugin can only be used once per Server Block.

Syntax

dnssec [ZONES... ] {
    key file KEY...
    cache_capacity CAPACITY
}

The signing behavior depends on the keys specified. If multiple keys are specified of which there is at least one key with the SEP bit set and at least one key with the SEP bit unset, signing will happen in split ZSK/KSK mode. DNSKEY records will be signed with all keys that have the SEP bit set. All other records will be signed with all keys that do not have the SEP bit set.

In any other case, each specified key will be treated as a CSK (common signing key), forgoing the ZSK/KSK split. All signing operations are done online. Authenticated denial of existence is implemented with NSEC black lies. Using ECDSA as an algorithm is preferred as this leads to smaller signatures (compared to RSA). NSEC3 is not supported.

As the dnssec plugin can't see the original TTL of the RRSets it signs, it will always use 3600s as the value.

If multiple dnssec plugins are specified in the same zone, the last one specified will be used.

  • ZONES zones that should be signed. If empty, the zones from the configuration block are used.

  • key file indicates that KEY file(s) should be read from disk. When multiple keys are specified, RRsets will be signed with all keys. Generating a key can be done with dnssec-keygen: dnssec-keygen -a ECDSAP256SHA256 <zonename>. A key created for zone A can be safely used for zone B. The name of the key file can be specified in one of the following formats

    • basename of the generated key Kexample.org+013+45330
    • generated public key Kexample.org+013+45330.key
    • generated private key Kexample.org+013+45330.private
  • cache_capacity indicates the capacity of the cache. The dnssec plugin uses a cache to store RRSIGs. The default for CAPACITY is 10000.

Metrics

If monitoring is enabled (via the prometheus plugin) then the following metrics are exported:

  • coredns_dnssec_cache_entries{server, type} - total elements in the cache, type is "signature".
  • coredns_dnssec_cache_hits_total{server} - Counter of cache hits.
  • coredns_dnssec_cache_misses_total{server} - Counter of cache misses.

The label server indicated the server handling the request, see the metrics plugin for details.

Examples

Sign responses for example.org with the key "Kexample.org.+013+45330.key".

example.org {
    dnssec {
        key file Kexample.org.+013+45330
    }
    whoami
}

Sign responses for a kubernetes zone with the key "Kcluster.local+013+45129.key".

cluster.local {
    kubernetes
    dnssec {
      key file Kcluster.local+013+45129
    }
}