Improve error reporting in tsh ssh if the MFA API is unavailable#63984
Open
espadolini wants to merge 4 commits intomasterfrom
Open
Improve error reporting in tsh ssh if the MFA API is unavailable#63984espadolini wants to merge 4 commits intomasterfrom
tsh ssh if the MFA API is unavailable#63984espadolini wants to merge 4 commits intomasterfrom
Conversation
Contributor
Author
|
@hugoShaka @rudream ping |
Contributor
Author
|
@hugoShaka @rudream ping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR changes the error reporting when
tsh sshfails to connect to a target host iftshwas unable to determine if MFA was required. Currently, in almost all cases if the connection to the target host fails, the user will only see the error from the MFA ceremony, even if the ceremony failed due to reasons unrelated to the connectivity to the host, for example if a rate limit is being hit (perhaps due to #63549, for example).Moreover, there's no way to get the error from the direct connection attempt, even with debug logging enabled.
After this PR, errors from the MFA ceremony of the
trace.ConnectionProblemandtrace.LimitExceededkind are deprioritized and the error shown to the user is the one from the direct connection attempt:If debug logging is enabled, the deprioritized error is shown in the logs:
Additionally, this PR tweaks the error message of the
MFARequiredUnknownErrorwrapper to include a "unable to determine if a MFA ceremony is required" prefix.Manual Test Plan
Test Environment
Control plane (cloud staging) and one node (ec2 linux arm64) running 18.7.2 release, local build of tsh with this PR (darwin arm64).
Test Cases
tsh sshhits a connection error while the auth API is rate limited (due to masstsh ssh, for example) shows the error from the connection error rather than just "rate limit exceeded"