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

[v9] Expand --mfa-mode and disable stdin hijack by default (#13134) #13212

Merged
merged 4 commits into from
Jun 8, 2022

Conversation

codingllama
Copy link
Contributor

@codingllama codingllama commented Jun 6, 2022

Avoid "input swallowing" bugs by disabling stdin hijacking by default.

Only tsh login is allowed to hijack stdin, as it is expected to exit right
after authentication. Any MFA authentication attempts resulting from
non-tsh login invocations default to the user's strongest auth method.

Defaulting to the strongest auth method can cause problems in constrained
environments for users that have both Webauthn and OTP registered. For example,
someone using tsh under WSL (Windows Subsystem for Linux) or a remote machine
could be locked into Webauthn MFA, which they can't use because their
environment lacks USB access or they don't have physical access to it. In order
to solve this problem I've slightly modified the meaning of the --mfa-mode
flag so otp can be specified.

The TELEPORT_MFA_MODE environment variable may be set to avoid constant flag
passing.

#13021

@codingllama codingllama requested review from Tener and zmb3 June 6, 2022 18:27
@github-actions github-actions bot added the tsh tsh - Teleport's command line tool for logging into nodes running Teleport. label Jun 6, 2022
@codingllama
Copy link
Contributor Author

Note to reviewers: this part of the codebase was refactored on master, so the backport isn't completely clean. I've removed mentions to FIDO2/AuthenticationAttachment (added in v10) and did a couple tweaks in the commits after the cherry pick (tests, in particular, are rather different between v9 and v10).

@codingllama codingllama force-pushed the codingllama/v9-sessionmfa-input branch from 25fc729 to efc7df8 Compare June 6, 2022 18:30
Avoid "input swallowing" bugs by disabling stdin hijacking by default.

Only `tsh login` is allowed to hijack stdin, as it is expected to exit right
after authentication. Any MFA authentication attempts resulting from
non-`tsh login` invocations default to the user's strongest auth method.

Defaulting to the strongest auth method can cause problems in constrained
environments for users that have both Webauthn and OTP registered. For example,
someone using `tsh` under WSL (Windows Subsystem for Linux) or a remote machine
could be locked into Webauthn MFA, which they can't use because their
environment lacks USB access or they don't have physical access to it. In order
to solve this problem I've slightly modified the meaning of the `--mfa-mode`
flag so `otp` can be specified.

The `TELEPORT_MFA_MODE` environment variable may be set to avoid constant flag
passing.

Fixes #12675 and #13021.

* Expand --mfa-mode and disable stdin hijack by default
* Use TELEPORT_ instead of TSH_ for FIDO2 env var
* Use t.Setenv in tests
@codingllama codingllama force-pushed the codingllama/v9-sessionmfa-input branch from 3e5dcaf to 0ad94f7 Compare June 8, 2022 13:58
@codingllama codingllama enabled auto-merge (squash) June 8, 2022 13:59
@codingllama codingllama merged commit abd8c62 into branch/v9 Jun 8, 2022
@codingllama codingllama deleted the codingllama/v9-sessionmfa-input branch June 8, 2022 14:24
codingllama added a commit that referenced this pull request Jun 8, 2022
Document the tsh --mfa-mode flag added by #13212.

Doc changes made exclusively to v9, I'm bundling this with the soon-to-be
passwordless docs for v10+.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 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