We are in the process of standing up CI with secure boot signing and best practice dictates using an HSM to secure/store the signing keys over filesystem-based since the physical tokens would be in an access-controlled room.
I’ve been working through the guide provided by Toradex (Secure Boot Image Signing for NXP iMX With HSM-Backed Keys | Toradex Developer Center)
but there are several major caveats to following this process given that all keys are generated with never extractable and so cannot be transferred to additional HSMs.
This has two implications:
- The Yubikey is a single point of failure - if it becomes damaged or quits working, you can no longer produce a build for your fused device. This risk is never mentioned in the article and really should be highlighted - the other guides make significantly more mention of the risk of lost keys or key compromise.
- You cannot provision more than one CI worker to handle your builds if you have a fleet of them, which quickly leads to backlogs given yocto builds can take an appreciable amount of time to complete under some circumstances.
I have a few questions after walking through the guide workflow once as a test:
-
During the HAB generation process I chose ECC instead of RSA. It appeared to complete okay (I see matching ECC objects in the yubikey on inspection) but I saw errors in the output that I’m not entirely certain I should ignore:
40A76644A07F0000:error:0300007F:digital envelope routines:evp_pkey_get0_RSA_int:expecting an rsa key:crypto/evp/p_legacy.c:43:Does this mean only RSA key types are supported via the HSM pathway? the documentation makes no mention of such a restriction. -
What are the recommended options for dealing with the issue of making multiple (including a backup) token?
- Is there a way to make the keys generated into the first token transferable but apply the
never extractableflag on duplication so that the HSMs in the build agents cannot have the keys extracted? (i.e. a “primary” token which is never used in any process except to create subordinate restricted tokens for actual CI usage) - Or should I follow the “filesystem” key generation process and then load those on-disk keys to each HSM manually?
- Something other process I’m overlooking?
- It looks like the script patches still implement some hard-coded default management keys:
--login --login-type so --so-pin 010203040506070801020304050607080102030405060708 \
Clearly this works if the HSM’s credentials are still the default but seems like it would cause a fault if you have already changed them before running the script. Is this an oversight or is it intentional?
Regards,
~BW