dnssec-keygen Command
Purpose
Domain name system security extensions (DNSSEC) key generation tool.
Syntax
dnssec-keygen [-3] [-A date/offset] [-a algorithm] [-b keysize] [-C] [-c class] [-D date/offset] [-d bits] [-D sync date/offset] [-E engine] [-f flag] [-G] [-g generator] [-h] [-I date/offset] [-i interval] [-K directory] [-k policy] [-L ttl] [-l file] [-n nametype] [-P date/offset] [-P sync date/offset] [-p protocol] [-q] [-R date/offset] [-S key] [-s strength] [-T rrtype] [-t type] [-V] [-v level] [name]
Description
The dnssec-keygen command generates keys for DNSSEC (Secure DNS), as defined in RFC 2535 and RFC 4034. It can also generate keys to use with Transaction Signatures (TSIG) as defined in RFC 2845, or Transaction Key (TKEY) as defined in RFC 2930.
The name of the key is specified on the command line. For DNSSEC keys, this must
match the name of the zone for which the key is being generated.
The dnssec-keymgr command acts as a wrapper around
dnssec-keygen command, generating and updating keys as needed to enforce defined
security policies such as key rollover scheduling. Using dnssec-keymgr may be
preferable to direct use of dnssec-keygen.
Flags
| Item | Description |
|---|---|
dnssec-keygen -3a RSASHA1 specifies the NSEC3RSASHA1
algorithm. |
|
| -a algorithm | Selects the cryptographic algorithm. For DNSSEC keys, the value of algorithm
must be one of These values are case-insensitive. In some cases, abbreviations are supported, such as
This parameter must be specified except when using the -S option, which copies the algorithm from the predecessor key. In prior releases, HMAC algorithms could be generated for use as TSIG keys, but that feature was removed in BIND 9.13.0. Use tsig-keygen to generate TSIG keys. |
| -b keysize | Specifies the number of bits in the key. The choice of key size depends on the algorithm used: RSA keys must be between 1024 and 4096 bits; Diffie-Hellman keys must be between 128 and 4096 bits. Elliptic curve algorithms do not need this parameter. If the key size is not specified, some algorithms have pre-defined defaults. For example, RSA keys for use as DNSSEC zone-signing keys have a default size of 1024 bits; RSA keys for use as key-signing keys (KSKs, generated with -f KSK) default to 2048 bits. |
| -c class | Indicates that the Domain Name Server (DNS) record that contains the key must have the specified class. If not specified, class IN is used. |
Specifies the key size in bits. For the algorithms
RSASHA1, NSEC3RSASA1, RSASHA256, and
RSASHA512 the key size must be between 1024 and 4096 bits; DH size is between 128
and 4096 bits. This option is ignored for algorithms ECDSAP256SHA256,
ECDSAP384SHA384, ED25519, and ED448. |
|
Specifies the cryptographic hardware to use, when applicable. When BIND 9 is built with OpenSSL, this needs to be set to the OpenSSL engine identifier that
drives the cryptographic accelerator or hardware service module (usually pkcs11). When BIND is built
with native PKCS#11 cryptography ( |
|
| -f flag | Sets the specified flag in the flag field of the KEY or the DNSKEY record. The only recognized flag is KSK (Key Signing Key) DNSKEY. |
| -g generator | |
| -h | |
| -k policy | Creates keys for a specific dnssec-policy. If a policy uses multiple keys, dnssec-keygen generates multiple keys. This also creates a .state file to keep track of the key state. This option creates keys according to the dnssec-policy configuration, hence it cannot be used at the same time as many of the other options that dnssec-keygen provides. |
0 or none removes it. |
|
ZONE (for a DNSSEC zone key
(KEY/DNSKEY)), HOST or ENTITY (for a key associated with a host
(KEY)), USER (for a key associated with a user (KEY)), or OTHER (DNSKEY). These values are
case-insensitive. The default is ZONE for DNSKEY generation. |
|
| -p protocol | Sets the protocol value for the generated key. The protocol is a number 0 - 255. The default is 3 (DNSSEC). Other possible values for this argument are listed in RFC 2535 and its successors. |
+ means a number
has passed a single round of the Miller-Rabin primality test; and a space ( ) means that the number
has passed all the tests and is a satisfactory key. |
|
| -s strength | |
| -t type | Indicates the use of the key. The type must be one of
AUTHCONF, NOAUTHCONF, NOAUTH, or
NOCONF. The default is AUTHCONF. AUTH refers to
the ability to authenticate data, and CONF the ability to encrypt data. |
| -v level | Sets the debugging level. |
Timings flags
Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS. If the argument begins with a
+ or -, it is interpreted as an offset from the present time. For
convenience, if such an offset is followed by one of the suffixes y,
mo, w, d, h, or
mi, then the offset is computed in years (defined as 365 24-hour days, ignoring
leap years), months (defined as 30 24-hour days), weeks, days, hours, or minutes, respectively.
Without a suffix, the offset is computed in seconds. To explicitly prevent a date from being set,
use none or never.
| Item | Description |
|---|---|
| -P date/offset | This option sets the date on which a key is to be published to the zone. After that date, the key is included in the zone but is not used to sign it. If not set, and if the -G option has not been used, the default is the current date. |
| -P sync date/offset | This option sets the date on which CDS and CDNSKEY records that match this key are to be published to the zone. |
| -A date/offset | This option sets the date on which the key is to be activated. After that date, the key is included in the zone and used to sign it. If not set, and if the -G option has not been used, the default is the current date. If set, and -P is not set, the publication date is set to the activation date minus the pre-publication interval. |
| -R date/offset | This option sets the date on which the key is to be revoked. After that date, the key is flagged as revoked. It is included in the zone and is used to sign it. |
| -I date/offset | This option sets the date on which the key is to be retired. After that date, the key is still included in the zone, but it is not used to sign it. |
| -D date/offset | This option sets the date on which the key is to be deleted. After that date, the key is no longer included in the zone. (However, it may remain in the key repository.) |
| -D sync date/offset | This option sets the date on which the CDS and CDNSKEY records that match this key are to be deleted. |
| -i interval |
This option sets the pre-publication interval for a key. If set, then the publication and activation dates must be separated by at least this much time. If the activation date is specified but the publication date is not, the publication date defaults to this much time before the activation date; conversely, if the publication date is specified but not the activation date, activation is set to this much time after publication. If the key is being created as an explicit successor to another key, then the default pre-publication interval is 30 days; otherwise it is zero. As with date offsets, if the argument is followed by one of the suffixes |
Parameters
| Item | Description |
|---|---|
| name | The name of the key that is specified on the command line. For DNSSEC keys, this name must match the name of the zone for which the key is being generated. |
Generated Keys
Knnnn.+aaa+iiiii to
the standard output. It is an identification string for the key that
it generated. nnnnis the key name.aaais the numeric representation of the algorithm.iiiiiis the key identifier (or footprint).
The .key file contains
a DNSKEY record that can be inserted into a zone file (directly or
with a $INCLUDE statement). The .private file
contains algorithm-specific fields. For security reasons, this file
does not have general read permission. Both the .key and .private files
are generated for symmetric encryption algorithm such as HMAC-MD5,
even though the public key and the private key are equivalent.
Examples
dnssec-keygen -a ECDSAP256SHA256 example.comKexample.com.+013+26160In this example, dnssec-keygen command creates the files Kexample.com.+013+26160.key and Kexample.com.+013+26160.private.
dnssec-keygen -a ECDSAP256SHA256 -f KSK example.com