microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.75k stars 29.1k forks source link

VSCode does not forward the agent #167234

Closed misha-antonenko closed 1 year ago

misha-antonenko commented 1 year ago

Type: Bug

I have an .ssh/config of form Host my-server\n ForwardAgent yes\n .... The agent forwarding does not work when I connect via VSCode and works when I do via Terminal.app

The value of SSH_AUTH_SOCK when connecting through VSCode is something like /tmp/vscode-ssh-auth-sock-881637497; when connecting with ssh my-server in Terminal.app it resembles /tmp/ssh-4zEUMPMAoH/agent.1208460. Swapping the SSH_AUTH_SOCK in the VSCode terminal for /tmp/ssh-4zEUMPMAoH/agent.1208460 seems to work to reintroduce agent forwarding

VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T02:08:38.961Z) OS version: Darwin x64 21.6.0 Modes: Sandboxed: No Remote OS version: Linux x64 5.4.161-26.5

System Info |Item|Value| |---|---| |CPUs|Apple M1 (8 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|2, 2, 2| |Memory (System)|16.00GB (0.02GB free)| |Process Argv|--crash-reporter-id de7537ee-b7ff-4aa6-9ac1-40d3f0a20bb2| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|SSH: octave| |OS|Linux x64 5.4.161-26.5| |CPUs|Intel(R) Xeon(R) Gold 6230 CPU @ 2.10GHz (65 x 2095)| |Memory (System)|156.22GB (102.89GB free)| |VM|0%|
Extensions (85) Extension|Author (truncated)|Version ---|---|--- language-x86-64-assembly|13x|3.0.0 Bookmarks|ale|13.3.1 close-tabs-to-the-left|ctf|0.0.3 customize-ui|ioc|0.1.65 monkey-patch|ioc|0.1.23 better-cpp-syntax|jef|1.16.3 vsc-python-indent|Kev|1.18.0 kconfig|luv|1.0.3 jupyter-keymap|ms-|1.0.0 remote-containers|ms-|0.262.3 remote-ssh|ms-|0.92.0 remote-ssh-edit|ms-|0.84.0 remote-wsl|ms-|0.72.0 vscode-remote-extensionpack|ms-|0.23.0 remote-explorer|ms-|0.0.2 remote-repositories|ms-|0.24.0 deepdark-material|Nim|3.3.0 scala|sca|0.5.6 ayu|tea|1.0.5 vscode-todo-highlight|way|1.0.5 jinja|who|0.0.8 linkerscript|Zix|1.0.2 language-x86-64-assembly|13x|3.0.0 Bookmarks|ale|13.3.1 asciidoctor-vscode|asc|2.9.8 vscode-django|bat|1.10.0 vscode-bazel|Baz|0.6.0 better-toml|bun|0.3.2 doxdocgen|csc|1.4.0 close-tabs-to-the-left|ctf|0.0.3 python-environment-manager|don|1.0.4 python-extension-pack|don|1.7.0 gitlens|eam|13.1.1 shell-format|fox|7.2.2 go|gol|0.36.0 gc-excelviewer|Gra|4.2.56 todo-tree|Gru|0.0.220 jbockle-format-files|jbo|3.4.0 better-cpp-syntax|jef|1.16.3 list-symbols|jmb|0.0.5 vsc-python-indent|Kev|1.18.0 lean4|lea|0.0.99 vscode-mlir|llv|0.0.11 kconfig|luv|1.0.3 rainbow-csv|mec|3.3.0 vscode-docker|ms-|1.22.2 vscode-ros|ms-|0.8.4 isort|ms-|2022.8.0 python|ms-|2022.18.2 vscode-pylance|ms-|2022.11.30 jupyter|ms-|2022.9.1303220346 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.12 vscode-jupyter-cell-tags|ms-|0.1.6 vscode-jupyter-slideshow|ms-|0.1.5 cmake-tools|ms-|1.12.27 cpptools|ms-|1.12.4 cpptools-extension-pack|ms-|1.3.0 hexeditor|ms-|1.9.9 makefile-tools|ms-|0.6.0 remote-repositories|ms-|0.24.0 deepdark-material|Nim|3.3.0 autodocstring|njp|0.6.1 vscode-pbkit|pbk|0.0.5 vscode-yandex-arc|per|0.151.0 java|red|1.12.0 vscode-xml|red|0.22.0 vscode-yaml|red|1.10.1 rust-analyzer|rus|0.3.1293 bash-beautify|sha|0.1.1 ayu|tea|1.0.5 cmake|twx|0.0.17 vscode-lldb|vad|1.8.1 intellicode-api-usage-examples|Vis|0.2.6 vscodeintellicode|Vis|1.2.29 vscode-java-debug|vsc|0.46.0 vscode-java-dependency|vsc|0.21.1 vscode-java-pack|vsc|0.25.6 vscode-java-test|vsc|0.37.1 vscode-maven|vsc|0.39.2 vscode-todo-highlight|way|1.0.5 jinja|who|0.0.8 local-history|xyz|1.8.1 save-as-root|yy0|1.5.0 linkerscript|Zix|1.0.2 (12 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscorecescf:30445987 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vsclangdc:30486549 c4g48928:30535728 dsvsc012:30540252 azure-dev_surveyone:30548225 pyindex848:30577860 nodejswelcome1cf:30587006 2e4cg342:30602488 gswce1:30612156 3d0df643:30613357 dbltrim-noruby:30604474 f6dab269:30613381 ```
eleanorjboyd commented 1 year ago

Hello! Could you please provide the remote-ssh logs? You can find them through selecting the tab output on your server side vscode window then select remote-ssh from the dropdown. The logs are most helpful when they are verbose so please include them in totality. Thanks!

misha-antonenko commented 1 year ago
[21:14:06.528] Log Level: 2
[21:14:06.538] remote-ssh@0.92.0
[21:14:06.539] darwin x64
[21:14:06.580] SSH Resolver called for "ssh-remote+jericho-d", attempt 1
[21:14:06.586] "remote.SSH.useLocalServer": true
[21:14:06.587] "remote.SSH.path": undefined
[21:14:06.587] "remote.SSH.configFile": undefined
[21:14:06.587] "remote.SSH.useFlock": true
[21:14:06.587] "remote.SSH.lockfilesInTmp": false
[21:14:06.590] "remote.SSH.localServerDownload": auto
[21:14:06.590] "remote.SSH.remoteServerListenOnSocket": false
[21:14:06.590] "remote.SSH.showLoginTerminal": false
[21:14:06.592] "remote.SSH.defaultExtensions": ["ms-vscode.cpptools","ms-python.python","bazelbuild.vscode-bazel"]
[21:14:06.592] "remote.SSH.loglevel": 2
[21:14:06.593] "remote.SSH.enableDynamicForwarding": true
[21:14:06.593] "remote.SSH.enableRemoteCommand": false
[21:14:06.593] "remote.SSH.serverPickPortsFromRange": {}
[21:14:06.593] "remote.SSH.serverInstallPath": {}
[21:14:06.627] SSH Resolver called for host: jericho-d
[21:14:06.627] Setting up SSH remote "jericho-d"
[21:14:06.641] Acquiring local install lock: /var/folders/x_/tt76l0w924v66x226y10nvk5nbb8wt/T/vscode-remote-ssh-fe5e0f5a-install.lock
[21:14:06.646] Looking for existing server data file at /Users/an-to-nen-ko/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-fe5e0f5a-6261075646f055b99068d3688932416f2346dd3b-0.92.0/data.json
[21:14:06.648] Using commit id "6261075646f055b99068d3688932416f2346dd3b" and quality "stable" for server
[21:14:06.722] Install and start server if needed
[21:14:06.755] PATH: /opt/homebrew/Caskroom/miniconda/base/bin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/munki:/Users/an-to-nen-ko/.cargo/bin:/Users/an-to-nen-ko/Library/Application Support/JetBrains/Toolbox/scripts
[21:14:06.756] Checking ssh with "ssh -V"
[21:14:06.796] > OpenSSH_8.6p1, LibreSSL 3.3.6

[21:14:06.808] askpass server listening on /var/folders/x_/tt76l0w924v66x226y10nvk5nbb8wt/T/vscode-ssh-askpass-161145dbae644e9bf0e7e7175606f4a56638d5f0.sock
[21:14:06.810] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/x_/tt76l0w924v66x226y10nvk5nbb8wt/T/vscode-ssh-askpass-806e80510d0997d3b177176cf88ad894f3fdce4a.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","49933","-o","ConnectTimeout=15","jericho-d"],"serverDataFolderName":".vscode-server","dataFilePath":"/Users/an-to-nen-ko/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-fe5e0f5a-6261075646f055b99068d3688932416f2346dd3b-0.92.0/data.json"}
[21:14:06.812] Local server env: {"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.qQH5IeKLJv/Listeners","SHELL":"/bin/zsh","DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/an-to-nen-ko/.vscode/extensions/ms-vscode-remote.remote-ssh-0.92.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/Users/an-to-nen-ko/.vscode/extensions/ms-vscode-remote.remote-ssh-0.92.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/x_/tt76l0w924v66x226y10nvk5nbb8wt/T/vscode-ssh-askpass-161145dbae644e9bf0e7e7175606f4a56638d5f0.sock"}
[21:14:06.817] Spawned 39667
[21:14:07.335] Server delay-shutdown request failed: connect ENOENT /var/folders/x_/tt76l0w924v66x226y10nvk5nbb8wt/T/vscode-ssh-askpass-806e80510d0997d3b177176cf88ad894f3fdce4a.sock
[21:14:07.408] > local-server-1> Spawned ssh, pid=39673
[21:14:07.429] stderr> OpenSSH_8.6p1, LibreSSL 3.3.6
[21:14:07.460] stderr> OpenSSH_8.6p1, LibreSSL 3.3.6
[21:14:07.997] stderr> debug1: Server host key: ssh-ed25519 SHA256:j1mXbr7BaqePvj+Mz13k98NsnjZbYqK/mTWsGytWMZ4
[21:14:08.655] stderr> Authenticated to 2a02:6b8:c32:6::aea5 ([2a02:6b8:c32:6::aea5]:22).
[21:14:09.935] stderr> debug1: Server host key: ssh-ed25519 SHA256:xGEUghDoqViSHXecJ9ITXPM/47GJtqEptFDC3KJUXAY
[21:14:10.492] stderr> Authenticated to 2a02:6b8:c32:6::aea5 (via proxy).
[21:14:11.018] > Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 5.4.0-1088-aws x86_64)
> 
>  * Documentation:  https://help.ubuntu.com
>  * Management:     https://landscape.canonical.com
>  * Support:        https://ubuntu.com/advantage
> 
> This system has been minimized by removing packages and content that are
> not required on a system that users do not log into.
> 
> To restore this content, you can run the 'unminimize' command.
[21:14:11.272] > ready: f5b59a191509
[21:14:11.404] > Linux 5.4.0-1088-aws #96~18.04.1-Ubuntu SMP Mon Oct 17 02:57:48 UTC 2022
[21:14:11.405] Platform: linux
[21:14:11.535] > /bin/bash
[21:14:11.535] Shell: bash
[21:14:11.536] Creating bash subshell inside "bash"
[21:14:11.667] > bash version:  5.0.17(1)-release
[21:14:11.797] > bash version:  5.0.17(1)-release
> bash version:  5.0.17(1)-release
[21:14:11.927] > f5b59a191509: running
> Acquiring lock on /home/atm/.vscode-server/bin/6261075646f055b99068d3688932416f2346dd3b/vscode-remote-lock.atm.6261075646f055b99068d3688932416f2346dd3b
> Found existing installation at /home/atm/.vscode-server/bin/6261075646f055b99068d3688932416f2346dd3b...
> Checking /home/atm/.vscode-server/.6261075646f055b99068d3688932416f2346dd3b.log and /home/atm/.vscode-server/.6261075646f055b99068d3688932416f2346dd3b.pid for a running server
> Looking for server with pid: 1624655
> Found running server...
> Installing extensions...
[21:14:12.096] > Installing extensions...
[21:14:12.459] > Extension 'ms-vscode.cpptools' v1.12.4 is already installed. Use '--force' option to update to latest version or provide '@<version>' to install a specific version, for example: 'ms-vscode.cpptools@1.2.3'.
[21:14:12.492] > Extension 'ms-python.python' v2022.18.2 is already installed. Use '--force' option to update to latest version or provide '@<version>' to install a specific version, for example: 'ms-python.python@1.2.3'.
> Extension 'bazelbuild.vscode-bazel' v0.6.0 is already installed. Use '--force' option to update to latest version or provide '@<version>' to install a specific version, for example: 'bazelbuild.vscode-bazel@1.2.3'.
>  
> *
> * Visual Studio Code Server
> *
> * By using the software, you agree to
> * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
[21:14:12.591] > * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
> *
>  
> Checking server status on port 38093 with wget
> f5b59a191509: start
> SSH_AUTH_SOCK==/tmp/ssh-tq537qMmFX/agent.3036500==
> DISPLAY====
> webUiAccessToken====
> listeningOn==38093==
> osReleaseId==ubuntu==
> arch==x86_64==
> tmpDir==/tmp==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime==639==
> serverStartTime====
> connectionToken==111a1111-a1a1-1a11-a1a1-11aa11a1111a==
> f5b59a191509: end
[21:14:12.594] Received install output: 
SSH_AUTH_SOCK==/tmp/ssh-tq537qMmFX/agent.3036500==
DISPLAY====
webUiAccessToken====
listeningOn==38093==
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/tmp==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime==639==
serverStartTime====
connectionToken==111a1111-a1a1-1a11-a1a1-11aa11a1111a==

[21:14:12.594] Remote server is listening on 38093
[21:14:12.595] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":38093},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"/tmp/ssh-tq537qMmFX/agent.3036500","display":"","tmpDir":"/tmp","platform":"linux","connectionToken":"111a1111-a1a1-1a11-a1a1-11aa11a1111a"},"extInstallTime":639,"installUnpackCode":""}
[21:14:12.598] Persisting server connection details to /Users/an-to-nen-ko/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-fe5e0f5a-6261075646f055b99068d3688932416f2346dd3b-0.92.0/data.json
[21:14:12.609] Starting forwarding server. localPort 49935 -> socksPort 49933 -> remotePort 38093
[21:14:12.610] Forwarding server listening on 49935
[21:14:12.611] Waiting for ssh tunnel to be ready
[21:14:12.614] Tunneled 38093 to local port 49935
[21:14:12.614] Resolved "ssh-remote+jericho-d" to "::1:49935"
[21:14:12.616] Updating $SSH_AUTH_SOCK: ln -f -s "/tmp/ssh-tq537qMmFX/agent.3036500" "/tmp/vscode-ssh-auth-sock-620901220"
[21:14:12.617] Using cwd: vscode-remote://ssh-remote%2Bjericho-d/
[21:14:12.617] Remote extension host environment: {"SSH_AUTH_SOCK":"/tmp/vscode-ssh-auth-sock-620901220"}
[21:14:12.622] [Forwarding server 49935] Got connection 0
[21:14:12.643] ------

[21:14:13.040] [Forwarding server 49935] Got connection 1
[21:14:13.324] [Forwarding server 49935] Got connection 2
[21:14:22.100] "Update SSH_AUTH_SOCK" terminal command done
[21:14:22.100] "Update SSH_AUTH_SOCK" task produced unexpected output, it may have failed

The value of SSH_AUTH_SOCK in the terminal is /tmp/vscode-ssh-auth-sock-993807707, though, not /tmp/vscode-ssh-auth-sock-620901220 as above

misha-antonenko commented 1 year ago

Hello, can I be of any other assistance? I may suppose I am not the only one affected

Tyriar commented 1 year ago

/duplicate https://github.com/microsoft/vscode/issues/168202