Use an HSM¶
This guide keeps the encryption key on a hardware security module (HSM), on a new installation. It uses a YubiHSM 2. See the validated HSMs.
Prerequisites¶
- Ella Core installed from the binary, from source, with Docker or on Kubernetes, and never started. The snap cannot load an HSM's library.
- The HSM's PKCS#11 library installed.
- An RSA 3072 key labelled
ella-coreon the HSM. In a cluster, the same key on every node's HSM.
Do the following steps on every node.
1. Store the HSM PIN¶
Store the HSM's PIN in a file that Ella Core can read:
echo -n '0001password' | sudo install -D -m 0600 /dev/stdin /etc/ella-core/hsm.pin
Replace 0001password with your PIN.
2. Configure Ella Core to use the HSM¶
Add the encryption block to core.yaml:
encryption:
key:
type: pkcs11
pkcs11:
library: /usr/lib/x86_64-linux-gnu/pkcs11/yubihsm_pkcs11.so
token-label: YubiHSM
pin-file: /etc/ella-core/hsm.pin
key-label: ella-core
mechanism: rsa-oaep
3. Configure the HSM's library¶
Configure the library as its vendor documents. For a YubiHSM 2 on USB:
echo "connector = yhusb://" | sudo tee /etc/ella-core/yubihsm_pkcs11.conf
Start Ella Core with YUBIHSM_PKCS11_CONF=/etc/ella-core/yubihsm_pkcs11.conf in its environment.
4. Verify¶
Ella Core logs Encryption keys unlocked, with the HSM key in key, such as ella-core/eb17800de3a5eb9f.