-
Notifications
You must be signed in to change notification settings - Fork 39
feat: add support for 'sbkey' being passed in through ENV #543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -688,18 +688,29 @@ profile="${BUILDSYS_SBKEYS_PROFILE_DIR}" | |
|
|
||
| found=0 | ||
| # A local profile has signing keys and certificates, while an AWS profile | ||
| # has a config for the aws-kms-pkcs11 helper. Either type is supported. | ||
| # has a config for the aws-kms-pkcs11 helper. The environment variables profile | ||
| # has keys provided through BUILDSYS_SBKEY_* environment variables. Any of | ||
| # these profile types is supported. | ||
| if [ -s "${profile}/shim-sign.key" ] && \ | ||
| [ -s "${profile}/shim-sign.crt" ] && \ | ||
| [ -s "${profile}/code-sign.key" ] && \ | ||
| [ -s "${profile}/code-sign.crt" ] ; then | ||
| [ -s "${profile}/code-sign.crt" ] && \ | ||
| [ -s "${profile}/config-sign.key" ] ; then | ||
|
Comment on lines
+697
to
+698
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not thrilled with this interface since it creates ambiguity as to what keys will be used if both the environment variable and the file are present for a profile. Here, we'd pass this first set of checks but silently end up using the environment variables instead of the files, assuming that the last value for a particular secret on the This isn't really a new issue, but the more types of signing profiles we have, the more potential for confusion that exists. It might be better to have a different "type" of profile, with a file like Then a check could assert that we have only one type for our set of signing keys:
(In the KMS path,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like perhaps a larger project, to cleanly separate the profiles also in the builder docker stage. It was actually the initial approach I took, but realised that it increased the code required significantly for little benefit (without an understanding of the longer roadmap of signing key support), hence I decided to limit the PR to outside of the docker build stage. I think the two modifications you mention, correcting the prefix to Putting the profile name into the environment variables should be a reasonable defence against confusion of which keys are being used. |
||
| let found+=1 | ||
| elif [ -s "${profile}/kms-sign.json" ] ; then | ||
| elif [ -s "${profile}/kms-sign.json" ] && \ | ||
| [ -s "${profile}/config-sign.key" ] ; then | ||
| let found+=1 | ||
| # Environment variables case - check if all required env vars are set | ||
| elif [ -n "${BUILDSYS_SBKEY_SHIM_SIGN_KEY_CONTENT}" ] && \ | ||
| [ -n "${BUILDSYS_SBKEY_CODE_SIGN_KEY_CONTENT}" ] && \ | ||
| [ -n "${BUILDSYS_SBKEY_CONFIG_SIGN_KEY_CONTENT}" ] && \ | ||
|
Comment on lines
+703
to
+706
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be better to associate these variables with the profile somehow, since otherwise the wrong keys could be used if the profile is changed. Rough example: |
||
| [ -s "${profile}/shim-sign.crt" ] && \ | ||
| [ -s "${profile}/code-sign.crt" ] ; then | ||
| let found+=1 | ||
| fi | ||
|
|
||
| expected=1 | ||
| for f in {PK,KEK,db,vendor}.crt config-sign.key efi-vars.{json,aws} ; do | ||
| for f in {PK,KEK,db,vendor}.crt efi-vars.{json,aws} ; do | ||
| let expected+=1 | ||
| [ -s "${profile}/${f}" ] && let found+=1 | ||
| done | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.