Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements support in Krill for creating signing key pairs in HSMs rather than using OpenSSL to create key files on disk.
It isn't strictly limited to Hardware Security Modules, it supports anything that implements either the PKCS#11 v2.20+ interface or the KMIP 1.2+ TTLV over TCP/TLS protocol, and that supports the necessary operations (primarily RSA key pair creation, deletion and signing with the created private key, but also surrounding operations such as modifying key attributes, locating keys, querying HSM metadata, etc). These can be hardware or software, servers or USB keys, etc.
When enabled the
hsm
feature causes Krill to start tracking the relationship between key identifiers (as used in certificates) and the signer which possesses the actual public and private key pair to which the key identifier refers. This tracking is done using an aggregate store backed by files on disk, just as the other core data in Krill is managed.To use the new functionality one must add one or more
[[signers]]
blocks tokrill.conf
, see the comments indefaults/krill-hsm.conf
for more information and remember to restart Krill after changing the configuration file.Note that by default OpenSSL is still used for the generation of one-off keys and for generating random byte sequences. One-off key creation, signing and deletion can be assigned to an actual HSM if desired. Random generation is always handled by OpenSSL.
Testing
This PR (or earlier very similar versions of it) have been tested with the following cryptographic tokens: (in alphabetic order)
Special thanks to
for providing the YubiHSM 2 that I tested with.
The GitHub Actions CI workflow has been extended to run the Krill test suite both in its usual mode of operation using OpenSSL as the signer, and additionally with SoftHSMv2 as the signer via its PKCS#11 interface, and PyKMIP as the signer via its KMIP interface.
The end-to-end test has also been updated to use SoftHSMv2 as the backing signer rather than OpenSSL. See the test results.
Known limitations
This PR:
--features hsm
.krillc
commands or outputs (see Define krillc extensions for showing HSM key details #570, Extend Krill event history reporting #571, General signer metrics #578 and Count interesting KMIP TLS client metrics? #581).