|
| 1 | +# YubiHSM Provisioning Guide for PVT1 Programming |
| 2 | + |
| 3 | +Perform the following steps to provision a YubiHSM for PVT1 programming. |
| 4 | +It's worth noting that the `offline-keystore` tool was designed for a specific purpose and this ain't it. |
| 5 | +It does however have all of the functionality we require, we just have to pass in additional options to override defaults that don't make sense when setting up an intermediate. |
| 6 | + |
| 7 | +1. Reset your YubiHSM. There are a number of ways to do this: |
| 8 | + 1. Follow the instructions from YubiCo to either reset the device with a physical mechanism as is required if you don’t know your password, or using the yubihsm-shel if you do: https://developers.yubico.com/YubiHSM2/Usage_Guides/Factory_reset.html |
| 9 | + 1. The `offline-keystore` repo has a simple tool that can reset your password with fewer key presses than the `yubihsm-shell`. From the root of a `offline-keystore` git checkout: `cargo run --bin yhsm -- --auth-id X reset`. The `auth-id` option is used to pass in the object id of the auth credential. By default this is ‘1’ however the `oks` tool uses auth id ‘2’ instead. |
| 10 | +1. Checkout the `offline-keystore` repo: https://github.com/oxidecomputer/offline-keystore |
| 11 | +1. Initialize the YubiHSM: |
| 12 | + ``` sh |
| 13 | + $ cargo run --bin oks -- hsm --no-backup initialize --passwd-challenge |
| 14 | + ``` |
| 15 | + NOTE: `--no-backup` disables the wrap key creation and splitting we do for the offline roots |
| 16 | + NOTE: `--passwd-challenge` disables the passwd mgmt flows we do for the offline roots & will challenge you for a password on the console. Pick a strong password, preferably one generated by a password manager and stored in same. |
| 17 | +1. Generate the identity signing key: |
| 18 | + ```sh |
| 19 | + $ cargo run --bin oks -- \ |
| 20 | + hsm --no-backup \ |
| 21 | + generate \ |
| 22 | + --key-spec data/platform-identity-intermediate.keyspec.json |
| 23 | + ``` |
| 24 | + NOTE: the keyspec file is checked into the `offline-keystore` repo |
| 25 | +1. Generate the directory structure and config file for the openssl CA: |
| 26 | + ```sh |
| 27 | + $ cargo run --bin oks -- \ |
| 28 | + ca initialize \ |
| 29 | + --key-spec data/platform-identity-intermediate.keyspec.json |
| 30 | + ``` |
| 31 | + |
| 32 | +## What happened? |
| 33 | + |
| 34 | +At the end of all of this the HSM has: |
| 35 | +1. created an auth credential w/ a password set by the caller |
| 36 | +1. extracted the certificate for the attestation key on the YubiHSM: `output/hsm.attest.cert.pem` |
| 37 | +1. deleted the default auth credential created when the device was reset |
| 38 | +1. created a signing key per the provided keyspec, this will be the key used by our intermediate CA for signing certs |
| 39 | +1. collected an attestation by the YubiHSM proving the key created was created on this specific YubiHSM: `output/platform-identity-intermediate-pvt1.attest.cert.pem` |
| 40 | +1. created a directory structure and config as required by the `openssl ca` command using the YubiHSM as a signing back-end: `ca-state/platform-identity-intermediate-pvt1` |
| 41 | +1. created a CSR for the signing key such that it can be certified and included into an existing PKI: `output/platform-identity-intermediate-pvt1.csr.pem` |
0 commit comments