Skip to content
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

imgtool: option to read key passphrase from environment #1625

Conversation

crazyscot
Copy link
Contributor

In a CI chain it is sometimes useful to automatically sign an image (e.g. once qualification tests have passed). Naturally, it is important to protect the private key in such cases.

This patch provides that capability.

The private key should be stored in a passphrase-protected PEM file in the usual way. The CI provider should be configured, through its secrets mechanism, to inject the passphrase as an environment variable of your choice. A new imgtool option is then used to specify that variable name, e.g.:
imgtool --password-env=DEV_KEY_PASSPHRASE sign infile.hex outfile.hex

This option also works for the other verbs that load keys (getpub, getpriv, imgfile).

Note that argument ordering is critical. --password-env must appear before the verb!

@utzig
Copy link
Member

utzig commented Feb 23, 2023

@crazyscot The commit needs to be signed.

@crazyscot crazyscot force-pushed the feature/imgtool-read-passphrase-from-env branch from 9c2150d to 82de83e Compare February 24, 2023 07:15
@crazyscot
Copy link
Contributor Author

@crazyscot The commit needs to be signed.

Done, thanks.

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the stale label Aug 24, 2023
@crazyscot crazyscot force-pushed the feature/imgtool-read-passphrase-from-env branch from 82de83e to 98929e0 Compare August 24, 2023 10:03
@crazyscot
Copy link
Contributor Author

My apologies, it appears that I messed up pushing the GPG signature on this. Commit updated, can we remove the stale label please?

@github-actions github-actions bot removed the stale label Aug 25, 2023
In a CI chain it is sometimes useful to automatically sign an image
(e.g. once qualification tests have passed). Naturally, it is important
to protect the private key in such cases.

This patch provides that capability.

The private key should be stored in a passphrase-protected PEM file in the usual way.
The CI provider should be configured, through its secrets mechanism, to inject
the passphrase as an environment variable of your choice.
A new imgtool option is then used to specify that variable name, e.g.:
   imgtool --password-env=DEV_KEY_PASSPHRASE sign infile.hex outfile.hex

This option also works for the other verbs that load keys (getpub, getpriv, imgfile).

Note that argument ordering is critical. --password-env must appear before the verb!

Signed-off-by: Ross Younger <crazyscot@gmail.com>
@crazyscot crazyscot force-pushed the feature/imgtool-read-passphrase-from-env branch from 98929e0 to 9b85f44 Compare August 25, 2023 09:45
@d3zd3z
Copy link
Member

d3zd3z commented Dec 15, 2023

My apologies, it appears that I messed up pushing the GPG signature on this. Commit updated, can we remove the stale label please?

Oh, I think what @utzig meant to say was the the commit needs a sign-off-by footer in the commit text. There is not a requirement to sign commits in this project.

Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the stale label Jun 13, 2024
@github-actions github-actions bot closed this Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants