dnssec-keymgr Command

Purpose

Ensures correct Domain Name System Key (DNSKEY) coverage based on a defined policy.

Syntax

dnssec-keymgr [-K directory] [-c file] [-f] [-k] [-q] [-v] [-z] [-g path] [-s path] [zone…]

Description

The dnssec-keymgr command is a high-level Python3 wrapper that facilitates the key rollover process for zones that are handled by the BIND software. This command uses the BIND commands to manipulate the Domain Name System Security Extensions (DNSSEC) key metadata: dnssec-keygen and dnssec-settime.

The DNSSEC policy can be read from a configuration file (default file is /etc/dnssec-policy.conf), from which the key parameters, publication and rollover schedule, and desired coverage duration for a specific zone can be determined. This file might be used to define individual DNSSEC policies on a per-zone basis, or to set a default policy that is used for all zones.

The dnssec-keymgr command examines the DNSSEC keys for one or more zones and compares their timing metadata against the policies for those zones. If key settings do not conform to the DNSSEC policy (for example, because the policy has been changed), the settings are automatically corrected.

A zone policy can specify a duration for which the key correctness (coverage) must be ensured. It can also specify a rollover period (roll-period). If policy indicates that a key must roll over before the coverage period ends, then a successor key is created and added to the end of the key series.

If zones are specified on the command line, the dnssec-keymgr command examines only the specified zones. If a specified zone does not already have the keys in place, then keys are generated for the zone according to the policy. If zones are not specified on the command line, the dnssec-keymgr command searches the key directory (either the current working directory or the directory set by the -K option), and check the keys for all zones represented in the directory.

Key times that are in the past will not be updated unless the -f flag is used. Key inactivation and deletion times that are less than five minutes in the future will be delayed by five minutes.

This tool runs automatically and unattended (for example, by cron).

Flags

-c file
Reads the DNSSEC policy from the specified file. If you do not specify this flag, the policy is read from the /etc/dnssec-policy.conf file. If this file does not exist, a built-in global default policy is used.
-f
Force updates the key events even if events occurred in the past. Do not use this flag with zones in which keys have already been published. However, if the keys are not published in a zone even if a set of keys are generated and all the keys that have publication and activation dates in the past, use this option to clean them up and turn them into a proper series of keys with appropriate rollover intervals.
-g keygen-path
Specifies a path to a dnssec-keygen binary file. This flag is used for testing purpose only. Also, see the -s flag.
-h
Prints the dnssec-keymgr help summary and exits.
-K directory
Sets the directory in which keys can be found. Defaults to the current working directory.
-k
Applies policies only to KSK keys. Also, see the -z option.
-q
Enables quiet mode and suppress printing of the dnssec-keygen and dnssec-settime commands.
-s settime-path
Specifies a path to a dnssec-settime binary file. This is used for testing purposes only. Also, see the -g option.
-v
Prints the dnssec-keymgr command version and exits.
-z
Applies policies to ZSK keys only. Also, see the -k option.

Policy configuration

The dnssec-policy.conf file can specify the following types of policies:

Policy classes (policy name{ ... };)
Policy classes can be inherited by zone policies or other policy classes. These classes can be used to create sets of different security profiles. For example, a normal policy class might specify 1024 bits key size, but an extra policy class might specify 2048 bits instead. The extra class will be used for zones that have high security needs.
Algorithm policies: (algorithm-policy algorithm{ ... }; )
Algorithm policies override default per-algorithm settings. For example, by default, RSASHA256 keys use 2048 bits key size for both KSK and ZSK. This key size can be modified by using algorithm-policy, and the new key size is used for any key of type RSASHA256.
Zone policies: (zone name{ ... }; )
Zone policies set policy for a single zone by name. A zone policy can inherit a policy class by including a policy option. Zone names that begin with digits (0-9) must be quoted. If a zone does not have its own policy, the default policy applies.

Policy options

Options that can be specified in policies are as follows:

algorithm name;
Specifies the key algorithm. If no policy is defined, the default value is RSASHA256.
coverage duration;
Specifies the time duration during which the key correctness is ensured. No action is taken to create keys that must be activated after this time. This value can be represented as a number of seconds, or as a duration that uses human-readable units (for example, 1y or 6 months). A default value for this option can be set in algorithm policies and in policy classes or zone policies. If no policy is configured, the default value is six months.
directory path;
Specifies the directory in which keys are stored.
key-size keytype size;
Specifies the number of bits that must be used while creating keys. The key type is either zsk or ksk. A default value for this option can be set in algorithm policies and in policy classes or zone policies. If no policy is configured, the default is 2048 bits for RSA keys.
keyttl duration;
Specifies the key time-to-live (TTL). If no policy is defined, the default value is one hour.
post-publish keytype duration;
Specifies the duration after which a deactivated key must be deleted from the zone.
Note: If roll-period is not set, this value is ignored. The key type is either zsk or ksk. A default duration for this option can be set in algorithm policies and in policy classes or zone policies. The default value is one month.
pre-publish keytype duration;
Specifies the duration before which an activated key must be published.
Note: If roll-period is not set, this value is ignored. The key type is either zsk or ksk. A default duration for this option can be set in algorithm policies and in policy classes or zone policies. The default value is one month.
roll-period keytype duration;
Specifies the frequency at which keys must be rolled over. The key type is either zsk or ksk. A default duration for this option can be set in algorithm policies and in policy classes or zone policies. If no policy is configured, the default value is one year for ZSKs. KSKs do not roll over by default.