improve signing key encryption password handling#355
improve signing key encryption password handling#355SolidEva wants to merge 3 commits intonix-community:masterfrom
Conversation
| make_key "$key" "/CN=Robotnix ''${key/\// }/" && exit 1 | ||
| if [ "$nopassword" = true ]; then | ||
| # make_key exits with unsuccessful code 1 instead of 0 | ||
| make_key "$key" "/CN=${config.signing.keyCn} ''${key/\// }/" <<< "" && exit 1 |
There was a problem hiding this comment.
i'm tempted to stop using make_key entirely, and just call openssl directly since it would make all of this logic much more clean
but i think i'll leave that for a future PR
81e797d to
326c5d9
Compare
|
some manual testing:
and
|
adds the `--no-password` argument to the generate keys script to allow users to handle key encryption themselves adds the `--single-password` argument to the generate keys script to allow users to specify a single password to encrypt all generate keys with while a single password is less secure than each key using its own password, since roughly 30 keys are generated, its unlikely most users are setting unique passwords per key anyway users that want to set unique passwords per key can still do so additionally, these changes allow the avb key to be encrypted as well the most annoying part of this change was working around avbtool wrapping the openssl cli, which meant none of the openssl `-passin` options were available and user interaction was forced. a minor patch for avbtool is included to add support for the various `-passin` options
326c5d9 to
cec1619
Compare
if `signing.decryptKeysForSigning` is enabled, prompt the user for a single password at the start of signing. the password is used to decrypt all keys, which are stored temporarily in memory by decrypting them to a tmpdir in /dev/shm this is identical to how grapheneos handles signing with encrypted keys using `signing.decryptKeysForSigning` requires all keys to be encrypted with the same password. this is intended to be used alongside noninteractive key generation, which encrypts all keys using the same password like so: `./generate-keys ./keys --single-password`
cec1619 to
4644b9d
Compare
|
TBH I feel like this is out-of-scope for robotnix. If you want to encrypt your keys, what's stopping you from doing so with a separate tool (e.g. |
|
hm, i'm not sure i understand? the goal here was to make that process less painful, and to make it easier to ensure that decrypted keys never hit the disk. |
Oh, that - the fact that the key generation script is prompting the user for a password for every key is a by-product of the fact that we're using the upstream AOSP APK key generation script |
|
I've done so for now in cb070a9. But still, thanks for the contribution! :) |
preferably after #352 since this includes that change.
Background:
moving from the graphene build system, i was looking for a way to automatically decrypt my keys as part of singing
part of that is encrypting all of the keys with the same password so we don't need to prompt the user for ~30+ passwords at signing time
of course this doesn't replace the user storing keys properly and securely, but it limits how much they are sitting around in the clear
as a bonus, we can now encrypt the avb device key!
more info in the commit messages: