-
Notifications
You must be signed in to change notification settings - Fork 2k
MWI: Enforce generation counter for bound keypair joining #55543
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
Merged
timothyb89
merged 6 commits into
master
from
timothyb89/bound-keypair-enforce-generation-counter
Jun 17, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d29f9c0
MWI: Enforce generation counter for bound keypair joining
timothyb89 47f67c4
Add tests for generation counter enforcement, fix error handling bug
timothyb89 0dc0a3f
Fix broken test
timothyb89 3880d0d
Fix lint
timothyb89 e1e3c19
Remove references to registration secret in test for rebase onto master
timothyb89 fa32b74
Empty commit for CI
timothyb89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -643,6 +643,9 @@ func (a *Server) RegisterUsingBoundKeypairMethod( | |
| nil, // TODO: extended claims for this type? | ||
| nil, // TODO: workload id claims | ||
| ) | ||
| if err != nil { | ||
| return nil, trace.Wrap(err) | ||
| } | ||
|
Comment on lines
+646
to
+648
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. Mildly disturbed that this missing error check didn't get caught by the linter 👀 Mostly harmless, I think, since this:
It could've locked clients out unintentionally by e.g. consuming a registration secret and not returning certs, but that's about it. |
||
|
|
||
| if expectNewBotInstance { | ||
| mutators = append( | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit of a discussion question: should we skip generation counter enforcement if
.spec.bound_keypair.recovery.mode=insecure?Technically the recovery mode - which has a similar generation counter mechanism of its own- is totally separate, but users might reasonably assume that if they turn off one, it should turn off both, and that they should never see a generation counter lockout.
This is potentially relevant when using bound keypair joining for unsupported CI/CD providers, where users can store a private key in a platform secret. Bots would ideally join "from scratch" every time and should get a new bot instance with its own generation counter. In practice, though, if users do something "weird" and reuse bot data directories it might trigger a lockout.
Specific lock targets (#44996, coming soon ™️) may also solve this. Generation counter lockouts will likely target a particular bot instance instead, which should be sufficient to kill a traditional renewable cert bot and force a new token to be issued. If a bound keypair bot is locked out it can recover itself to generate a new bot instance. That said, we'll still need to game out exactly what lock targets we want to use - maybe it would be bad to let a bot recover itself if we think its certs may have been stolen.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In such cases, I think we'd want to guide people towards the correct implementation. Having multiple tbot's share the same Bot Instance will screw with the intended meaning of a Bot Instance, and impact how things are displayed in UIs, CLIs and in our billing/usage reporting.
We'll just want to make sure that we document this behaviour well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, fair enough, I'll make sure to include some details about this when I write the docs. I'll leave things as is for now then.