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

VSCode Remote SSH still listens on a loopback localhost address even with "remote.localPortHost": "allInterfaces" #10734

Open
MareStare opened this issue Feb 26, 2025 · 0 comments
Assignees
Labels
ssh Issue in vscode-remote SSH

Comments

@MareStare
Copy link

MareStare commented Feb 26, 2025

Remote-SSH Log

Remote-SSH Log

[01:04:19.073] Log Level: 2
[01:04:19.085] VS Code version: 1.97.2
[01:04:19.086] Remote-SSH version: remote-ssh@0.117.1
[01:04:19.086] win32 x64
[01:04:19.089] SSH Resolver called for "ssh-remote+devbox", attempt 1
[01:04:19.091] remote.SSH.useLocalServer = true
[01:04:19.091] remote.SSH.useExecServer = true
[01:04:19.091] remote.SSH.bindHost = {}
[01:04:19.091] remote.SSH.path = undefined
[01:04:19.091] remote.SSH.configFile = undefined
[01:04:19.091] remote.SSH.useFlock = true
[01:04:19.091] remote.SSH.lockfilesInTmp = false
[01:04:19.091] remote.SSH.localServerDownload = auto
[01:04:19.092] remote.SSH.remoteServerListenOnSocket = false
[01:04:19.092] remote.SSH.defaultExtensions = []
[01:04:19.092] remote.SSH.defaultExtensionsIfInstalledLocally = []
[01:04:19.092] remote.SSH.loglevel = 2
[01:04:19.092] remote.SSH.enableDynamicForwarding = true
[01:04:19.092] remote.SSH.enableRemoteCommand = false
[01:04:19.092] remote.SSH.serverPickPortsFromRange = {}
[01:04:19.092] remote.SSH.serverInstallPath = {}
[01:04:19.092] remote.SSH.permitPtyAllocation = false
[01:04:19.093] remote.SSH.preferredLocalPortRange = undefined
[01:04:19.093] remote.SSH.useCurlAndWgetConfigurationFiles = false
[01:04:19.093] remote.SSH.experimental.chat = false
[01:04:19.094] remote.SSH.experimental.enhancedSessionLogs = false
[01:04:19.103] SSH Resolver called for host: devbox
[01:04:19.103] Setting up SSH remote "devbox"
[01:04:19.109] Acquiring local install lock: C:\Users\gerzo\AppData\Local\Temp\vscode-remote-ssh-c4ea1055-install.lock
[01:04:19.110] Looking for existing server data file at c:\Users\gerzo\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-ssh\vscode-ssh-host-c4ea1055-e54c774e0add60467559eb0d1e229c6452cf8447-0.117.1-es\data.json
[01:04:19.110] No existing data file
[01:04:19.111] Using commit id "e54c774e0add60467559eb0d1e229c6452cf8447" and quality "stable" for server
[01:04:19.111] Extensions to install: 
[01:04:19.114] Install and start server if needed
[01:04:19.116] Checking ssh with "C:\Python312\Scripts\ssh.exe -V"
[01:04:19.118] Got error from ssh: spawn C:\Python312\Scripts\ssh.exe ENOENT
[01:04:19.118] Checking ssh with "C:\Python312\ssh.exe -V"
[01:04:19.119] Got error from ssh: spawn C:\Python312\ssh.exe ENOENT
[01:04:19.119] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[01:04:19.120] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[01:04:19.120] Checking ssh with "C:\Windows\ssh.exe -V"
[01:04:19.121] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[01:04:19.121] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[01:04:19.122] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[01:04:19.122] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[01:04:19.123] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[01:04:19.123] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[01:04:19.124] Got error from ssh: spawn C:\Windows\System32\OpenSSH\ssh.exe ENOENT
[01:04:19.124] Checking ssh with "C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\ssh.exe -V"
[01:04:19.124] Got error from ssh: spawn C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\ssh.exe ENOENT
[01:04:19.125] Checking ssh with "C:\ProgramData\chocolatey\bin\ssh.exe -V"
[01:04:19.125] Got error from ssh: spawn C:\ProgramData\chocolatey\bin\ssh.exe ENOENT
[01:04:19.125] Checking ssh with "C:\Program Files\OpenSSH-Win64\ssh.exe -V"
[01:04:19.166] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2

[01:04:19.169] Checking ssh with "C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\ssh.exe -V"
[01:04:19.169] Got error from ssh: spawn C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\ssh.exe ENOENT
[01:04:19.169] Checking ssh with "C:\Program Files\dotnet\ssh.exe -V"
[01:04:19.170] Got error from ssh: spawn C:\Program Files\dotnet\ssh.exe ENOENT
[01:04:19.170] Checking ssh with "D:\apps\nodejs\ssh.exe -V"
[01:04:19.171] Got error from ssh: spawn D:\apps\nodejs\ssh.exe ENOENT
[01:04:19.171] Checking ssh with "C:\Program Files\Tailscale\ssh.exe -V"
[01:04:19.172] Got error from ssh: spawn C:\Program Files\Tailscale\ssh.exe ENOENT
[01:04:19.172] Checking ssh with "C:\Program Files\NVIDIA Corporation\NVIDIA app\NvDLISR\ssh.exe -V"
[01:04:19.172] Got error from ssh: spawn C:\Program Files\NVIDIA Corporation\NVIDIA app\NvDLISR\ssh.exe ENOENT
[01:04:19.173] Checking ssh with "C:\Users\gerzo\.cargo\bin\ssh.exe -V"
[01:04:19.173] Got error from ssh: spawn C:\Users\gerzo\.cargo\bin\ssh.exe ENOENT
[01:04:19.173] Checking ssh with "C:\Program Files\VideoLAN\VLC\ssh.exe -V"
[01:04:19.174] Got error from ssh: spawn C:\Program Files\VideoLAN\VLC\ssh.exe ENOENT
[01:04:19.174] Checking ssh with "C:\Users\gerzo\AppData\Local\Microsoft\WindowsApps\ssh.exe -V"
[01:04:19.175] Got error from ssh: spawn C:\Users\gerzo\AppData\Local\Microsoft\WindowsApps\ssh.exe ENOENT
[01:04:19.175] Checking ssh with "D:\apps\Microsoft VS Code\bin\ssh.exe -V"
[01:04:19.176] Got error from ssh: spawn D:\apps\Microsoft VS Code\bin\ssh.exe ENOENT
[01:04:19.176] Checking ssh with "D:\apps\bin\ssh.exe -V"
[01:04:19.176] Got error from ssh: spawn D:\apps\bin\ssh.exe ENOENT
[01:04:19.177] Checking ssh with "D:\apps\LLVM\bin\ssh.exe -V"
[01:04:19.177] Got error from ssh: spawn D:\apps\LLVM\bin\ssh.exe ENOENT
[01:04:19.177] Checking ssh with "C:\Users\gerzo\.dotnet\tools\ssh.exe -V"
[01:04:19.178] Got error from ssh: spawn C:\Users\gerzo\.dotnet\tools\ssh.exe ENOENT
[01:04:19.178] Checking ssh with "C:\Users\gerzo\AppData\Roaming\npm\ssh.exe -V"
[01:04:19.179] Got error from ssh: spawn C:\Users\gerzo\AppData\Roaming\npm\ssh.exe ENOENT
[01:04:19.179] Checking ssh with "D:\apps\RustRover 2024.1.8\bin\ssh.exe -V"
[01:04:19.180] Got error from ssh: spawn D:\apps\RustRover 2024.1.8\bin\ssh.exe ENOENT
[01:04:19.180] Checking ssh with "D:\apps\Git\cmd\ssh.exe -V"
[01:04:19.181] Got error from ssh: spawn D:\apps\Git\cmd\ssh.exe ENOENT
[01:04:19.181] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[01:04:19.182] Got error from ssh: spawn C:\Windows\System32\OpenSSH\ssh.exe ENOENT
[01:04:19.182] Checking ssh with "C:\Program Files\Git\usr\bin\ssh.exe -V"
[01:04:19.183] Got error from ssh: spawn C:\Program Files\Git\usr\bin\ssh.exe ENOENT
[01:04:19.183] Checking ssh with "C:\Program Files (x86)\Git\usr\bin\ssh.exe -V"
[01:04:19.184] Got error from ssh: spawn C:\Program Files (x86)\Git\usr\bin\ssh.exe ENOENT
[01:04:19.184] Checking ssh with "C:\Users\gerzo\AppData\Local\Programs\Git\usr\bin\ssh.exe -V"
[01:04:19.185] Got error from ssh: spawn C:\Users\gerzo\AppData\Local\Programs\Git\usr\bin\ssh.exe ENOENT
[01:04:19.185] Checking ssh with "C:\Python312\Scripts\ssh.exe -V"
[01:04:19.186] Got error from ssh: spawn C:\Python312\Scripts\ssh.exe ENOENT
[01:04:19.186] Checking ssh with "C:\Python312\ssh.exe -V"
[01:04:19.187] Got error from ssh: spawn C:\Python312\ssh.exe ENOENT
[01:04:19.187] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[01:04:19.188] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[01:04:19.188] Checking ssh with "C:\Windows\ssh.exe -V"
[01:04:19.189] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[01:04:19.189] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[01:04:19.190] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[01:04:19.190] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[01:04:19.191] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[01:04:19.191] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[01:04:19.192] Got error from ssh: spawn C:\Windows\System32\OpenSSH\ssh.exe ENOENT
[01:04:19.192] Checking ssh with "C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\ssh.exe -V"
[01:04:19.193] Got error from ssh: spawn C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\ssh.exe ENOENT
[01:04:19.193] Checking ssh with "C:\ProgramData\chocolatey\bin\ssh.exe -V"
[01:04:19.194] Got error from ssh: spawn C:\ProgramData\chocolatey\bin\ssh.exe ENOENT
[01:04:19.194] Checking ssh with "C:\Program Files\OpenSSH-Win64\ssh.exe -V"
[01:04:19.244] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2

[01:04:19.249] Using SSH config file "C:\Users\gerzo\.ssh\config"
[01:04:19.249] askpass server listening on \\.\pipe\vscode-ssh-askpass-a81d29b1de0dfae67903ef85c92796b3a84732e0-sock
[01:04:19.250] Spawning local server with {"serverId":1,"ipcHandlePath":"\\\\.\\pipe\\vscode-ssh-askpass-622fd1a430db2a835c7088093175a999590a9520-sock","sshCommand":"C:\\Program Files\\OpenSSH-Win64\\ssh.exe","sshArgs":["-v","-T","-D","51221","-F","C:\\Users\\gerzo\\.ssh\\config","devbox","bash"],"serverDataFolderName":".vscode-server","dataFilePath":"c:\\Users\\gerzo\\AppData\\Roaming\\Code\\User\\globalStorage\\ms-vscode-remote.remote-ssh\\vscode-ssh-host-c4ea1055-e54c774e0add60467559eb0d1e229c6452cf8447-0.117.1-es\\data.json"}
[01:04:19.250] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"c:\\Users\\gerzo\\.vscode\\extensions\\ms-vscode-remote.remote-ssh-0.117.1\\out\\local-server\\askpass.bat","VSCODE_SSH_ASKPASS_NODE":"D:\\apps\\Microsoft VS Code\\Code.exe","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"","VSCODE_SSH_ASKPASS_MAIN":"c:\\Users\\gerzo\\.vscode\\extensions\\ms-vscode-remote.remote-ssh-0.117.1\\out\\askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"\\\\.\\pipe\\vscode-ssh-askpass-a81d29b1de0dfae67903ef85c92796b3a84732e0-sock"}
[01:04:19.260] Spawned 22232
[01:04:19.261] Using connect timeout of 17 seconds
[01:04:19.334] > local-server-1> Running ssh connection command: C:\Program Files\OpenSSH-Win64\ssh.exe -v -T -D 51221 -F C:\Users\gerzo\.ssh\config devbox bash
[01:04:19.341] > local-server-1> Spawned ssh, pid=29628
[01:04:19.396] stderr> OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
[01:04:19.605] stderr> debug1: Server host key: ssh-ed25519 SHA256:fs85wcIBbK7nrrpq7c+LwGG4lfB0voSDfjubZlYPOSw
[01:04:19.910] stderr> Authenticated to {REDACTED_IP} ([{REDACTED_IP}]:22) using "publickey".
[01:04:20.140] > ready: 9c44dc3e0305
[01:04:20.185] > Linux 5.15.0-117-generic #127-Ubuntu SMP Fri Jul 5 20:13:28 UTC 2024
[01:04:20.185] Platform: linux
[01:04:20.228] > /usr/bin/zsh
[01:04:20.228] Parent Shell: zsh
[01:04:20.228] Parent Shell pid: 22232
[01:04:20.228] Waiting for subshell to start
[01:04:20.273] > 750231
[01:04:20.273] stdout -> '750231'
[01:04:20.273] sub-process detected
[01:04:20.342] > 9c44dc3e0305: running
> Script executing under PID: 750231
[01:04:20.352] > Found existing installation at /home/veetaha/.vscode-server...
> Starting VS Code CLI...
[01:04:20.353] > Removing old logfile at /home/veetaha/.vscode-server/.cli.e54c774e0add60467559eb0d1e229c6452cf8447.log
[01:04:20.356] > Spawned remote CLI: 750249
[01:04:20.359] > Waiting for server log...
[01:04:20.393] > Waiting for server log...
[01:04:20.430] > 9c44dc3e0305: start
> listeningOn==127.0.0.1:41583==
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
[01:04:20.430] > tmpDir==/run/user/1000==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> serverStartTime==76==
> execServerToken==11a1aaa1-11aa-11a1-a11a-aa111a1a1111==
> platformDownloadPath==cli-alpine-x64==
> SSH_AUTH_SOCK==/tmp/ssh-XXXXuAasho/agent.750228==
> DISPLAY====
> 9c44dc3e0305: end
[01:04:20.431] Received install output: 
listeningOn==127.0.0.1:41583==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==76==
execServerToken==11a1aaa1-11aa-11a1-a11a-aa111a1a1111==
platformDownloadPath==cli-alpine-x64==
SSH_AUTH_SOCK==/tmp/ssh-XXXXuAasho/agent.750228==
DISPLAY====

[01:04:20.431] Remote server is listening on port 41583
[01:04:20.431] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":41583},"osReleaseId":"ubuntu","arch":"x86_64","sshAuthSock":"/tmp/ssh-XXXXuAasho/agent.750228","display":"","tmpDir":"/run/user/1000","platform":"linux","execServerToken":"11a1aaa1-11aa-11a1-a11a-aa111a1a1111"},"serverStartTime":76,"installUnpackCode":""}
[01:04:20.431] Persisting server connection details to c:\Users\gerzo\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-ssh\vscode-ssh-host-c4ea1055-e54c774e0add60467559eb0d1e229c6452cf8447-0.117.1-es\data.json
[01:04:20.434] Starting forwarding server. local port 51224 -> socksPort 51221 -> remotePort 41583
[01:04:20.435] Forwarding server listening on port 51224
[01:04:20.435] Waiting for ssh tunnel to be ready
[01:04:20.436] [Forwarding server port 51224] Got connection 0
[01:04:20.436] Tunneled port 41583 to local port 51224
[01:04:20.437] Resolved "ssh-remote+devbox" to "port 51224"
[01:04:20.441] Initizing new exec server for ssh-remote+devbox
[01:04:20.441] Resolving exec server at port 51224
[01:04:20.442] [Forwarding server port 51224] Got connection 1
[01:04:20.576] Exec server for ssh-remote+devbox created and cached
[01:04:20.576] Extensions to install: 
[01:04:20.576] Updating $SSH_AUTH_SOCK: ln -f -s "/tmp/ssh-XXXXuAasho/agent.750228" "/run/user/1000/vscode-ssh-auth-sock-737558097"
[01:04:20.577] Using cwd: vscode-remote://ssh-remote%2Bdevbox/
[01:04:20.577] Remote extension host environment: {"SSH_AUTH_SOCK":"/run/user/1000/vscode-ssh-auth-sock-737558097"}
[01:04:20.580] ------




[01:04:20.581] No hints found in the recent session.
[01:04:20.720] [server] Checking /home/veetaha/.vscode-server/cli/servers/Stable-e54c774e0add60467559eb0d1e229c6452cf8447/log.txt and /home/veetaha/.vscode-server/cli/servers/Stable-e54c774e0add60467559eb0d1e229c6452cf8447/pid.txt for a running server...
[01:04:20.738] [server] Found running server (pid=51419)
[01:04:23.787] "Update SSH_AUTH_SOCK" terminal command done
[01:04:24.100] Opening exec server for ssh-remote+devbox
[01:04:24.187] Verified and reusing cached exec server for ssh-remote+devbox
[01:04:24.188] No hints found in the recent session.
[01:04:24.237] Opening exec server for ssh-remote+devbox
[01:04:24.284] Verified and reusing cached exec server for ssh-remote+devbox
[01:04:24.284] No hints found in the recent session.

Expected Behavior

I expect that with "remote.localPortHost": "allInterfaces" there would be a process listening on 0.0.0.0 (or "IPv4 unspecified" in Windows terminology) on the configured port on my machine.

Actual Behavior

Code.exe is listening on loopback, thus I can't access the forwarded port through my private IP address from my local wifi network. This is what I see in Resource Monitor:

Image

Steps To Reproduce

  1. Connect to a remote host via VSCode Remote SSH.
  2. Configure "remote.localPortHost": "allInterfaces" in User settings.json both locally and on the remote host (I don't know where exactly it should be configured, so I configured both):
    Local: Image
    Remote:
    Image
  3. Run a sample web server on port 8080, for example.
  4. Forward the port 8080 if it's not auto-forwarded yet: Image
  5. Disable the Windows Firewall or configure a rule that allows inbound traffic on port 8080: Image
  6. Check that the browser can open a web page from the web server on http://localhost:8080
  7. Find your PC's private IP either via ipconfig or in your local WiFi web console. Mine, for example is 192.168.1.224.
  8. Check that the browser can open a web page from the web server on http://{your_pc_private_ip}:8080 🔥
  9. In my case step 8 doesn't work, connection times out, so go to the windows Resource Monitor and check the "Address" that Code.exe is listening on for port 8080 (see screenshot in "Actual Behavior"). It will say "IPv4 loopback", which is the core problem. It should say "IPv4 unspecified" since we configured "remote.localPortHost": "allInterfaces"

Anything else?

Everything works fine in my setup if I just forward the port manually via the SSH command:

ssh -L 0.0.0.0:8080:localhost:8080 -N devbox -v

In this case, I can access my web server via my PC's private IP and this is what I see in Resource Monitor:

Image

@MareStare MareStare added the ssh Issue in vscode-remote SSH label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

2 participants