microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.61k stars 275 forks source link

Can't ssh to a Linux server behind an entry server (ssh redirecting) #6105

Closed hsinyinfu closed 1 year ago

hsinyinfu commented 2 years ago

Steps to Reproduce:

In our company environment, IT provides an entry remote Linux terminal server for automatically directing users to the real destination Linux terminal server for he/her to use. The users' home directory are all mounted with NFS, so no matter what server a user is redirected to, he/she can always see the same user home directory. However, under this scenario, remote-ssh can't connect to the destination server.

For example, the hostname of the entry server is "testing_00", when I ssh to the server, it would prompt me to enter the password, after login successfully, I would be redirect to another server linux235. Behind the scene, IT said when a user ssh to the entry server, a shell script would be sourced automatically, in that there is only another "ssh " command to redirect the user to the destination host based on some mapping rules between employee ID and destination server hostname.

I have tried with both pre-release version v0.71.2021121615 and release version v0.70.0.

Does this issue occur when you try this locally?: Yes Does this issue occur when you try this locally and all extensions are disabled?: Yes

Logs:

[14:26:36.173] Log Level: 1
[14:26:36.180] remote-ssh@0.71.2021121615
[14:26:36.180] win32 x64
[14:26:36.181] SSH Resolver called for "ssh-remote+testing_00", attempt 1
[14:26:36.181] "remote.SSH.useLocalServer": false
[14:26:36.181] "remote.SSH.showLoginTerminal": false
[14:26:36.183] "remote.SSH.remotePlatform": {"Common_TS":"linux"}
[14:26:36.183] "remote.SSH.path": undefined
[14:26:36.184] "remote.SSH.configFile": undefined
[14:26:36.184] "remote.SSH.useFlock": true
[14:26:36.184] "remote.SSH.lockfilesInTmp": false
[14:26:36.184] "remote.SSH.localServerDownload": auto
[14:26:36.184] "remote.SSH.remoteServerListenOnSocket": false
[14:26:36.184] "remote.SSH.showLoginTerminal": false
[14:26:36.185] "remote.SSH.defaultExtensions": []
[14:26:36.185] "remote.SSH.loglevel": 1
[14:26:36.185] "remote.SSH.enableDynamicForwarding": true
[14:26:36.185] "remote.SSH.enableRemoteCommand": false
[14:26:36.185] "remote.SSH.serverPickPortsFromRange": {}
[14:26:36.186] "remote.SSH.serverInstallPath": {}
[14:26:36.186] SSH Resolver called for host: testing_00
[14:26:36.187] Setting up SSH remote "testing_00"
[14:26:36.206] Using commit id "899d46d82c4c95423fb7e10e68eba52050e30ba3" and quality "stable" for server
[14:26:36.209] Install and start server if needed
[14:26:43.409] Checking ssh with "ssh -V"
[14:26:43.489] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[14:26:43.501] Running script with connection command: ssh -T -D 64432 "testing_00" bash
[14:26:43.504] Terminal shell path: C:\windows\System32\cmd.exe
[14:26:43.815] "install" terminal received data: "]0;C:\windows\System32\cmd.exe[?25h"
[14:26:43.815] Got some output, clearing connection timeout
[14:26:44.701] "install" terminal received data: "Redirect to linux235 ..."
[14:26:44.740] "install" terminal received data: "Pseudo-terminal will not be allocated because stdin is not a terminal."
[14:26:45.227] "install" terminal received data: "DISPLAY "(null)" invalid; disabling X11 forwarding
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 4.4.0-148-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

Your Hardware Enablement Stack (HWE) is supported until April 2019.
################################################################################
##########
###
       ###
###                               ***  [IT News]  ***
       ###
###
       ###
################################################################################
##########
f5f47d666aac: running"
[14:26:45.240] "install" terminal received data: ""
[14:26:45.376] "install" terminal received data: "Acquiring lock on /proj/user23649/.vscode-server/bin/899d46d82c4c95423fb7e10e68eb
a52050e30ba3/vscode-remote-lock.user23649.899d46d82c4c95423fb7e10e68eba52050e30ba
3"
[14:26:45.382] "install" terminal received data: "Found old VS Code install b3318bc0524af3d74034b8bb8a64df0ccf35549a, attempting to clean up
Failed to acquire lock for install, not deleting: b3318bc0524af3d74034b8bb8a64df0ccf35549a
Found existing installation at /proj/user23649/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3...
Checking /proj/user23649/.vscode-server/.899d46d82c4c95423fb7e10e68eba52050e30ba3.log and /proj/user23649/.vscode-server/.899d46d82c4c95423fb7e10e68eba52050e30ba3.pid for a running server"
[14:26:45.389] "install" terminal received data: "
Looking for server with pid: 15698"
[14:26:45.483] "install" terminal received data: "Found running server...

*
* Reminder: You may only use this software with Visual Studio family products,  [?25h
* as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057) 
*
"
[14:26:45.493] "install" terminal received data: "
Checking server status on port 44161 with wget"
[14:26:45.501] "install" terminal received data: "
f5f47d666aac: start
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==44161==
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/tmp==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==a1111a1a-1111-1111-1111-a1a11111111a==
f5f47d666aac: end"
[14:26:45.501] Received install output: 
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==44161==
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/tmp==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==a1111a1a-1111-1111-1111-a1a11111111a==

[14:26:45.502] Remote server is listening on 44161
[14:26:45.502] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":44161},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/tmp","platform":"linux","connectionToken":"a1111a1a-1111-1111-1111-a1a11111111a"},"installUnpackCode":""}
[14:26:45.505] Starting forwarding server. localPort 64437 -> socksPort 64432 -> remotePort 44161
[14:26:45.506] Forwarding server listening on 64437
[14:26:45.506] Waiting for ssh tunnel to be ready
[14:26:45.507] Tunneled 44161 to local port 64437
[14:26:45.507] Resolved "ssh-remote+testing_00" to "127.0.0.1:64437"
[14:26:45.508] Updating terminal environments: {}
[14:26:45.508] [Forwarding server 64437] Got connection 0
[14:26:45.513] TELEMETRY: {"eventName":"resolver","properties":{"osReleaseId":"ubuntu","arch":"x86_64","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"0","remoteInConfigFile":"1","gotUnrecognizedPrompt":"0","dynamicForwarding":"1","localServer":"0","didLocalDownload":"0","installUnpackCode":"0","outcome":"success"},"measures":{"resolveAttempts":1,"retries":1,"timing.totalResolveTime":9331,"timing.preSshTime":7322,"timing.establishSshTime":1729,"timing.scriptTime":1998}}
[14:26:45.515] ------

[14:26:45.516] Failed to set up socket for dynamic port forward to remote port 44161: Socket closed. Is the remote port correct?
[14:26:45.524] [Forwarding server 64437] Got connection 1
[14:26:45.526] Failed to set up socket for dynamic port forward to remote port 44161: Socket closed. Is the remote port correct?
[14:26:45.532] "install" terminal received data: "channel 3: open failed: connect failed: Connection refused"
[14:26:45.538] "install" terminal received data: "channel 3: open failed: connect failed: Connection refused
"
tanhakabir commented 2 years ago

Hm are you able to connect with remote.SSH.enableDynamicForwarding set to false?

hsinyinfu commented 2 years ago

Hi, I tried to disable the remote.SSH.enableDynamicForwarding, it still not worked. Here is the log after the setting was disabled:

[17:28:12.904] Log Level: 1
[17:28:12.912] remote-ssh@0.71.2021121615
[17:28:12.912] win32 x64
[17:28:12.913] SSH Resolver called for "ssh-remote+testing_00", attempt 1
[17:28:12.913] "remote.SSH.useLocalServer": false
[17:28:12.914] "remote.SSH.showLoginTerminal": false
[17:28:12.914] "remote.SSH.remotePlatform": {"Common_TS":"linux"}
[17:28:12.914] "remote.SSH.path": undefined
[17:28:12.914] "remote.SSH.configFile": undefined
[17:28:12.914] "remote.SSH.useFlock": true
[17:28:12.915] "remote.SSH.lockfilesInTmp": false
[17:28:12.915] "remote.SSH.localServerDownload": auto
[17:28:12.915] "remote.SSH.remoteServerListenOnSocket": false
[17:28:12.915] "remote.SSH.showLoginTerminal": false
[17:28:12.915] "remote.SSH.defaultExtensions": []
[17:28:12.915] "remote.SSH.loglevel": 1
[17:28:12.916] "remote.SSH.enableDynamicForwarding": false
[17:28:12.916] "remote.SSH.enableRemoteCommand": false
[17:28:12.916] "remote.SSH.serverPickPortsFromRange": {}
[17:28:12.916] "remote.SSH.serverInstallPath": {}
[17:28:12.917] SSH Resolver called for host: testing_00
[17:28:12.917] Setting up SSH remote "testing_00"
[17:28:12.938] Using commit id "899d46d82c4c95423fb7e10e68eba52050e30ba3" and quality "stable" for server
[17:28:12.940] Install and start server if needed
[17:28:22.111] Checking ssh with "ssh -V"
[17:28:22.228] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[17:28:22.237] Running script with connection command: ssh -T -o ClearAllForwardings=true "testing_00" bash
[17:28:22.241] Terminal shell path: C:\windows\System32\cmd.exe
[17:28:22.641] "install" terminal received data: "]0;C:\windows\System32\cmd.exe
[17:28:22.642] Got some output, clearing connection timeout
[17:28:22.756] "install" terminal received data: "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
[17:28:22.764] "install" terminal received data: "@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for mtkslt00 has changed,
and the key for the corresponding IP address 10.21.14.14   
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host   
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @"
[17:28:22.777] "install" terminal received data: "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!     
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:kCCjnaNZLO5btWyfTNBJD4mvjL0LbjOibXIWNIiGHa0.
Please contact your system administrator.
Add correct host key in C:\\Users\\mtk23649.DOMAIN_MTK/.ssh/known_hosts to get r
id of this message.
Offending ECDSA key in C:\\Users\\mtk23649.DOMAIN_MTK/.ssh/known_hosts:8        
ECDSA host key for mtkslt00 has changed and you have requested strict checking. 
Host key verification failed.
The process tried to write to a nonexistent pipe
[17:28:24.766] "install" terminal command done
[17:28:24.767] Install terminal quit with output: The process tried to write to a nonexistent pipe
[17:28:24.767] Received install output: The process tried to write to a nonexistent pipe
[17:28:24.767] Stopped parsing output early. Remaining text: The process tried to write to a nonexistent pipe
[17:28:24.768] Failed to parse remote port from server output
[17:28:24.768] Resolver error: Error: 
    at Function.Create (c:\Users\mtk23649.DOMAIN_MTK\.vscode\extensions\ms-vscode-remote.remote-ssh-0.71.2021121615\out\extension.js:1:431103)
    at Object.t.handleInstallOutput (c:\Users\mtk23649.DOMAIN_MTK\.vscode\extensions\ms-vscode-remote.remote-ssh-0.71.2021121615\out\extension.js:1:429755)
    at Object.t.tryInstall (c:\Users\mtk23649.DOMAIN_MTK\.vscode\extensions\ms-vscode-remote.remote-ssh-0.71.2021121615\out\extension.js:1:524958)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async c:\Users\mtk23649.DOMAIN_MTK\.vscode\extensions\ms-vscode-remote.remote-ssh-0.71.2021121615\out\extension.js:1:487817
    at async Object.t.withShowDetailsEvent (c:\Users\mtk23649.DOMAIN_MTK\.vscode\extensions\ms-vscode-remote.remote-ssh-0.71.2021121615\out\extension.js:1:491162)
    at async Object.t.resolve (c:\Users\mtk23649.DOMAIN_MTK\.vscode\extensions\ms-vscode-remote.remote-ssh-0.71.2021121615\out\extension.js:1:488896)
    at async c:\Users\mtk23649.DOMAIN_MTK\.vscode\extensions\ms-vscode-remote.remote-ssh-0.71.2021121615\out\extension.js:1:565038
[17:28:24.771] TELEMETRY: {"eventName":"resolver","properties":{"osReleaseId":"","arch":"","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"0","remoteInConfigFile":"1","gotUnrecognizedPrompt":"0","dynamicForwarding":"0","localServer":"0","didLocalDownload":"0","installUnpackCode":"0","outcome":"failure","reason":"UnparsableOutput","exitCodeLabel":""},"measures":{"resolveAttempts":1,"retries":1,"timing.totalResolveTime":11855,"timing.preSshTime":9327,"timing.scriptTime":2527}}
[17:28:24.773] ------
tanhakabir commented 2 years ago

There seems to be an issue here:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@�[K
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!�[K
Someone could be eavesdropping on you right now (man-in-the-middle attack)!     
It is also possible that a host key has just been changed.�[K
The fingerprint for the ECDSA key sent by the remote host is�[K
SHA256:kCCjnaNZLO5btWyfTNBJD4mvjL0LbjOibXIWNIiGHa0.�[K
Please contact your system administrator.�[K
Add correct host key in C:\\Users\\mtk23649.DOMAIN_MTK/.ssh/known_hosts to get r
id of this message.�[K
Offending ECDSA key in C:\\Users\\mtk23649.DOMAIN_MTK/.ssh/known_hosts:8        
ECDSA host key for mtkslt00 has changed and you have requested strict checking. 
Host key verification failed.

You could edit your known_hosts file to remove any duplicates or inaccurate information.

More information here as well: https://stackoverflow.com/questions/19018385/host-key-verification-failed

hsinyinfu commented 2 years ago

Hi, I just deleted the offending ECDSA key entry in the known_hosts file and connected the remote server again, but it still failed. Here is the log this time:

[17:57:16.730] Log Level: 1
[17:57:16.737] remote-ssh@0.71.2021121615
[17:57:16.737] win32 x64
[17:57:16.738] SSH Resolver called for "ssh-remote+testing_00", attempt 1
[17:57:16.739] "remote.SSH.useLocalServer": false
[17:57:16.739] "remote.SSH.showLoginTerminal": false
[17:57:16.739] "remote.SSH.remotePlatform": {"Common_TS":"linux"}
[17:57:16.740] "remote.SSH.path": undefined
[17:57:16.740] "remote.SSH.configFile": undefined
[17:57:16.741] "remote.SSH.useFlock": true
[17:57:16.742] "remote.SSH.lockfilesInTmp": false
[17:57:16.742] "remote.SSH.localServerDownload": auto
[17:57:16.742] "remote.SSH.remoteServerListenOnSocket": false
[17:57:16.742] "remote.SSH.showLoginTerminal": false
[17:57:16.742] "remote.SSH.defaultExtensions": []
[17:57:16.742] "remote.SSH.loglevel": 1
[17:57:16.743] "remote.SSH.enableDynamicForwarding": true
[17:57:16.743] "remote.SSH.enableRemoteCommand": false
[17:57:16.743] "remote.SSH.serverPickPortsFromRange": {}
[17:57:16.743] "remote.SSH.serverInstallPath": {}
[17:57:16.744] SSH Resolver called for host: testing_00
[17:57:16.744] Setting up SSH remote "testing_00"
[17:57:16.764] Using commit id "899d46d82c4c95423fb7e10e68eba52050e30ba3" and quality "stable" for server
[17:57:16.767] Install and start server if needed
[17:57:23.575] Checking ssh with "ssh -V"
[17:57:23.670] > OpenSSH_for_Windows_8.1p
[17:57:23.671] > 1, LibreSSL 3.0.2

[17:57:23.680] Running script with connection command: ssh -T -D 61879 "testing_00" bash
[17:57:23.683] Terminal shell path: C:\windows\System32\cmd.exe
[17:57:24.005] "install" terminal received data: "C:\windows\System32\cmd.exe
[17:57:24.006] Got some output, clearing connection timeout
[17:57:24.092] "install" terminal received data: "The authenticity of host 'mtkslt00 (10.21.14.14)' can't be established.     
ECDSA key fingerprint is SHA256:kCCjnaNZLO5btWyfTNBJD4mvjL0LbjOibXIWNIiGHa0.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
[17:57:24.093] Detected fingerprint confirmation message
[17:57:24.093] Showing fingerprint confirmation dialog
[17:57:28.625] Got fingerprint response: yes
[17:57:28.626] "install" wrote data to terminal: "yes"
[17:57:28.641] "install" terminal received data: "y"
[17:57:28.657] "install" terminal received data: "
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes        
Warning: Permanently added 'mtkslt00,10.21.14.14' (ECDSA) to the list of known hosts.
[17:57:37.111] "install" terminal received data: "Redirect to mtkslt209 ..."
[17:57:37.374] "install" terminal received data: "Pseudo-terminal will not be allocated because stdin is not a terminal."
[17:57:38.712] "install" terminal received data: "DISPLAY "(null)" invalid; disabling X11 forwarding
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 4.4.0-148-generic x86_64)
 * Documentation:  https://help.ubuntu.com/
Your Hardware Enablement Stack (HWE) is supported until April 2019.
###########################################################################################
       ######                               ***  [IT News]  ***
       ######
       ###### otice]
       ######  1.  DO NOT run build command on Terminal Server.
       ######      Please insert dockerqin front of your build command.
       ######      E.g. dockerq make
       ######  2.  Apply for SWRD Linux account, please fill out the IT Request Form first
       ######
       ######
##########################################################################################
952e98e12195: running"
[17:57:39.121] "install" terminal received data: "Acquiring lock on /proj/mtk23649/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/vscode-remote-lock.mtk23649.899d46d82c4c95423fb7e10e68eba52050e30ba3
Found old VS Code install 3a6960b964327f0e3882ce18fcebd07ed191b316, attempting to clean up
Deleting old install from /proj/mtk23649/.vscode-server/bin/3a6960b964327f0e3882ce18fcebd07ed191b316
Deleting old log file from /proj/mtk23649/.vscode-server/.3a6960b964327f0e3882ce18fcebd07ed191b316.log
Found old VS Code install a.out, attempting to clean up
rm: cannot remove ‘/proj/mtk23649/.vscode-server/bin/3a6960b964327f0e3882ce18fcebd07ed191b316’: Directory not empty
rm: cannot remove ‘/proj/mtk23649/.vscode-server/.3a6960b964327f0e3882ce18fcebd07ed191b316.log’: No such file or directory
-bash: line 243: /proj/mtk23649/.vscode-server/bin/a.out/vscode-remote-lock.mtk23649.a.out: Not a directory"
[17:57:39.136] "install" terminal received data: ""
[17:57:39.273] "install" terminal received data: "Install still has running processes, not deleting: a.out
Found old VS Code install message, attempting to clean up
-bash: line 243: /proj/mtk23649/.vscode-server/bin/message/vscode-remote-lock.mtk23649.message: Not a directory"
[17:57:39.293] "install" terminal received data: ""
[17:57:39.527] "install" terminal received data: "Install still has running processes, not deleting: message
Found existing installation at /proj/mtk23649/.vscode-server/bin/899d46d82c4c954
23fb7e10e68eba52050e30ba3...
Checking /proj/mtk23649/.vscode-server/.899d46d82c4c95423fb7e10e68eba52050e30ba3.log and /proj/mtk23649/.vscode-server/.899d46d82c4c95423fb7e10e68eba52050e30ba3.pid for a running server
Looking for server with pid: 30550"
[17:57:39.616] "install" terminal received data: "Found running server...
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057) 
*
[17:57:39.625] "install" terminal received data: "Checking server status on port 43193 with wget"
[17:57:39.666] "install" terminal received data: "952e98e12195: start
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==43193==
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/tmp==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==11aaa1a1-1a11-1aa1-1a11-1111111a11aa==
952e98e12195: end"
[17:57:39.666] Received install output: 
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==43193==
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/tmp==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==11aaa1a1-1a11-1aa1-1a11-1111111a11aa==

[17:57:39.667] Remote server is listening on 43193
[17:57:39.667] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":43193},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/tmp","platform":"linux","connectionToken":"11aaa1a1-1a11-1aa1-1a11-1111111a11aa"},"installUnpackCode":""}
[17:57:39.671] Starting forwarding server. localPort 58429 -> socksPort 61879 -> remotePort 43193
[17:57:39.671] Forwarding server listening on 58429
[17:57:39.671] Waiting for ssh tunnel to be ready
[17:57:39.672] Tunneled 43193 to local port 58429
[17:57:39.673] Resolved "ssh-remote+testing_00" to "127.0.0.1:58429"
[17:57:39.673] Updating terminal environments: {}
[17:57:39.673] [Forwarding server 58429] Got connection 0
[17:57:39.678] TELEMETRY: {"eventName":"resolver","properties":{"osReleaseId":"ubuntu","arch":"x86_64","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"1","remoteInConfigFile":"1","gotUnrecognizedPrompt":"0","dynamicForwarding":"1","localServer":"0","didLocalDownload":"0","installUnpackCode":"0","outcome":"success"},"measures":{"resolveAttempts":1,"retries":1,"timing.totalResolveTime":22939,"timing.preSshTime":6944,"timing.establishSshTime":15033,"timing.scriptTime":15984}}
[17:57:39.680] ------

[17:57:39.689] Failed to set up socket for dynamic port forward to remote port 43193: Socket closed. Is the remote port correct?
[17:57:39.693] [Forwarding server 58429] Got connection 1
[17:57:39.697] Failed to set up socket for dynamic port forward to remote port 43193: Socket closed. Is the remote port correct?
[17:57:39.703] "install" terminal received data: "channel 3: open failed: connect failed: Connection refused
"
[17:57:39.708] "install" terminal received data: "
channel 3: open failed: connect failed: Connection refused
"
[17:57:39.721] "install" terminal received data: ""
hsinyinfu commented 2 years ago

Also, it shows an error alert on the bottom right corner with the following information this time:

Failed to connect to the remote extension host server (Error: WebSocket close with status code 1006(
tanhakabir commented 2 years ago

Could you try again with remote.SSH.enableDynamicForwarding set to false?

hsinyinfu commented 2 years ago

It still failed. This time, There are two error alert showed up:

Could not fetch remote environment

and

Failed to connect to the remote extension host server (Error: WebSocket close with status code 1006)

Here is the log:

[18:30:29.077] Log Level: 1
[18:30:29.084] remote-ssh@0.71.2021121615
[18:30:29.084] win32 x64
[18:30:29.084] SSH Resolver called for "ssh-remote+testing_00", attempt 1
[18:30:29.085] "remote.SSH.useLocalServer": false
[18:30:29.085] "remote.SSH.showLoginTerminal": false
[18:30:29.086] "remote.SSH.remotePlatform": {"Common_TS":"linux"}
[18:30:29.086] "remote.SSH.path": undefined
[18:30:29.086] "remote.SSH.configFile": undefined
[18:30:29.086] "remote.SSH.useFlock": true
[18:30:29.086] "remote.SSH.lockfilesInTmp": false
[18:30:29.087] "remote.SSH.localServerDownload": auto
[18:30:29.087] "remote.SSH.remoteServerListenOnSocket": false
[18:30:29.087] "remote.SSH.showLoginTerminal": false
[18:30:29.087] "remote.SSH.defaultExtensions": []
[18:30:29.087] "remote.SSH.loglevel": 1
[18:30:29.087] "remote.SSH.enableDynamicForwarding": false
[18:30:29.088] "remote.SSH.enableRemoteCommand": false
[18:30:29.088] "remote.SSH.serverPickPortsFromRange": {}
[18:30:29.088] "remote.SSH.serverInstallPath": {}
[18:30:29.089] SSH Resolver called for host: testing_00
[18:30:29.089] Setting up SSH remote "testing_00"
[18:30:29.107] Using commit id "899d46d82c4c95423fb7e10e68eba52050e30ba3" and quality "stable" for server
[18:30:29.110] Install and start server if needed
[18:30:39.642] Checking ssh with "ssh -V"
[18:30:39.719] > OpenSSH_for_Windows_8.
[18:30:39.719] > 1p1, LibreSSL 3.0.2

[18:30:39.728] Running script with connection command: ssh -T -o ClearAllForwardings=true "testing_00" bash
[18:30:39.731] Terminal shell path: C:\windows\System32\cmd.exe
[18:30:40.059] "install" terminal received data: "]0;C:\windows\System32\cmd.exe
[18:30:40.060] Got some output, clearing connection timeout
[18:30:40.140] "install" terminal received data: "The authenticity of host 'mtkslt00 (10.21.15.19)' can't be established.     
ECDSA key fingerprint is SHA256:BIWm5883Eh510hFfpjADFhmXbChNZskGy4mDQ+Nf6nQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])?        
[18:30:40.141] Detected fingerprint confirmation message
[18:30:40.141] Showing fingerprint confirmation dialog
[18:30:41.946] Got fingerprint response: yes
[18:30:41.946] "install" wrote data to terminal: "yes"
[18:30:41.963] "install" terminal received data: "y"
[18:30:41.974] "install" terminal received data: "
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes        
Warning: Permanently added 'mtkslt00,10.21.15.19' (ECDSA) to the list of known hosts.
[18:30:42.735] "install" terminal received data: "Redirect to mtkslt209 ..."
[18:30:42.755] "install" terminal received data: "Pseudo-terminal will not be allocated because stdin is not a terminal."
[18:30:43.300] "install" terminal received data: "DISPLAY "(null)" invalid; disabling X11 forwarding
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 4.4.0-148-generic x86_64)
 * Documentation:  https://help.ubuntu.com/
Your Hardware Enablement Stack (HWE) is supported until April 2019.
###########################################################################################
       ######                               ***  [IT News]  ***
       ######
       ###### �[Notice]
       ######  1.  DO NOT run build command on Terminal Server.
       ######      Please insert dockerq�in front of your build command.
       ######      E.g. dockerq make
       ######  2.  Apply for SWRD Linux account, please fill out the IT Request Form first�
       ######�
       ######�
##########################################################################################
993834029ec3: running"
[18:30:43.314] "install" terminal received data: ""
[18:30:43.418] "install" terminal received data: "Acquiring lock on /proj/mtk23649/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/vscode-remote-lock.mtk23649.899d46d82c4c95423fb7e10e68eba52050e30ba3"
[18:30:43.433] "install" terminal received data: "Found old VS Code install ccbaa2d27e38e5afa3e5c21c1c7bef4657064247, attempting to clean up
Failed to acquire lock for install, not deleting: ccbaa2d27e38e5afa3e5c21c1c7bef4657064247
Found old VS Code install a.out, attempting to clean up
-bash: line 243: /proj/mtk23649/.vscode-server/bin/a.out/vscode-remote-lock.mtk2"
[18:30:43.439] "install" terminal received data: "3649.a.out: Not a directory
Failed to acquire lock for install, not deleting: a.out
Found old VS Code install message, attempting to clean up
-bash: line 243: /proj/mtk23649/.vscode-server/bin/message/vscode-remote-lock.mtk23649.message: Not a directory
Failed to acquire lock for install, not deleting: message
Found existing installation at /proj/mtk23649/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3..."
[18:30:43.445] "install" terminal received data: "Checking /proj/mtk23649/.vscode-server/.899d46d82c4c95423fb7e10e68eba52050e30ba3
.log and /proj/mtk23649/.vscode-server/.899d46d82c4c95423fb7e10e68eba52050e30ba3
.pid for a running server
Looking for server with pid: 30550"
[18:30:43.458] "install" terminal received data: ""
[18:30:43.607] "install" terminal received data: "Found running server...

*
* Reminder: You may only use this software with Visual Studio family products,  
* as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057) 
*
[18:30:43.623] "install" terminal received data: "Checking server status on port 43193 with wget"
[18:30:43.629] "install" terminal received data: "993834029ec3: start
DISPLAY====
webUiAccessToken====
listeningOn==43193==
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/tmp==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==11aaa1a1-1a11-1aa1-1a11-1111111a11aa==
993834029ec3: end"
[18:30:43.629] Received install output: 
DISPLAY====
webUiAccessToken====
listeningOn==43193==
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/tmp==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==11aaa1a1-1a11-1aa1-1a11-1111111a11aa==

[18:30:43.630] Remote server is listening on 43193
[18:30:43.630] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":43193},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","display":"","tmpDir":"/tmp","platform":"linux","connectionToken":"11aaa1a1-1a11-1aa1-1a11-1111111a11aa"},"installUnpackCode":""}
[18:30:43.636] Running script with connection command: ssh -T -L 127.0.0.1:49984:127.0.0.1:43193 "testing_00" bash
[18:30:43.638] Spawning tunnel with: type "C:\Users\MTK236~1.DOM\AppData\Local\Temp\vscode-linux-multi-line-command-testing_00-24962123.sh" | ssh -T -L 127.0.0.1:49984:127.0.0.1:43193 "testing_00" bash
[18:30:43.638] Terminal shell path: C:\windows\System32\cmd.exe
[18:30:43.640] "install" terminal received data: ""
[18:30:43.933] "SSH Tunnel" terminal received data: "]0;C:\windows\System32\cmd.exe[?25h"
[18:30:44.004] "SSH Tunnel" terminal received data: "The authenticity of host 'mtkslt00 (10.21.15.19)' can't be established.     
ECDSA key fingerprint is SHA256:BIWm5883Eh510hFfpjADFhmXbChNZskGy4mDQ+Nf6nQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])?        
[18:30:44.005] Detected fingerprint confirmation message
[18:30:44.005] Showing fingerprint confirmation dialog
[18:30:45.693] "install" terminal command done
[18:30:45.694] Install terminal quit with output: 
[18:30:46.113] Got fingerprint response: yes
[18:30:46.113] "SSH Tunnel" wrote data to terminal: "yes"
[18:30:46.126] "SSH Tunnel" terminal received data: "y"
[18:30:46.140] "SSH Tunnel" terminal received data: "
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes        
Warning: Permanently added 'mtkslt00,10.21.15.19' (ECDSA) to the list of known h
osts.
[18:30:46.818] "SSH Tunnel" terminal received data: "Redirect to mtkslt209 ..."
[18:30:46.842] "SSH Tunnel" terminal received data: "Pseudo-terminal will not be allocated because stdin is not a terminal."
[18:30:47.356] "SSH Tunnel" terminal received data: "DISPLAY "(null)" invalid; disabling X11 forwarding
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 4.4.0-148-generic x86_64)
 * Documentation:  https://help.ubuntu.com/
Your Hardware Enablement Stack (HWE) is supported until April 2019.
###########################################################################################
       ######                               ***  [IT News]  ***
       ######
       ###### �[Notice]
       ######  1.  DO NOT run build command on Terminal Server.
       ######      Please insert dockerq�in front of your build command.
       ######      E.g. dockerq make
       ######  2.  Apply for SWRD Linux account, please fill out the IT Request Form first�
       ######�
       ######�
##########################################################################################
SSH_AUTH_SOCK=
Connected to SSH Host - Please do not close this terminal"
[18:30:47.363] Spawned SSH tunnel between local port 49984 and remote target 43193
[18:30:47.363] Waiting for ssh tunnel to be ready
[18:30:47.364] Tunneled 43193 to local port 49984
[18:30:47.364] Resolved "ssh-remote+testing_00" to "127.0.0.1:49984"
[18:30:47.365] Updating terminal environments: {}
[18:30:47.368] TELEMETRY: {"eventName":"resolver","properties":{"osReleaseId":"ubuntu","arch":"x86_64","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"1","remoteInConfigFile":"1","gotUnrecognizedPrompt":"0","dynamicForwarding":"0","localServer":"0","didLocalDownload":"0","installUnpackCode":"0","outcome":"success"},"measures":{"resolveAttempts":1,"retries":1,"timing.totalResolveTime":18283,"timing.preSshTime":10647,"timing.establishSshTime":3572,"timing.scriptTime":3898}}
[18:30:47.370] ------

[18:30:47.712] "SSH Tunnel" terminal received data: "channel 2: open failed: connect failed: Connection refused"
[18:30:47.773] "SSH Tunnel" terminal received data: "channel 2: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused"
[18:30:47.787] "SSH Tunnel" terminal received data: ""
tanhakabir commented 2 years ago

Does your remote have TCP forwarding enabled?

hsinyinfu commented 2 years ago

I was wondering what's the meaning of "TCP forwarding"? Is that the same as ssh port forwarding? If yes, the ssh port forwarding is enabled on the remote host (the entry server).

However, in my two cents, it seems that this use case have nothing to do with port forwarding? In my case, when a user ssh to the entry server, the entry server automatically executes another "ssh " command (written in its system .bashrc or somewhere like that) to force the user to ssh to another LInux server and work on it. The entry server doesn't act as a port forwarder, am I correct?

Here is the console log when I opened a Windows CMD window and typed "ssh @". As you can see, there is a Redirect to linux235 information at the middle part.

C:\Users> ssh id23600@testing_00
The authenticity of host 'testing_00 (10.21.xx.xx)' can't be established.
ECDSA key fingerprint is SHA256:h65+mCmGLihCq2mtPiybxc7PZ8PRL0FZxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'testing_00,10.21.xx.xx' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 4.4.0-148-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

Your Hardware Enablement Stack (HWE) is supported until April 2019.
##########################################################################################
###                                                                                    ###
###                               ***  [IT News]  ***                                  ###
###                                                                                    ###
### [Notice]                                                                           ###
###  1.  DO NOT run build command on Terminal Server.                                  ###
###      Please insert dockerq in front of your build command.                         ###
###      E.g. dockerq make                                                             ###
###  2.  Terminal Servers routinely reboot at 7:00 a.m. every Monday.                  ###
###  3.  RDP is not available for Linux TS. Please install Xming if you want to        ###
###      use GUI.                                                                      ###
###                                                                                    ###
###                                                                                    ###
###                                                                                    ###
##########################################################################################
Redirect to linux235 ...
DISPLAY "(null)" invalid; disabling X11 forwarding
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 4.4.0-148-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

Your Hardware Enablement Stack (HWE) is supported until April 2019.
##########################################################################################
###                                                                                    ###
###                               ***  [IT News]  ***                                  ###
###                                                                                    ###
### [Notice]                                                                           ###
###  1.  DO NOT run build command on Terminal Server.                                  ###
###      Please insert dockerq in front of your build command.                         ###
###      E.g. dockerq make                                                             ###
###  2.  Terminal Servers routinely reboot at 7:00 a.m. every Monday.                  ###
###  3.  RDP is not available for Linux TS. Please install Xming if you want to        ###
###      use GUI.                                                                      ###
###                                                                                    ###
###                                                                                    ###
###                                                                                    ###
##########################################################################################
Last login: Mon Dec 27 13:06:28 2021 from PC11345683
$>
roblourens commented 1 year ago

The logs seem to indicate port forwarding not enabled or working on this host