Main commands¶
- tsig ...
- Operations with TSIG keys.
- zone ...
- Operations with zones in the database. A zone holds assigned signing configuration and signing metadata.
keymgr [global-options] [command...] [arguments...]
keymgr [global-options] [command...] help
The keymgr utility serves for key management in Knot DNS server.
Primarily functions for DNSSEC keys and KASP (Key And Signature Policy) management are provided. However the utility also provides functions for TSIG key generation.
The DNSSEC and KASP configuration is stored in a so called KASP database. The database is simply a directory in the file-system containing files in the JSON format.
The operations are organized into commands and subcommands. A command specifies the operation to be performed with the KASP database. It is usually followed by named arguments. The special command help can be used to list available subcommands in that area. The listing of available command arguments is not supported yet.
Command and argument names are parsed in a smart way. Only a beginning of a name can be entered and it will be recognized. The specified part of a name must be unique amongst the other names.
The location of the KASP database is determined as follows:
In legacy mode, the path is determined as follows:
Initialize new KASP database or upgrade existing one. The command is idempotent and therefore it is safe to be run multiple times.
The command creates a default policy and default key store (both named default). In case of upgrade, existing objects are checked and any missing attributes are filled in.
Generate new TSIG key and print it on the standard output. The algorithm defaults to hmac-sha256. The default key size is determined optimally based on the selected algorithm.
The generated key is printed out in the server configuration format to allow direct inclusion into the server configuration. The first line of the output contains a comment with the key in the one-line key format accepted by client utilities.
Available key-parameters:
- algorithm id
- Algorithm number or IANA mnemonic.
- size bits
- Size of the key in bits.
- ksk
- Set the DNSKEY SEP (Secure Entry Point) flag.
- publish time
- The time the key is published as a DNSKEY record.
- active time
- The time the key is started to be used for signing.
- retire time
- The time the key is stopped to be used for signing.
- remove time
- The time the key's DNSKEY is removed from the zone.
The time accepts YYYYMMDDHHMMSS format, unix timestamp, or offset from the current time. For the offset, add + or - prefix and optionally a suffix mi, h, d, w, mo, or y. If no suffix is specified, the offset is in seconds.
Available policy-parameters:
- algorithm id
- DNSKEY algorithm number or IANA mnemonic.
- dnskey-ttl seconds
- TTL value for DNSKEY records.
- ksk-size bits
- Size of the KSK.
- zsk-size bits
- Size of the ZSK.
- zsk-lifetime seconds
- Period between ZSK publication and the next rollover initiation.
- rrsig-lifetime seconds
- Validity period of issued signatures.
- rrsig-refresh seconds
- Period before signature expiration when the signature will be refreshed.
- nsec3 enable
- Specifies if NSEC3 will be used instead of NSEC.
- nsec3-iterations iterations
- Specifies the number of additional iterations in NSEC3 computation.
- nsec3-salt-length bytes
- Specifies salt length for NSEC3 computation.
- nsec3-salt-lifetime seconds
- Period after which a new NSEC3 salt is generated.
- soa-min-ttl seconds
- SOA Minimum TTL field. Note, Knot DNS overwrites the value with the real used value.
- zone-max-ttl seconds
- Max TTL in the zone. Note, Knot DNS will determine the value automatically in the future.
- delay seconds
- Zone signing and data propagation delay. The value is added for safety to timing of all rollover steps.
- manual enable
- Enable manual key management. If enabled, no keys will be generated or rolled automatically.
- keystore name
- Name of the key store to be used for private key material.
Supported key store backends:
- pkcs8 (default)
- The backend stores private key material in unencrypted X.509 PEM files in a directory specified as the backend configuration string. The path can be specified relatively to the KASP database location.
- pkcs11
The backend stores private key material in a cryptographic token accessible via the PKCS #11 interface. The configuration string consists of a token PKCS #11 URL and PKCS #11 module path separated by the space character.
The format of the PKCS #11 URL is described in RFC 7512. If the token is protected by a PIN, make sure to include pin-value or pin-source attribute in the URL.
The PKCS #11 module path can be an absolute path or just a module name. In the later case, the module is looked up in the default modules location.
Generate two RSA-SHA-256 signing keys. The first key will be used as a KSK, the second one as a ZSK:
$ keymgr zone key generate example.com algorithm rsasha256 size 2048 ksk
$ keymgr zone key generate example.com algorithm rsasha256 size 1024
Import a key in legacy format. The used algorithm must match with the one configured in the policy:
$ keymgr zone key import example.com Kexample.com+010+12345.private
Generate a TSIG key named operator.key:
$ keymgr tsig generate operator.key algorithm hmac-sha512