YubiHSM

Description

YubiHSM is the most integrated HSM workflow in Stream Offline CA. The appliance provides middleware installation, connection checks, object listing, KSP backup, and KSP restore workflows. After middleware installation, the top-level YUBI menu becomes available. The YubiHSM backup and restore workflows protect YubiHSM KSP material. They complement the Stream backup and restore procedures, but they do not replace them. The YubiHSM runtime menu is separated from the generic Stream backup and restore menu so YubiHSM connection, object listing, KSP backup, and KSP restore remain explicit HSM actions. PKCS#11 slot discovery is centralized in PKCS11 > DISCOVERY, not in the YubiHSM-specific menu.

Compatibility scope

The appliance integrates the YubiHSM shell, connector, setup workflow, shared library, and PKCS#11 configuration. Select approved middleware and qualify the device, firmware, authentication policy, and ceremony before production use.

Pre-requisites

  • YubiHSM device

  • Approved YubiHSM middleware packages

  • Approved authentication key IDs and passwords

  • Stream Offline CA booted in Create or Restore

  • Removable media for backup shares and .yhw files when required

  • Stream PKCS#11 keystore values approved for the operation.

Values to confirm

Value Purpose Record in the ceremony report

YubiHSM middleware packages

Provide the approved shell, connector, setup, shared library, and PKCS#11 configuration.

Package identifiers and hashes.

Connector address

Allow the YubiHSM shell and PKCS#11 module to reach the device.

Non-secret address and port only.

Authentication key ID

Authenticate:

  • YUBI > CONNECT

  • YUBI > KEYS

  • Backup operations

  • Restore operations

Key ID only, never the password.

PKCS#11 library path

Configure the Stream PKCS#11 keystore.

Library path, usually /usr/local/lib/pkcs11/yubihsm_pkcs11.so.

Backup share count and threshold

Define YubiHSM backup custody.

  • Share count

  • Threshold

  • Share filenames

  • Media labels

  • Custodians

Install middleware

  1. Connect the YubiHSM device when instructed.

  2. On tty1, open HSM > INSTALL.

  3. Select YUBI.

  4. Let the appliance install the YubiHSM shell, connector, setup tool, shared libraries, and PKCS#11 configuration.

  5. Confirm that the YUBI menu appears.

The appliance expects yubihsm-setup, yubihsm-shell, and /etc/yubihsm_pkcs11.conf to be available after installation. When these components are detected, the appliance exposes the top-level YUBI menu.

YUBI menu

Action Description

YUBI > CONNECT

Opens a YubiHSM session through the connector and verifies authentication.

YUBI > KEYS

Lists YubiHSM objects and displays details such as:

  • ID

  • Type

  • Domains

  • Capabilities

  • Delegated capabilities

  • Algorithm

  • Origin

  • Sequence when available

YUBI > BACKUP

Runs the YubiHSM KSP backup workflow. It can:

  • Generate backup shares

  • Distribute shares to USB media

  • Create .yhw backup files

  • Generate a recovery kit

YUBI > RESTORE

Restores YubiHSM KSP keys from .yhw files and the required shares. In the first Restore boot flow, this action is available only after Stream restore has completed successfully. Before that point, the menu labels the action as locked.

Use PKCS11 > DISCOVERY > PROVIDER-SLOTS, then select YUBI, when the operator needs to list YubiHSM PKCS#11 slots before configuring the Stream keystore.

Workflow map

Use the YUBI workflows around the Stream operation they support.

Create a YubiHSM-backed CA

  1. Install the YubiHSM middleware from HSM > INSTALL.

  2. Run YUBI > CONNECT to confirm that the connector, device, session ID, and session password are usable.

  3. Run PKCS11 > DISCOVERY > PROVIDER-SLOTS > YUBI to confirm visible PKCS#11 slots.

  4. Run YUBI > KEYS to confirm the visible objects before Stream creates or uses CA key material.

  5. Configure the Stream PKCS#11 keystore with the approved YubiHSM library path, slot, user type, and PIN.

  6. Create or import the CA material in Stream.

  7. Run YUBI > KEYS again to confirm that the expected private-key object is visible.

  8. Run YUBI > BACKUP after the key ceremony so the YubiHSM KSP material can be restored later.

  9. Store the Stream backup material and the YubiHSM backup material under the same operation record.

Restore a YubiHSM-backed CA

  1. Boot the target Stream Offline CA runtime.

  2. Install the YubiHSM middleware from HSM > INSTALL.

  3. Restore the Stream state first with the approved Stream backup procedure.

  4. Wait until Stream is active and reachable.

  5. Run YUBI > RESTORE with the approved .yhw directory and required restore shares.

  6. Edit the Stream YubiHSM keystore PIN when the restore completion screen reports the imported authentication key IDs.

  7. Run YUBI > KEYS and verify that the expected object IDs, labels, algorithms, and domains are present.

  8. Validate the managed CA operation in Stream before resuming production use.

Routine control

  1. Run YUBI > CONNECT when the operator needs to prove that the device and connector are reachable.

  2. Run YUBI > KEYS before and after a key ceremony, restore, or troubleshooting session.

  3. Run YUBI > BACKUP after YubiHSM key material changes.

  4. Keep YubiHSM .yhw files, recovery kits, and shares in the same operation record as the corresponding Stream backup.

Connection check workflow

YUBI > CONNECT is the quickest readiness check. It does not create Stream CA material and does not back up the HSM.

  1. Open YUBI > CONNECT.

  2. Confirm the session ID. The default is 1, and hexadecimal values such as 0x0001 are accepted when required.

  3. Enter the YubiHSM session password.

  4. Let the appliance start or reach the connector and open a YubiHSM shell session.

  5. Treat the workflow as successful only when the appliance reports the created session ID.

  6. If the workflow fails, record the displayed reason, exit code, and yubi-open.log path.

Record the session ID and the validation result. Do not record the session password.

Object inventory workflow

YUBI > KEYS opens a session and lists visible YubiHSM objects. Use it to confirm that Stream is pointing at the expected HSM material.

  1. Open YUBI > KEYS.

  2. Confirm the session ID.

  3. Enter the YubiHSM session password.

  4. Review the object list.

  5. Open each relevant object detail view.

  6. Compare the displayed label, ID, type, domains, capabilities, delegated capabilities, algorithm, origin, and sequence with the ceremony record.

Record only non-secret identifiers. For CA records, the key object ID, label, algorithm, and domain assignment are usually sufficient.

Configure the Stream keystore

  1. Switch to the Stream UI on tty2.

  2. Open Keystores and keys.

  3. Add a PKCS#11 keystore.

  4. Enter the YubiHSM PKCS#11 library path approved for the operation. The expected path is /usr/local/lib/pkcs11/yubihsm_pkcs11.so.

  5. Parse the library.

  6. Select the approved slot and user type.

  7. Enter the approved PIN for the active YubiHSM authentication key.

  8. Save the keystore.

  9. Verify that Stream can list or create the expected key.

Do not record real YubiHSM session passwords, authentication key passwords, application key passwords, audit passwords, or PIN values. Use placeholders in public operation reports.

Back up YubiHSM material

Run this workflow after the initial YubiHSM-backed CA key ceremony, after a YubiHSM key change, or before a runtime migration where the target environment must recover the same YubiHSM KSP material.

The YubiHSM KSP backup is separate from the Stream configuration or database backup. The operation must produce its own .yhw files, shares, and recovery kit.

  1. Open YUBI > BACKUP.

  2. Enter the approved authentication password for the backup operation.

  3. Enter or confirm the wrap key ID.

  4. Enter the total number of shares. The accepted range is 2 to 10.

  5. Enter the privacy threshold. The threshold must be greater than 1 and less than or equal to the total share count.

  6. Enter or confirm the application authentication key ID and password.

  7. Enter or confirm the audit authentication key ID and password.

  8. Review the summary screen.

  9. Select LAUNCH.

  10. Wait for the backup helper to complete and display the generated wrap, application, and audit authentication key IDs.

  11. Distribute generated shares to USB media when the operation requires separate custody.

  12. Export generated .yhw files and the recovery kit to approved media.

  13. Choose DONE only when the generated files must intentionally remain in the appliance backup directory for the next controlled step.

The appliance validates middleware availability, helper script availability, key IDs, share count, threshold, and password length before launching the backup. Password prompts are hidden and are not described as pre-filled. When the dump helper creates the .yhw files, the appliance compares the backup directory state before and after the helper run and includes only new or modified .yhw files in the follow-up export and recovery kit. In USB mode, the appliance copies generated .yhw files and the recovery kit to USB media and removes the local generated copy after verified export. In DONE mode, generated .yhw files and the recovery kit remain under /opt/offline_ca/backup.

Record the following non-secret values:

  • Wrap key ID

  • Application authentication key ID

  • Audit authentication key ID

  • .yhw filenames

  • Recovery kit filename

  • File sizes and SHA-256 hashes

  • Share count and threshold

  • Share filenames, media labels, and custodians

  • Backup date and target appliance image version

Never record application passwords, audit passwords, authentication passwords, PIN values, or Shamir share values.

Restore YubiHSM material

Run this workflow only after the Stream runtime state has been restored and Stream is active. The appliance blocks YubiHSM restore when Stream is not reachable, because the restored YubiHSM authentication key values must be synchronized back into the Stream keystore.

  1. Open YUBI > RESTORE.

  2. Open the connector when the appliance offers to run YUBI > CONNECT.

  3. Mount USB media when the .yhw files or restore shares are stored on removable media.

  4. Select the directory containing the approved .yhw files.

  5. Enter the approved authentication password for the restore operation.

  6. Enter the number of required restore shares.

  7. Select each required share file. The appliance stages selected files locally before running the restore helper. When share files are selected from USB media, the appliance can stage one share, unmount that USB key, then prompt for the next share so separate-custody media can be handled one by one.

  8. Let the appliance run the restore helper against the staged .yhw directory.

  9. Wait for the success message and the Stream restart.

  10. Read the imported authentication key IDs displayed on the completion screen.

  11. Edit the YubiHSM keystore in Stream and update the PIN. The PIN format is the authentication key ID without the 0x prefix followed by that key password.

  12. Verify the restored YubiHSM object list with YUBI > KEYS.

Record the .yhw directory, selected share filenames, imported authentication key IDs, Stream restart result, and post-restore object inventory. Do not record authentication passwords, key passwords, PIN values, or share values.

If the .yhw directory is selected from the managed USB mountpoint, the appliance copies the .yhw files into a local temporary staging directory and verifies them before invoking the restore helper. Temporary YubiHSM restore staging is removed when the workflow exits or is cancelled.

If restore fails, keep the appliance running and collect the displayed reason, exit code, and yubi-restore.log path. Do not retry with different shares until the selected files have been compared against the recovery kit.

Common mistakes

  • Starting Stream before YubiHSM middleware is installed.

  • Treating YUBI > BACKUP as a Stream backup.

  • Forgetting to update the Stream PKCS#11 keystore PIN after YubiHSM restore.

  • Leaving .yhw files or share files on temporary media after distribution.

  • Recording secret share values in the operation report.

  • Running YUBI > RESTORE before Stream restore has completed.