Skip to content

Add second_factors#47169

Closed
Joerger wants to merge 8 commits intomasterfrom
joerger/second-factors
Closed

Add second_factors#47169
Joerger wants to merge 8 commits intomasterfrom
joerger/second-factors

Conversation

@Joerger
Copy link
Copy Markdown
Contributor

@Joerger Joerger commented Oct 3, 2024

Add second_factors and deprecate 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 output a warning log when second_factor is set.

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.

Note: I have not propogated the second_factors change to the Teleport Connect or WebUI, meaning those still rely on the second_factor from proxy ping response. I will do this in a follow up PR.

Based off #47153 due to reduced dependence on second_factor from proxy ping response.

TODO: I expect some test breakages, will fix after opening. Also cleanup.

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.

@github-actions github-actions Bot added size/md tctl tctl - Teleport admin tool tsh tsh - Teleport's command line tool for logging into nodes running Teleport. ui labels Oct 3, 2024
@github-actions github-actions Bot requested review from gzdunek and ryanclark October 3, 2024 21:24
@Joerger Joerger requested a review from rosstimothy October 3, 2024 21:24
@gravitational gravitational deleted a comment from github-actions Bot Oct 3, 2024
@Joerger Joerger force-pushed the joerger/deprectate-password-login-endpoint branch from 515cd9b to 20d569d Compare October 4, 2024 01:01
@Joerger Joerger force-pushed the joerger/second-factors branch 2 times, most recently from 525ff1e to 2425453 Compare October 4, 2024 02:04
Base automatically changed from joerger/deprectate-password-login-endpoint to master October 4, 2024 18:14
@Joerger Joerger force-pushed the joerger/second-factors branch from f8db35d to 04fd4a4 Compare October 4, 2024 18:54
@Joerger Joerger force-pushed the joerger/second-factors branch from 04fd4a4 to 9dd277c Compare October 4, 2024 20:35
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.

Taking a quick look, I'm not certain we should deprecate second_factor (see comment threads).

If we do go that way, I think we should make this PR only about adding second_factors, and follow up with a deprecation and widespread changes separately. It helps greatly in bounding the review.

}

// SecondFactorType is the type of 2FA authentication.
// Deprecated: Use types.SecondFactorType
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.

Will this cause problems on e/ ?

(I'm not sure deprecating this is wise, see other comment threads.)

// The current default value is "legacy". This field is not yet fully supported.
SignatureAlgorithmSuite signature_algorithm_suite = 20;

// SecondFactors is a list of supported second factor types.
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.

Suggested change
// SecondFactors is a list of supported second factor types.
// SecondFactors is a list of supported second factor types, in ascending
// order of preference (first item is preferred).

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.

and deprecate second_factor

Do we have to? Every config out there uses it, plus I see little harm in keeping it around.

Comment thread integration/db/fixture.go
rcConf.DataDir = t.TempDir()
rcConf.Auth.Enabled = true
rcConf.Auth.Preference.SetSecondFactor("off")
rcConf.Auth.Preference.SetSecondFactor(constants.SecondFactorOff)
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.

Taking the PR as-is, isn't this introducing a new usage of a deprecated constant?

Comment thread api/types/enum.go
// decodeEnum decodes a protobuf enum from a representational value, usually a bool,
// string, or from the actual enum (int32) value. If the value is valid, it is saved
// in the given enum pointer.
func decodeEnum[T ~int32](p *T, val any, representationMap map[any]T, enumMap map[int32]string) error {
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.

I'd be tempted to punt on this change for this PR, or move it to a separate isolated PR that could be backported without conflict. There is a decent amount going on in this PR and the additional updates to start using this helper add extra noise.

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.

@Joerger
Copy link
Copy Markdown
Contributor Author

Joerger commented Oct 4, 2024

Taking a quick look, I'm not certain we should deprecate second_factor (see comment threads).

We don't plan on removing second_factor any time soon. We will prefer if second_factors is set, but derive it from second_factor otherwise for the foreseeable future.

If we do go that way, I think we should make this PR only about adding second_factors, and follow up with a deprecation and widespread changes separately. It helps greatly in bounding the review.

I will try to split this into a couple PRs.

@codingllama
Copy link
Copy Markdown
Contributor

Thanks, Brian!

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

Labels

size/md tctl tctl - Teleport admin tool tsh tsh - Teleport's command line tool for logging into nodes running Teleport. ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants