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

[Remote-SSH Bug]: SSH-Agent Forwarding stoped working #9662

Open
3 tasks done
Crefok opened this issue Mar 15, 2024 · 12 comments
Open
3 tasks done

[Remote-SSH Bug]: SSH-Agent Forwarding stoped working #9662

Crefok opened this issue Mar 15, 2024 · 12 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug ssh Issue in vscode-remote SSH

Comments

@Crefok
Copy link

Crefok commented Mar 15, 2024

Is there an existing issue for this bug?

  • I have searched the existing issues

Required Troubleshooting Steps

  • I have followed these troubleshooting steps
  • I have tried both values of the remote.SSH.useLocalServer setting

Connect Locally

It connects successfully

->

No response

Expected Behavior

I would expect to get the ssh-agent forwarded to the ssh client. But that isn't working anymore.
If I directly connect to the same Host, the ssh agent is forwarded, and can be used.

Steps To Reproduce

  1. vs-code is updated to the newest version
  2. ssh-config ForwardAgent yes is set
  3. connect to the remote Host via vs code remote extension.
  4. try to connect to another host via integrated terminal an use the forwarded host key

Remote-SSH Log

Remote-SSH Log

[16:18:24.113] Log Level: 2
[16:18:24.118] VS Code version: 1.87.2
[16:18:24.118] Remote-SSH version: remote-ssh@0.109.0
[16:18:24.118] darwin arm64
[16:18:24.119] SSH Resolver called for "ssh-remote+edge01", attempt 1
[16:18:24.119] "remote.SSH.useLocalServer": true
[16:18:24.119] "remote.SSH.useExecServer": true
[16:18:24.119] "remote.SSH.path": undefined
[16:18:24.119] "remote.SSH.configFile": undefined
[16:18:24.119] "remote.SSH.useFlock": true
[16:18:24.119] "remote.SSH.lockfilesInTmp": false
[16:18:24.119] "remote.SSH.localServerDownload": auto
[16:18:24.119] "remote.SSH.remoteServerListenOnSocket": false
[16:18:24.120] "remote.SSH.showLoginTerminal": false
[16:18:24.120] "remote.SSH.defaultExtensions": []
[16:18:24.120] "remote.SSH.loglevel": 2
[16:18:24.120] "remote.SSH.enableDynamicForwarding": true
[16:18:24.120] "remote.SSH.enableRemoteCommand": false
[16:18:24.120] "remote.SSH.serverPickPortsFromRange": {}
[16:18:24.120] "remote.SSH.serverInstallPath": {}
[16:18:24.123] SSH Resolver called for host: edge01
[16:18:24.123] Setting up SSH remote "edge01"
[16:18:24.124] Acquiring local install lock: /var/folders/1_/vy1hm2gn3_z9vpxkgb65z0300000gq/T/vscode-remote-ssh-b74c3d4f-install.lock
[16:18:24.125] Looking for existing server data file at /Users/<USER>/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-b74c3d4f-863d2581ecda6849923a2118d93a088b0745d9d6-0.109.0-es/data.json
[16:18:24.126] Found local server running: {"remoteListeningOn":{"port":40560},"osReleaseId":"rhel","arch":"x86_64","sshAuthSock":"/tmp/ssh-djn2ienDq4/agent.275215","display":"","tmpDir":"/run/user/9264","platform":"linux","execServerToken":"f56215be-b7e7-4472-be03-0b3eb9f05ee2","pid":73244,"ipcHandlePath":"/var/folders/1_/vy1hm2gn3_z9vpxkgb65z0300000gq/T/vscode-ssh-askpass-af3f88910e8059a1d091bf39f1874ce63413ef4a.sock","socksPort":62312,"startupTime":1710514181093}
[16:18:24.128] Found running server - short-circuiting install
[16:18:24.130] Starting forwarding server. local port 61305 -> socksPort 62312 -> remotePort 40560
[16:18:24.130] Forwarding server listening on port 61305
[16:18:24.130] Waiting for ssh tunnel to be ready
[16:18:24.130] Tunneled port 40560 to local port 61305
[16:18:24.130] Resolved "ssh-remote+edge01" to "port 61305"
[16:18:24.134] Initizing new exec server for ssh-remote+edge01
[16:18:24.134] Resolving exec server at port 61305
[16:18:24.147] [Forwarding server port 61305] Got connection 0
[16:18:24.147] [Forwarding server port 61305] Got connection 1
[16:18:24.230] Exec server for ssh-remote+edge01 created and cached
[16:18:24.232] ------




[16:18:24.257] [server] Checking /home/<USER>/.vscode-server/cli/servers/Stable-863d2581ecda6849923a2118d93a088b0745d9d6/log.txt and /home/<USER>/.vscode-server/cli/servers/Stable-863d2581ecda6849923a2118d93a088b0745d9d6/pid.txt for a running server...
[16:18:24.296] [server] Found running server (pid=167271)
[16:22:34.771] ConfigFileWatcher: start watching file:///Users/<USER>/.ssh/config
[16:22:34.771] ConfigFileWatcher: adding save listener
[16:22:34.771] ConfigFileWatcher: adding close listener
[16:22:46.175] ConfigFileWatcher: start watching file:///etc/ssh/ssh_config
[16:22:55.403] ConfigFileWatcher: closing file:///etc/ssh/ssh_config
[16:22:55.403] ConfigFileWatcher: stop watching file:///etc/ssh/ssh_config
[16:23:23.641] ConfigFileWatcher: closing file:///Users/<USER>/.ssh/config
[16:23:23.641] ConfigFileWatcher: stop watching file:///Users/<USER>/.ssh/config
[16:23:23.641] ConfigFileWatcher: removing save listener
[16:23:23.641] ConfigFileWatcher: removing close listener

Anything else?

ssh-add -l via direct ssh connection to the hosts lists the same keys as on the notebook I connected to the host. These Keys are also set so use on other hosts

ssh-add -l got the following output, when used in the VS Code Bash Terminal.

ssh-add -l
Error connecting to agent: No such file or directory

VS Code Version

Version: 1.87.2
Commit: 863d2581ecda6849923a2118d93a088b0745d9d6
Datum: 2024-03-08T15:20:57.520Z (Vor 1 Woche(n))
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
Betriebssystem: Darwin arm64 23.4.0

With VS Code Version does it work!

Version: 1.86.2
Commit: 903b1e9d8990623e3d7da1df3d33db3e42d80eda
Datum: 2024-02-13T19:42:12.210Z (Vor 1 Monat(en))
Electron: 27.2.3
ElectronBuildId: 26908389
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
Betriebssystem: Darwin arm64 23.4.0
@Crefok Crefok added the ssh Issue in vscode-remote SSH label Mar 15, 2024
@roblourens
Copy link
Member

Does it make a difference if you set "remote.SSH.useExecServer": false?

@roblourens roblourens added the info-needed Issue requires more information from poster label Mar 20, 2024
@Crefok
Copy link
Author

Crefok commented Mar 21, 2024

Yes If I set this option to false the agent will be forwarded and I can tunnel to the next host

@gopipalamalai
Copy link

gopipalamalai commented Mar 26, 2024

I have been seeing the issue same as microsoft/vscode#168202 since Mar 22, 2024. Disabling remote.SSH.useExecServer fixed it once. I have to observe over a few more days if this sticks and continues to work. what about remote.ssh.useLocalServer orremote.SSH.enableAgentForwarding ? Do they need to be disabled too as per this microsoft/vscode#175806 (comment) @roblourens

ssh-add -l
Error connecting to agent: No such file or directory

@misl-smlz
Copy link

I had the same issue today. Disabling remote.SSH.useExecServer fixed it for now. Can I help in any way to solve the problem?

@berrugo
Copy link

berrugo commented Mar 26, 2024

remote.SSH.useExecServer

@roblourens It worked, thanks! Just make sure to reload window afterwards

@egfx-notifications
Copy link

Does it make a difference if you set "remote.SSH.useExecServer": false?

I just went back to still available older versions of the extension and

  • the first extension version where this happens is the one that introduced the "remote.SSH.useExecServer" setting
  • starting with this version the agent forwarding works again when setting "remote.SSH.useExecServer" to false

@WellWells
Copy link

The same issue is occurring for me as well.
I'm using VSCode version 1.88.0 (2024-04-03) along with Remote - SSH version v0.110.1.

I have confirmed that the private key is installed on my local machine, and I can connect normally using "ssh -A user@server" with successful git operations.
Previously, when I connected through VSCode, I configured it with "ForwardAgent yes" in the ssh config file, and git operations were working fine.

The current workaround, as described above, involves accessing settings and disabling remote.SSH.useExecServer to resolve this issue.

image

@francisrafal
Copy link

Same issue here, also fixed by disabling remote.SSH.useExecServer

@tgquan67
Copy link

Confirmed this problem happened for me with plugin version v0.110.1 on VSCode 1.88.1, Ubuntu 20.04.6. Disabling remote.SSH.useExecServer helped as a workaround.

@Crefok
Copy link
Author

Crefok commented Apr 15, 2024

If the remote Server has no connection to the Internet then the upgrade Prozess of VSCode Remote Server runs into some timeouts.
Current Workaround for me is to disable autoupdate (settings->application->update->update.mode to manuel) and use Version: 1.86.2 of VSCode

@0x4c6565
Copy link

Can confirm remote.SSH.useExecServer solves this for me too, however now prompts for key passphrase? It works without providing passphrase however.

@roblourens roblourens assigned connor4312 and unassigned roblourens Apr 30, 2024
@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Apr 30, 2024
@alexisshaw
Copy link

Wanted to comment that this still appears to be an issue for me too, but that "remote.SSH.useExecServer": false seems to solve the issue too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests