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

GitHub proxy: git to prompt for password when tsh session expires #51305

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

greedy52
Copy link
Contributor

@greedy52 greedy52 commented Jan 21, 2025

related:

changelog: git commands executed in terminals (now support interactive login prompts when the tsh session expires

Did not add a unit test since it's difficult to mock.

Sample log before the change:

2025-01-21T14:35:49.858-05:00 DEBU [CLIENT]    Relogin is not available in this environment error:[
ERROR REPORT:
Original Error: *errors.errorString underlying reader is not a terminal
Stack Trace:
	github.com/gravitational/teleport/lib/client/api.go:4873 github.com/gravitational/teleport/lib/client.(*TeleportClient).AskPassword
	github.com/gravitational/teleport/lib/client/api.go:4111 github.com/gravitational/teleport/lib/client.(*TeleportClient).localLogin
	github.com/gravitational/teleport/lib/client/api.go:3717 github.com/gravitational/teleport/lib/client.(*TeleportClient).getSSHLoginFunc.func2
	github.com/gravitational/teleport/lib/client/api.go:3909 github.com/gravitational/teleport/lib/client.(*TeleportClient).SSHLogin.func1
	github.com/gravitational/teleport/lib/client/api.go:3962 github.com/gravitational/teleport/lib/client.(*TeleportClient).loginWithHardwareKeyRetry
	github.com/gravitational/teleport/lib/client/api.go:3907 github.com/gravitational/teleport/lib/client.(*TeleportClient).SSHLogin
	github.com/gravitational/teleport/lib/client/api.go:3497 github.com/gravitational/teleport/lib/client.(*TeleportClient).Login
	github.com/gravitational/teleport/lib/client/api.go:675 github.com/gravitational/teleport/lib/client.RetryWithRelogin
	github.com/gravitational/teleport/tool/tsh/common/git_ssh.go:83 github.com/gravitational/teleport/tool/tsh/common.(*gitSSHCommand).run
	github.com/gravitational/teleport/tool/tsh/common/tsh.go:1656 github.com/gravitational/teleport/tool/tsh/common.Run
	github.com/gravitational/teleport/tool/tsh/common/tsh.go:644 github.com/gravitational/teleport/tool/tsh/common.Main
	github.com/gravitational/teleport/tool/tsh/main.go:26 main.main
	runtime/proc.go:272 runtime.main
	runtime/asm_arm64.s:1223 runtime.goexit
User Message: cannot perform password login without a terminal
	underlying reader is not a terminal] trace_id:a7b8b7690ed59e49842906951f2d57a3 span_id:96231e274f9c4507 client/api.go:678

After this change (tested on mac and amazon linux)

$ git fetch
Enter password for Teleport user admin:
Available MFA methods [WEBAUTHN, OTP]. Continuing with WEBAUTHN.
If you wish to perform MFA with another method, specify with flag --mfa-mode=<sso,otp>.

Tap any security key
Detected security key tap

@greedy52 greedy52 added backport/branch/v17 github GitHub integration related labels Jan 21, 2025
@greedy52 greedy52 self-assigned this Jan 21, 2025
@greedy52 greedy52 force-pushed the STeve/48762_tsh_git_prompt branch 2 times, most recently from cac1646 to 36c6232 Compare January 21, 2025 19:58
@greedy52 greedy52 mentioned this pull request Jan 23, 2025
9 tasks
@greedy52 greedy52 force-pushed the STeve/48762_tsh_git_prompt branch from 36c6232 to d31ff45 Compare January 28, 2025 19:36
@greedy52 greedy52 force-pushed the STeve/48762_tsh_git_prompt branch from d31ff45 to 9bb85d0 Compare January 29, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v17 github GitHub integration related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant