Skip to main content
Version: latest

Generate Keys for Trusted Boot

Trusted Boot works by signing the Edge Installer image and provider images with cryptographic keys, and only allowing images signed with the trusted keys to operate during the Edge host boot process. This page guides you through the process of generating keys to be used when building Edge artifacts.

The key generation process produces three pairs of keys and a Platform Configuration Register (PCR) policy private key, and each pair of keys fulfills different purposes. The following table provides a brief overview of which keys are used in which Trusted Boot EdgeForge and deployment process. For more information, refer to EdgeForge with Trusted Boot.

KeysKey GenerationBuild Installer ISOBuilding Provider ImagesInstallation
PK & KEK (private)Not neededNot neededNot needed
PK & KEK (public)Not needed
DB (public)Not needed
DB (private)Not needed
PCR policy Key (private)Not needed
warning

All security provided by Trusted Boot assumes that the private keys are kept secure. We recommend that you perform key generation in an air-gapped environment and move the PK and KEK private keys to a secure location immediately after generating them. In addition, any build pipelines that are created for the purposes of building ISOs and provider images must be secured, as they must contain the PCR and DB private keys.

Prerequisites

  • A physical or virtual Linux machine with AMD64 (also known as x86_64) processor architecture to build the Edge artifacts. You can issue the following command in the terminal to check your processor architecture.

    uname -m
  • Minimum hardware configuration of the Linux machine:

    • 4 CPU
    • 8 GB memory
    • 50 GB storage
  • You have exported the factory keys from the Edge device. For more information, refer to Export Factory Keys.

  • Git. You can ensure git installation by issuing the git --version command.

  • openssl must be installed on your Linux machine.

Instructions

If your environment does not require a Certificate Authority (CA), you can use self-signed certificates to generate the keys needed for Trusted Boot. Using self-signed certificates may make verifying the source of the certificate more difficult because there is no higher authority.

  1. Clone the CanvOS repository.

     git clone https://github.com/spectrocloud/CanvOS.git
  2. Change to the CanvOS/ directory.

    cd CanvOS
  3. View the available git tag.

    git tag
  4. Check out the latest available tag that is v4.4.0 or later. This guide uses the tag v4.4.0 as an example.

    git checkout v4.4.0
  5. Issue the following command to create the folders for Trusted Boot keys.

    ./earthly.sh +secure-boot-dirs

    This will create a folder named secure-boot and three subdirectories: exported-keys, private-keys and public-keys.

  6. Copy the keys you exported from your Edge device in Export Factory Keys to the exported-keys directory.

    danger

    If this is not the first time you have generated keys, make sure that secure-boot folder has no existing keys except for the exported keys you just copied before proceeding to the next step. Issuing the key generation command will overwrite all existing keys silently. Ensure that you have backed up all your existing keys before generating new ones.

  7. Issue the following command to generate keys. Replace org-name with the name of your organization, and replace 5475, the default expiration period in days, with the desired expiration period for your keys.

    danger

    Specify a distant expiration date. If the keys expire before you can replace them, it can soft-brick the Edge host. Although the default is 15 years, you may choose to make this longer.

    ./earthly.sh +uki-genkey --MY_ORG="org-name" --EXPIRATION_IN_DAYS=5475 --UKI_SELF_SIGNED_KEYS=false

    All keys are generated to the secure-boot folder. Private keys are kept in a subdirectory called private-keys. Public keys are generated to a subdirectory called public-keys.

    The key generation script also produces a folder named enrollment. This folder contains public keys that will be built into the Edge installer ISO, and eventually enrolled in your Edge device when you install Palette Edge with the ISO.

  8. Remove PK.key and KEK.key from the private-keys folder and keep them offline in a safe location.

Validate

Check the content of the secure-boot/enrollment directory. You should observe the following nine files.

$ ls secure-boot/enrollment/
KEK.auth KEK.der KEK.esl PK.auth PK.der PK.esl db.auth db.der db.esl