I am evaluating version 2.9.5 of Knot, in particular in what concerns key management. This
examination has resulted in the following issues/questions, which I would like to bring up
to this forum for discussion/clarification:
1. I have been testing with the default Knot out-of-the-box setup, with the following
knot.conf file:
server:
listen: [10.0.0.1 ]
log:
- target: syslog
any: info
template:
- id: default
global-module: mod-stats
mod-stats:
- id: default
policy:
- id: RSAPol
algorithm: RSASHA256
ksk-size: 2048
zsk-size: 1024
zone:
- domain:
s0.mydomain.com
storage: /var/lib/MyZones/db
file: db.s0
dnssec-signing: on
dnssec-policy: RSAPol
On launching Knot, this works as expected:
- The necessary key pairs are generated and stored in /var/lib/knot/keys in the clear,
with files data.db and lock.db created in /var/lib/knot.
- The appropriate zone is signed, with the file containing the signed data under
/var/lib/MyZones/db.
2. I next tried with SoftHSM for the low-level cryptographic support. The knot.conf file
is the same as above, with the following changes:
- I added a keystore section:
keystore:
- id: SoftHSM
backend: pkcs11
config: "pkcs11:token=KNOT;pin-value=112233 libsofthsm2.so"
- I modified the zone section to use SoftHSM:
zone:
- domain:
s0.mydomain.com
storage: /var/lib/MyZones/db
file: db.s0
dnssec-signing: on
dnssec-policy: RSAPol
keystore: SoftHMS
Before proceeding, I removed everything from /var/lib/knot. On launching knot again, this
is what happens:
- data.db and lock.db are created under /var/lib/knot, but no key pairs are created under
/var/lib/knot/keys.
- Key pairs are created under
/var/lib/softhsm/tokens/adf76cd6-5411-843e-6036-b8523580ef94.
- The appropriate zone is signed, with the file containing the signed data under
/var/lib/MyZones/db.
This is all pretty much as expected, in that the signing keys have been generated in the
space set aside by SoftHSM, and the signatures have been computed by the SoftHSM module.
Now what I was wondering is whether keymgr can be used to manage keys in SofHSM? By
default, it would seem to be the case that whenever I generate a key pair with keymgr, the
key pair is stored under /var/lib/knot/keys, in the clear. Nothing seems to change under
/var/lib/softhsm/tokens as a result of such a keymgr command. This is the case no matter
what version of the knot.conf files described above I use.
Here is my question:
Is keymgr capable of managing keys in some separate device - SoftHSM, or a real, hardware
HSM - or is it limited to keys generated by the default mechanism, with no HSM?
I notice that in previous versions of Knot, the keymgr utility supported options to use
different keystores. Such options seem to be gone from keymgr as distributed with Knot
2.9.5. Can anybody elaborate on why they were removed, and whether some other utility is
provided to achieve the same goals?
Ultimately, what I am interested in is to have all of my keys so that they are available
to the HSM alone, and I want to find out what tools does Knot provide - if any - to manage
those keys, bearing in mind that they will have to be protected in permanent storage until
such time that they are meant to be loaded into the HSM to be used. This is crucial, for
most HSMs won't keep any keys across power cycles, and even when they do, they number
that they can keep will in general be too small for my needs.