VScode Failed to set up socket for dynamic port forward to remote port through VPN
Asked Answered
H

0

6

When I am directly connected to the network of the company I am working for, I can access my server through VScode and Remote-SSH without any issue, and without any special configuration. However, when working from home through a VPN, I cannot make it work.

I had issues connecting to ssh through VPN just using a console, but I fixed it as stated in this post.

But trying to set the same configuration within VScode did not solve my issues:

Host Server1
  HostName ip_adress
  HostKeyAlgorithms +ssh-rsa
  PubkeyAcceptedKeyTypes +ssh-rsa
  User user

I tried to remove the /.vscode-server and to allow the port forwarding in the /etc/ssh/sshd_conf but it did not changed anything. Here is the output:

[14:22:58.514] Log Level: 2
[14:22:58.515] [email protected]
[14:22:58.515] win32 x64
[14:22:58.523] SSH Resolver called for "ssh-remote+7b22686f73744e616d65223a225254525432227d", attempt 1
[14:22:58.523] "remote.SSH.useLocalServer": false
[14:22:58.523] "remote.SSH.showLoginTerminal": false
[14:22:58.523] "remote.SSH.remotePlatform": {"10.61.46.222":"linux","10.61.44.114":"linux","TRT2":"linux","TRT1":"linux","smartag":"linux"}
[14:22:58.524] "remote.SSH.path": undefined
[14:22:58.524] "remote.SSH.configFile": undefined
[14:22:58.524] "remote.SSH.useFlock": true
[14:22:58.524] "remote.SSH.lockfilesInTmp": false
[14:22:58.524] "remote.SSH.localServerDownload": auto
[14:22:58.524] "remote.SSH.remoteServerListenOnSocket": false
[14:22:58.524] "remote.SSH.showLoginTerminal": false
[14:22:58.524] "remote.SSH.defaultExtensions": []
[14:22:58.524] "remote.SSH.loglevel": 2
[14:22:58.524] "remote.SSH.enableDynamicForwarding": true
[14:22:58.524] "remote.SSH.enableRemoteCommand": false
[14:22:58.525] "remote.SSH.serverPickPortsFromRange": {}
[14:22:58.525] "remote.SSH.serverInstallPath": {}
[14:22:58.534] SSH Resolver called for host: RTRT2
[14:22:58.534] Setting up SSH remote "RTRT2"
[14:22:58.539] Using commit id "b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a" and quality "stable" for server
[14:22:58.543] Install and start server if needed
[14:24:21.844] Checking ssh with "ssh -V"
[14:24:21.933] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[14:24:21.937] Running script with connection command: ssh -T -D 49329 "RTRT2" bash
[14:24:21.941] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[14:24:22.226] > ]0;C:\WINDOWS\System32\cmd.exe
[14:24:22.226] Got some output, clearing connection timeout
[14:24:23.078] > Warning: Permanently added the RSA host key for IP address '10.61.44.114' to the
>  list of known hosts.
[14:24:23.209] > bosch-user@sys-7049gp-trt2's password: 
[14:24:23.210] Showing password prompt
[14:24:34.430] Got password response
[14:24:34.431] "install" wrote data to terminal: "********"
[14:24:34.447] > 
[14:24:34.777] > e72b32d4eca0: running
[14:24:34.825] > Acquiring lock on /home/bosch-user/.vscode-server/bin/b06ae3b2d2dbfe28bca3134cc6
> be65935cdfea6a/vscode-remote-lock.bosch-user.b06ae3b2d2dbfe28bca3134cc6be65935cd
> fea6a
[14:24:34.834] > Found existing installation at /home/bosch-user/.vscode-server/bin/b06ae3b2d2dbf
> e28bca3134cc6be65935cdfea6a...
> Checking /home/bosch-user/.vscode-server/.b06ae3b2d2dbfe28bca3134cc6be65935cdfea
> 6a.log and /home/bosch-user/.vscode-server/.b06ae3b2d2dbfe28bca3134cc6be65935cdf
> ea6a.pid for a running server
[14:24:34.846] > Looking for server with pid: 3230141
[14:24:34.874] > Found running server...
[14:24:34.896] > 
> *
> * Reminder: You may only use this software with Visual Studio family products, 
> * as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
> *
> 
> Checking server status on port 45161 with wget
> e72b32d4eca0: start     
> SSH_AUTH_SOCK====       
> DISPLAY====
> webUiAccessToken====    
> listeningOn==45161==    
> osReleaseId==ubuntu==   
> arch==x86_64==
> tmpDir==/run/user/1000==
> platform==linux==       
> unpackResult====
[14:24:34.901] > 
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime====
> connectionToken==111111a1-1aa1-11a1-1111-11a11a111a11==
> e72b32d4eca0: end
[14:24:34.902] Received install output:      
SSH_AUTH_SOCK====       
DISPLAY====
webUiAccessToken====    
listeningOn==45161==    
osReleaseId==ubuntu==   
arch==x86_64==
tmpDir==/run/user/1000==
platform==linux==       
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==111111a1-1aa1-11a1-1111-11a11a111a11==

[14:24:34.902] Remote server is listening on 45161
[14:24:34.903] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":45161},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","connectionToken":"111111a1-1aa1-11a1-1111-11a11a111a11"},"installUnpackCode":""}
[14:24:34.905] Starting forwarding server. localPort 49339 -> socksPort 49329 -> remotePort 45161
[14:24:34.905] Forwarding server listening on 49339
[14:24:34.906] Waiting for ssh tunnel to be ready
[14:24:34.906] Tunneled 45161 to local port 49339
[14:24:34.907] Resolved "ssh-remote+7b22686f73744e616d65223a225254525432227d" to "127.0.0.1:49339"
[14:24:34.907] [Forwarding server 49339] Got connection 0
[14:24:34.908] > 
[14:24:34.915] ------




[14:24:34.926] [Forwarding server 49339] Got connection 1
[14:24:34.946] Failed to set up socket for dynamic port forward to remote port 45161: Socket closed. Is the remote port correct?
[14:24:34.954] > channel 3: open failed: unknown channel type: unknown channel type
[14:24:34.958] Failed to set up socket for dynamic port forward to remote port 45161: Socket closed. Is the remote port correct?
[14:24:34.966] > channel 4: open failed: unknown channel type: unknown channel type
[14:24:34.975] > 
Hitt answered 30/9, 2022 at 12:30 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.