[v9] Make relogin attempts use the strongest auth method (#11781) #11847
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes a potential stdin hijacking bug by making relogin attempts default to a
single MFA method (the strongest available).
The problematic scenario is as follows:
tsh logout; tsh ssh --proxy=example.com llama@myserver
)enter a code from a OTP device")
prompt.Stdin)
In most cases this is fine, as the program ends right after. The issue is when a
relogin is triggered by a long living tsh invocation (again,
tsh ssh ...
): inthis case the stdin hijack causes input to be swallowed.
Forcing a single MFA option avoids the potential stdin hijack, fixing the
problem for all relogin invocations.
tsh login
behavior remains the same.Note that we have to default to cluster's most secure method without checking
the user devices. The user is not logged in yet, thus the backend cannot reveal
any information about that user.
Issue #11709.