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

Add MFAVerificationInterval option for roles #45569

Merged
merged 9 commits into from
Aug 22, 2024
Merged

Conversation

AntonAM
Copy link
Contributor

@AntonAM AntonAM commented Aug 16, 2024

This PR adds a new option to the roles spec -MFAVerificationInterval (mostly implemented by @tigrato). It allows to set a limit on TTL of the local tsh proxy certificates. Currently they were issued for the whole duration of max_session_ttl which sometimes could be too long and some clients wanted to be able to shorten that period. If the new options is set, proxy will try to reissue certificates more often requiring to provide MFA for reissuing, so effectively client can now freely select what length between MFA checks is allowed.

Fixes: #36638

Changelog: Allow to limit duration of local tsh proxy certificates with a new MFAVerificationInterval option.

@AntonAM AntonAM added tsh tsh - Teleport's command line tool for logging into nodes running Teleport. rbac Issues related to Role Based Access Control labels Aug 16, 2024
@AntonAM AntonAM marked this pull request as ready for review August 16, 2024 20:43
@AntonAM AntonAM requested review from tigrato and rosstimothy and removed request for hugoShaka and capnspacehook August 16, 2024 20:44
@AntonAM AntonAM force-pushed the anton/min-adjust-ttl branch 2 times, most recently from 4f448ee to 5939d87 Compare August 20, 2024 16:10
Copy link
Contributor

@tigrato tigrato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking it 😃

// tsh proxy * derivatives.
// It's only effective if the session requires MFA.
// If not set, defaults to `max_session_ttl`.
int64 MinMFAVerificationInterval = 30 [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that Alan imported the gogo proto wrappers, can we use the google.protobuf.Duration instead of the typecast?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it and it didn't play well, we get a Duration struct that is not nice to use, not the durationpb one. So I think better keep the legacy approach with the typecast

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you include de std duration flag for gogo? It generates a time.Duration

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I missed that. Now looks ok, changed 1fdb62b

Copy link
Contributor

@rosstimothy rosstimothy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you be creating a follow up PR that updates our documentation to include this new functionality?

api/proto/teleport/legacy/types/types.proto Outdated Show resolved Hide resolved
@AntonAM AntonAM force-pushed the anton/min-adjust-ttl branch 2 times, most recently from 290babe to 3155daa Compare August 21, 2024 07:52
@rosstimothy rosstimothy changed the title Add MinMFAVerificationInterval option for roles Add MFAVerificationInterval option for roles Aug 21, 2024
@AntonAM AntonAM added this pull request to the merge queue Aug 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 21, 2024
@AntonAM AntonAM enabled auto-merge August 21, 2024 20:37
@AntonAM AntonAM added this pull request to the merge queue Aug 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 21, 2024
@AntonAM AntonAM added this pull request to the merge queue Aug 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 21, 2024
@AntonAM AntonAM added this pull request to the merge queue Aug 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 21, 2024
@AntonAM AntonAM added this pull request to the merge queue Aug 21, 2024
Merged via the queue into master with commit edcc6a4 Aug 22, 2024
43 of 44 checks passed
@AntonAM AntonAM deleted the anton/min-adjust-ttl branch August 22, 2024 00:17
@public-teleport-github-review-bot

@AntonAM See the table below for backport results.

Branch Result
branch/v16 Failed

AntonAM added a commit that referenced this pull request Aug 22, 2024
* add min mfa ttl

* Fix missing import

* Take into account cluster wide's requirement of per session MFA.

* Add tests.

* Protobufs update.

* Rename minMFAVerificationInterval to MFAVerificationInterval

* Use google.protobuf.Duration instead of casttype Duration.

* Remove unnecessary types.NewDuration cast.

* Update docs for mfaVerificationInterval.

---------

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
AntonAM added a commit that referenced this pull request Aug 22, 2024
* add min mfa ttl

* Fix missing import

* Take into account cluster wide's requirement of per session MFA.

* Add tests.

* Protobufs update.

* Rename minMFAVerificationInterval to MFAVerificationInterval

* Use google.protobuf.Duration instead of casttype Duration.

* Remove unnecessary types.NewDuration cast.

* Update docs for mfaVerificationInterval.

---------

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
github-merge-queue bot pushed a commit that referenced this pull request Aug 22, 2024
* add min mfa ttl

* Fix missing import

* Take into account cluster wide's requirement of per session MFA.

* Add tests.

* Protobufs update.

* Rename minMFAVerificationInterval to MFAVerificationInterval

* Use google.protobuf.Duration instead of casttype Duration.

* Remove unnecessary types.NewDuration cast.

* Update docs for mfaVerificationInterval.

---------

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v16 rbac Issues related to Role Based Access Control size/md 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.

tsh proxy kube accept lower durations than max_session_ttl
3 participants