Skip to content

Add second_factors#47233

Merged
Joerger merged 14 commits intomasterfrom
joerger/add-second-factors
Oct 11, 2024
Merged

Add second_factors#47233
Joerger merged 14 commits intomasterfrom
joerger/add-second-factors

Conversation

@Joerger
Copy link
Copy Markdown
Contributor

@Joerger Joerger commented Oct 4, 2024

Add second_factors and prefer it over second_factor.

We don't currently plan on removing second_factor, as this would require a more complicated migration process. Instead we will just derive second_factors from second_factor (and vice versa) and output a warning log when second_factor is set.

There is no plan to deprecate second_factor completely. When second_factor is set and second_factors is not, or vice versa, we convert from one to the other.

In a follow up PR I will update as much logic as possible to use second_factors instead of second_factor, as they are two sources of the same information.

In this PR I've also added the SSO second_factor type. It is currently completely unused, but we'd rather get the proto changes into v17 rather than waiting until SSO MFA is fully released in a minor version.

Follow up TODO: Update docs.

Changelog: Add new second_factors field to cluster auth preference for more clarity and granularity over which 2fa methods are enabled in a cluster.

Depends on #47230

@Joerger Joerger changed the title Joerger/add second factors Add second_Factors Oct 4, 2024
@Joerger Joerger force-pushed the joerger/add-second-factors branch from 3e32b81 to d536667 Compare October 4, 2024 21:24
@Joerger Joerger marked this pull request as ready for review October 4, 2024 21:24
@github-actions github-actions Bot requested review from gzdunek and tigrato October 4, 2024 21:24
Comment thread api/types/authentication.go
@Joerger Joerger force-pushed the joerger/add-second-factors branch 2 times, most recently from cd71433 to 10c8b33 Compare October 4, 2024 21:32
@Joerger Joerger mentioned this pull request Oct 5, 2024
@zmb3 zmb3 added the release-notes A reminder label to into the release notes of the Teleport Release. label Oct 5, 2024
Comment thread api/proto/teleport/legacy/types/types.proto
Comment thread api/types/authentication.go
Comment thread api/types/authentication.go Outdated
@Joerger Joerger requested a review from tigrato October 7, 2024 19:58
Copy link
Copy Markdown
Contributor

@codingllama codingllama 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 the separate PR, Brian! Apologies for the delay.

Comment thread api/types/authentication.go Outdated
Comment thread api/types/authentication.go
Comment thread api/types/authentication.go Outdated
Comment thread api/types/authentication.go Outdated
Comment thread api/types/authentication.go Outdated
Comment thread api/types/authentication.go Outdated
Comment thread api/types/authentication.go Outdated
default:
slog.WarnContext(context.Background(), "Found unknown second_factor setting", "second_factor", sf)
return "" // Unsure, say nothing.
return nil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this error instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we should just validate SecondFactor in CheckAndSetDefaults.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would erroring here make for a clearer error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think so

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread lib/config/fileconf.go Outdated
Comment thread lib/config/fileconf.go Outdated
Comment thread lib/config/fileconf.go
@Joerger Joerger changed the base branch from joerger/enum-helper to master October 8, 2024 18:40
@Joerger Joerger force-pushed the joerger/add-second-factors branch from a170f2f to 653babe Compare October 8, 2024 19:20
Comment thread api/types/authentication.go Outdated
Comment thread api/types/second_factor.go Outdated
Comment thread api/types/second_factor.go Outdated
Comment thread api/types/second_factor.go Outdated
Comment thread api/types/second_factor.go Outdated
Comment thread api/types/second_factor.go Outdated
@Joerger Joerger requested a review from codingllama October 8, 2024 19:45
@Joerger Joerger force-pushed the joerger/add-second-factors branch 2 times, most recently from a543532 to 06ce4f1 Compare October 9, 2024 01:16
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 9, 2024

🤖 Vercel preview here: https://docs-4jw07zxys-goteleport.vercel.app/docs/ver/preview

Comment thread api/types/authentication.go Outdated
Comment thread api/types/authentication.go Outdated
return trace.BadParameter("missing required Webauthn configuration for headless=true")
}

// Prevent accidental local lockout by disabling local second factor methods, (likely leaving only sso enabled).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we get test coverage for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread api/types/authentication.go Outdated
Comment thread api/types/second_factor.go Outdated
Comment thread api/types/authentication.go Outdated
Comment thread lib/config/configuration_test.go
Comment thread api/types/second_factor.go
@Joerger Joerger changed the title Add second_Factors Add second_factors Oct 10, 2024
@Joerger Joerger added this pull request to the merge queue Oct 10, 2024
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 10, 2024
@Joerger Joerger added this pull request to the merge queue Oct 10, 2024
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 10, 2024
@github-actions
Copy link
Copy Markdown
Contributor

🤖 Vercel preview here: https://docs-6xrjugnkq-goteleport.vercel.app/docs/ver/preview

@Joerger Joerger added this pull request to the merge queue Oct 11, 2024
github-merge-queue Bot pushed a commit that referenced this pull request Oct 11, 2024
* Add proto.

* Add decoding logic for SecondFactorType.

* Update auth preference methods to use and prefer SecondFactors.

* Add fileconf and warning logs.

* Fix tests.

* Address comments.

* Address comments.

* Validate SecondFactor; Disallow SecondFactor and SecondFactors to both be set.

* Address comments.

* Treat second factor SSO as SecondFactor=on; Prevent local user lockout when SSO is the only enabled MFA method; Ensure SecondFactors=[] is disallowed.

* Upate terraform schema, docs, crds.

* Address comments.

* Address comments.

* Fix lint, fix test.
Merged via the queue into master with commit dbe08e0 Oct 11, 2024
@Joerger Joerger deleted the joerger/add-second-factors branch October 11, 2024 00:35
mvbrock pushed a commit that referenced this pull request Oct 16, 2024
* Add proto.

* Add decoding logic for SecondFactorType.

* Update auth preference methods to use and prefer SecondFactors.

* Add fileconf and warning logs.

* Fix tests.

* Address comments.

* Address comments.

* Validate SecondFactor; Disallow SecondFactor and SecondFactors to both be set.

* Address comments.

* Treat second factor SSO as SecondFactor=on; Prevent local user lockout when SSO is the only enabled MFA method; Ensure SecondFactors=[] is disallowed.

* Upate terraform schema, docs, crds.

* Address comments.

* Address comments.

* Fix lint, fix test.
@zmb3
Copy link
Copy Markdown
Collaborator

zmb3 commented Nov 12, 2024

@Joerger did we ever got docs updates for this one?

@Joerger
Copy link
Copy Markdown
Contributor Author

Joerger commented Nov 12, 2024

@Joerger did we ever got docs updates for this one?

No not yet, it's on my TODO list, along with SSO MFA docs

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

Labels

release-notes A reminder label to into the release notes of the Teleport Release. size/md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants