Skip to content

Inconsistent SSH Behavior between Tasks and Shells in VS Code Desktop #16440

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

Closed
burningion opened this issue Feb 16, 2023 · 5 comments
Closed

Comments

@burningion
Copy link

burningion commented Feb 16, 2023

Bug description

When you open up VS Code Desktop, Tasks do not have the environment variable SSH_ AUTH_SOCK set properly. This means you cannot do SSH Agent forwarding within Tasks, and cannot sign commits using SSH keys.

Doing an env | grep SSH on a fresh task, you get nothing.

Doing an env | grep SSH on a created bash shell, you get a socket that works, and works with SSH Agent forwarding.

If I try to manually spin up the ssh agent in a Task shell, I get:

$ env | grep SSH
$

This shows that there is no SSH_AUTH_SOCK set. I can try to create it using ssh-agent:

$ eval $(ssh-agent -s)
Agent pid 4250
$ env | grep SSH
SSH_AUTH_SOCK=/tmp/ssh-xPzWFGXpsd6T/agent.4249
SSH_AGENT_PID=4250

But if I try to verify my ssh agent forwarding with Github (I have an ssh key on my local machine and ssh agent forwarding enabled):

$ ssh -T git@github.com
ssh -T git@github.com
git@github.com: Permission denied (publickey).

I still do not get SSH agent forwarding. Once I set the SSH_AUTH_SOCK to one created by a Shell terminal (created and assigned automatically within every shell created with the plus sign in VS Code Desktop), I get authentication and signing with SSH agent forwarding both working properly.

# in the new bash shell
$ env | grep SSH
SSH_AUTH_SOCK=/tmp/vscode-ssh-auth-sock-494130870
SSH_CONNECTION=UNKNOWN 65535 UNKNOWN 65535
SSH_CLIENT=UNKNOWN 65535 65535

# exported in the Task
$ export SSH_AUTH_SOCK=/tmp/vscode-ssh-auth-sock-494130870
$ ssh -T git@github.com
Hi burningion! You've successfully authenticated, but GitHub does not provide shell access.

Steps to reproduce

See the above

Workspace affected

No response

Expected behavior

I expect consistent behavior across Tasks and newly created Shells for ssh agent forwarding. Otherwise I can't do Git commit signing with SSH keys from within the native UI, and have to manually open a shell and type out my commits.

Example repository

No response

Anything else?

No response

@burningion burningion changed the title Inconsistent SSH Behavior between Tasks and Shells is VS Code Desktop Inconsistent SSH Behavior between Tasks and Shells in VS Code Desktop Feb 16, 2023
@burningion
Copy link
Author

I think this would actually be fixed by #16108

@loujaybee
Copy link
Member

loujaybee commented Feb 23, 2023

I can replicate (Loom).

It has odd behaviour, as the SSH_AUTH_SOCK environment variables doesn't show for me in the browser (potentially expected behaviour, but feels odd). So, I'm not sure if this is an issue in our implementation or Remote SSH. There are a couple of what look like related issues open for Remote SSH, including:

There are some workarounds for starting the agent in bash_profile:

https://code.visualstudio.com/docs/remote/troubleshooting - but I did not try those, yet.

@jeanp413 do you know any more?

@jeanp413
Copy link
Member

Slack discussion : https://gitpod.slack.com/archives/C020VCB0U5A/p1676470768617929

TL;DR: task terminal does not have agent forwarding because they are created before ssh connection happens

@loujaybee loujaybee moved this to Scheduled in 🚀 IDE Team Feb 23, 2023
@akosyakov
Copy link
Member

I guess we could make supervisor to install own SSH_AUTH_SOCK and proxy it to IDE via an extension. Kind of the same what we do for gp open/preview.

@stale
Copy link

stale bot commented Jun 11, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Jun 11, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
@github-project-automation github-project-automation bot moved this from Scheduled to Done in 🚀 IDE Team May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants