Skip to content

feat: Hardware Key Agent validates known keys#54691

Merged
Joerger merged 9 commits intomasterfrom
joerger/skip-validate-piv-cert
May 16, 2025
Merged

feat: Hardware Key Agent validates known keys#54691
Joerger merged 9 commits intomasterfrom
joerger/skip-validate-piv-cert

Conversation

@Joerger
Copy link
Copy Markdown
Contributor

@Joerger Joerger commented May 9, 2025

Changelog: Hardware Key Agent validates known keys by checking active or expired login session.

Changes:

Hardware Key Agent now makes a best effort to validate that a PIV slot is for Teleport by checking an active or expired Teleport login key matching the hardware key in the agent signature request.

If the key is unknown to the agent, e.g. because the agent request is from a Teleport client with a different Teleport Home directory, the agent will instead validate the key by checking the PIV slot certificate.

Context:

As a security constraint, the Hardware Key Agent does not allow signature for PIV slots that do not correspond to a known Teleport PIV key. This is currently done by checking the PIV slot certificate, which should have "teleport" as the subject organization name. This implies that a Teleport client generating the key and cert, or the YubiKey's administrator manually generated the key and cert for Teleport. This allows the Hardware Key Agent to discern whether a PIV slot is intended for Teleport use without any cluster login information, meaning that the Hardware Key Agent can operate with Teleport Connect without any active logins. However, in some administrative environments, the certificate subject name validation is impossible or difficult to comply with, in which case the Hardware Key Agent does need to check for active or expired login sessions.

@github-actions github-actions Bot added rfd Request for Discussion size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels May 9, 2025
@github-actions github-actions Bot requested review from EdwardDowling and greedy52 May 9, 2025 21:22
@greedy52 greedy52 requested a review from rosstimothy May 12, 2025 22:59
Comment thread api/utils/keys/hardwarekeyagent/agent.go
Comment thread api/utils/keys/hardwarekeyagent/agent.go Outdated
Comment thread api/utils/keys/hardwarekeyagent/service.go Outdated
Comment thread api/utils/keys/piv/yubikey.go Outdated
Comment thread lib/client/client_store.go Outdated
Comment thread lib/client/keystore.go Outdated
@Joerger Joerger force-pushed the joerger/skip-validate-piv-cert branch from 19d8189 to 0f42d26 Compare May 14, 2025 00:29
@Joerger Joerger requested a review from rosstimothy May 14, 2025 00:29
@Joerger Joerger force-pushed the joerger/skip-validate-piv-cert branch 3 times, most recently from 73b6768 to a4869c9 Compare May 14, 2025 02:22
@Joerger Joerger force-pushed the joerger/skip-validate-piv-cert branch from adc85f0 to f7bc36e Compare May 14, 2025 18:07
Comment thread api/utils/keys/hardwarekeyagent/agent.go Outdated
Comment thread api/utils/keys/hardwarekey/hardwarekey.go Outdated
Comment thread api/utils/keys/hardwarekeyagent/agent.go Outdated
Comment thread lib/hardwarekey/agent.go Outdated
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from EdwardDowling May 16, 2025 14:50
@Joerger Joerger enabled auto-merge May 16, 2025 18:18
@Joerger Joerger added this pull request to the merge queue May 16, 2025
Merged via the queue into master with commit a2e7c20 May 16, 2025
43 checks passed
@Joerger Joerger deleted the joerger/skip-validate-piv-cert branch May 16, 2025 18:59
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@Joerger See the table below for backport results.

Branch Result
branch/v16 Failed
branch/v17 Failed

Joerger added a commit that referenced this pull request May 16, 2025
* * Have hardware key agent validate known keys instead of always validating by the PIV slot cert.

* Refactor cert check logic with a custom error.

* Add test.

* Update rfd.

* Fix lint.

* Address comments.

* Require knownKeyFn to be provided.

* Require fallbackService to be provided to agent service.

* Address comments.
Joerger added a commit that referenced this pull request May 16, 2025
* * Have hardware key agent validate known keys instead of always validating by the PIV slot cert.

* Refactor cert check logic with a custom error.

* Add test.

* Update rfd.

* Fix lint.

* Address comments.

* Require knownKeyFn to be provided.

* Require fallbackService to be provided to agent service.

* Address comments.
Joerger added a commit that referenced this pull request May 16, 2025
* * Have hardware key agent validate known keys instead of always validating by the PIV slot cert.

* Refactor cert check logic with a custom error.

* Add test.

* Update rfd.

* Fix lint.

* Address comments.

* Require knownKeyFn to be provided.

* Require fallbackService to be provided to agent service.

* Address comments.
github-merge-queue Bot pushed a commit that referenced this pull request May 19, 2025
* * Have hardware key agent validate known keys instead of always validating by the PIV slot cert.

* Refactor cert check logic with a custom error.

* Add test.

* Update rfd.

* Fix lint.

* Address comments.

* Require knownKeyFn to be provided.

* Require fallbackService to be provided to agent service.

* Address comments.
github-merge-queue Bot pushed a commit that referenced this pull request May 19, 2025
* * Have hardware key agent validate known keys instead of always validating by the PIV slot cert.

* Refactor cert check logic with a custom error.

* Add test.

* Update rfd.

* Fix lint.

* Address comments.

* Require knownKeyFn to be provided.

* Require fallbackService to be provided to agent service.

* Address comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/branch/v17 rfd Request for Discussion size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants