fix key generation for dual auths sharing a single YubiHSM2#36899
Merged
fix key generation for dual auths sharing a single YubiHSM2#36899
Conversation
Closed
zmb3
approved these changes
Jan 19, 2024
Contributor
Author
|
friendly ping @fheinecke @hugoShaka |
hugoShaka
approved these changes
Jan 23, 2024
|
@nklaassen See the table below for backport results.
|
nklaassen
added a commit
that referenced
this pull request
Jan 25, 2024
Backport #36899 to branch/v14
nklaassen
added a commit
that referenced
this pull request
Jan 25, 2024
Backport #36899 to branch/v13 The actual fix is a few characters in lib/auth/keystore/pkcs11.go. I'm also backporting changes to test files from #36549 that this PR built on top of, which make it easier to run all HSM unit and integration tests with a connected YubiHSM2 (which I did when putting together this backport). Instead of merging all changes in the integration tests, I just checked out the state of them from branch/v14 in #37296
nklaassen
added a commit
that referenced
this pull request
Jan 26, 2024
Backport #36899 to branch/v12 The actual fix is a few characters in lib/auth/keystore/pkcs11.go. I'm also backporting changes to test files from #36549 that this PR built on top of, which make it easier to run all HSM unit and integration tests with a connected YubiHSM2 (which I did when putting together this backport). Instead of merging all changes in the integration tests, I just checked out the state of them from branch/v13 in #37301 Changelog: fixes CA key generation when two auth servers share a single YubiHSM2
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Jan 26, 2024
…7301) Backport #36899 to branch/v13 The actual fix is a few characters in lib/auth/keystore/pkcs11.go. I'm also backporting changes to test files from #36549 that this PR built on top of, which make it easier to run all HSM unit and integration tests with a connected YubiHSM2 (which I did when putting together this backport). Instead of merging all changes in the integration tests, I just checked out the state of them from branch/v14 in #37296
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Jan 29, 2024
…7305) Backport #36899 to branch/v12 The actual fix is a few characters in lib/auth/keystore/pkcs11.go. I'm also backporting changes to test files from #36549 that this PR built on top of, which make it easier to run all HSM unit and integration tests with a connected YubiHSM2 (which I did when putting together this backport). Instead of merging all changes in the integration tests, I just checked out the state of them from branch/v13 in #37301 Changelog: fixes CA key generation when two auth servers share a single YubiHSM2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36838
The bug is caused by the way key IDs are selected for YubiHSM. It only supports 2 byte keys, so we iterate all keys sequentially until we find one that is unused. The problem is that when looking up the key to check if it is used we currently include a label filter that only returns keys labelled with the host UUID of the auth server making the request. This will not find keys created by a different auth server, and is very likely to select an ID already in use by a different auth server, so the ID will collide and the new key can't be created. The fix here is to simply remove the label filter to check if that ID is already used in the YubiHSM at all.
Changelog: fixes CA key generation when two auth servers share a single YubiHSM2