-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Remove CLI-based config options from Teleport Connect MFA prompts #47875
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was about to forward #46820 to you and that's how I found this PR.
I don't think this is going to affect #46820 that much nor bring it closer to completion. I assume #46820 is purely about SSH as we show the regular MFA prompt for other resources.
When you SSH to a node, the Electron app executes
tsh ssh
underneath, without going through the tsh daemon. Thattsh ssh
process has no knowledge about the Electron app. Making it Electron-aware would likely require too much effort.I think this could be solved in two ways. tsh could show some kind of prompt letting you choose which auth method you want to use. Historically, it seems that we eschewed that in favor of supplying a specific flag if someone wants to use OTP.
The other way to solve this would be to add a new config option to Connect (
ssh.mfaMode
?) that adds an appropriate flag to alltsh ssh
invocations coming from Connect. The user wouldn't be able to set this flag per-resource or even per profile, but at least it'd unblock users who are not able to use OTP at the moment.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we think about replacing the terminal-based mfa prompt for SSH with the custom connect MFA prompt? It should be possible to inject the custom prompt in there, but I need to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to explain why that's not hard to do in the third paragraph. ;) The MFA prompt for every other resource kind goes through tsh daemon, e.g., the Electron app tells tshd to create a local proxy, tshd attempts to generate a cert, lib/client code prompts for an MFA check and tshd forwards this to the Electron app.
SSH connections do not go through the tsh daemon, the Electron app just executes
tsh ssh
.If there's some other way of doing it without forcing
tsh ssh
to be Electron-aware then that's something we can explore.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC this is not something we want to do, as it requires us to set
AllowStdinHijack=true
so that tsh can accept input. We'd need to ask Alan for more details on what issues that can cause.Regardless I think we want this to start with an Electron dialog window if possible, it's cleaner than trying to add a config option or prompt for stdin.
The first idea to come to mind is to add a new tshd request to check if MFA is required before running the
tsh ssh
command. If MFA is required, we could see what options are available to them (Webauthn, totp, sso) and present them with a diagog to choose one, e.g. by clicking one of 3 buttons. Then depending on what they click, we could runtsh ssh --mfa-mode=sso/otp/webauthn
and let the cli prompt continue as normal. WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be fine UX-wise, but has the unfortunate effect of degrading performance for people not using per-session MFA, which is something we've strived to avoid. I remember this being the case when Michael was working on MFA in file transfers in the Web UI, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. In that case we should let
tsh ssh
do it's thing, racing an MFA and non-MFA session and only prompting when needed.Outside of making a whole new ssh for Connect implementation that utilizes
tshd
<-> Electron communication, we could experiment with other ways of havingtshd
/Electron communicate withtsh ssh
.For example, similar to our Teleport re-exec logic, we could pass a file descriptor to
tsh ssh
to handle back and forth communication with the Electron App. Over this file descriptor,tsh ssh
could send a generic MFA prompt request when needed, just like to the request fromtshd
.Or if a file descriptor isn't a viable solution (I don't know javascript limitations well), we could use a unix/tcp socket instead. Or maybe we could plug into the
tshd
socket fromtsh ssh
. e.g.tsh ssh --tshd=/path/to/socket
.