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.57k stars 267 forks source link

[Remote-SSH Bug]: #8337

Closed Sahils23 closed 1 year ago

Sahils23 commented 1 year ago

Is there an existing issue for this bug?

Required Troubleshooting Steps

Connect Locally

It connects successfully

->

No response

Expected Behavior

I want to connect to my dev server which needs me to connect to SFO VPN. To login to my dev server I need to go through intermediate jumphost first. When I login to my dev sever locally I use command -->

tsh --proxy=sfopx01.<company_name>.com login --insecure && tsh --proxy=$sfogw1 ssh -t user@<jumphost-ip> ssh user@<target_dev-ip>

and this logs me in directly into my dev server. Local_Terminal_Login

Now I am trying to setup this with remote-ssh in vs code

Here is how my configuration files looks like -->

1) /home/test/.ssh/config

Host my_dev_server
  HostName 10.172.141.86
  User sahil.shinde
  ProxyCommand tsh --proxy=sfopx01.pubmatic.com login --insecure && tsh --proxy=$sfogw1 ssh -J sahil.shinde@10.100.152.36 %h

2) /etc/ssh/ssh_config

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

Include /etc/ssh/ssh_config.d/*.conf

Host *
    ServerAliveInterval 300
    ServerAliveCountMax 3

#   ForwardAgent no
#   ForwardX11 no
#   ForwardX11Trusted yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   IdentityFile ~/.ssh/id_ecdsa
#   IdentityFile ~/.ssh/id_ed25519
#   Port 22
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes

3) etc/ssh/sshd_config

#   $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Include /etc/ssh/sshd_config.d/*.conf

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
PermitRootLogin without-password
# no default banner path
#Banner none

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# override default of no subsystems
Subsystem   sftp    /usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server

Steps To Reproduce

No response

Remote-SSH Log

Remote-SSH Log

[12:17:00.133] Log Level: 2 [12:17:00.139] SSH Resolver called for "ssh-remote+my_dev_server", attempt 1 [12:17:00.140] "remote.SSH.useLocalServer": false [12:17:00.140] "remote.SSH.showLoginTerminal": true [12:17:00.140] "remote.SSH.remotePlatform": {} [12:17:00.140] "remote.SSH.path": undefined [12:17:00.140] "remote.SSH.configFile": undefined [12:17:00.140] "remote.SSH.useFlock": true [12:17:00.140] "remote.SSH.lockfilesInTmp": false [12:17:00.141] "remote.SSH.localServerDownload": auto [12:17:00.141] "remote.SSH.remoteServerListenOnSocket": false [12:17:00.141] "remote.SSH.showLoginTerminal": true [12:17:00.141] "remote.SSH.defaultExtensions": [] [12:17:00.141] "remote.SSH.loglevel": 2 [12:17:00.141] "remote.SSH.enableDynamicForwarding": true [12:17:00.141] "remote.SSH.enableRemoteCommand": true [12:17:00.141] "remote.SSH.serverPickPortsFromRange": {} [12:17:00.141] "remote.SSH.serverInstallPath": {} [12:17:00.144] VS Code version: 1.76.2 [12:17:00.144] Remote-SSH version: remote-ssh@0.98.0 [12:17:00.144] linux x64 [12:17:00.146] SSH Resolver called for host: my_dev_server [12:17:00.146] Setting up SSH remote "my_dev_server" [12:17:00.149] Using commit id "ee2b180d582a7f601fa6ecfdad8d9fd269ab1884" and quality "stable" for server [12:17:00.152] Install and start server if needed [12:17:01.904] PATH: /home/test/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin [12:17:01.905] Checking ssh with "ssh -V" [12:17:01.920] > OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020 [12:17:01.926] Running script with connection command: ssh -T -D 40957 -o ConnectTimeout=50 'my_dev_server' bash [12:17:10.108] > kex_exchange_identification: Connection closed by remote host [12:17:10.109] Got some output, clearing connection timeout [12:17:10.567] "install" terminal command done [12:17:10.568] Install terminal quit with output: kex_exchange_identification: Connection closed by remote host [12:17:10.568] Received install output: kex_exchange_identification: Connection closed by remote host [12:17:10.569] Failed to parse remote port from server output [12:17:10.571] Resolver error: Error: at m.Create (/home/test/.vscode/extensions/ms-vscode-remote.remote-ssh-0.98.0/out/extension.js:1:584388) at t.handleInstallOutput (/home/test/.vscode/extensions/ms-vscode-remote.remote-ssh-0.98.0/out/extension.js:1:582948) at t.tryInstall (/home/test/.vscode/extensions/ms-vscode-remote.remote-ssh-0.98.0/out/extension.js:1:681793) at async /home/test/.vscode/extensions/ms-vscode-remote.remote-ssh-0.98.0/out/extension.js:1:644041 at async t.withShowDetailsEvent (/home/test/.vscode/extensions/ms-vscode-remote.remote-ssh-0.98.0/out/extension.js:1:647359) at async t.resolve (/home/test/.vscode/extensions/ms-vscode-remote.remote-ssh-0.98.0/out/extension.js:1:645091) at async /home/test/.vscode/extensions/ms-vscode-remote.remote-ssh-0.98.0/out/extension.js:1:720839 [12:17:10.577] ------

Anything else?

Screenshot from 2023-04-07 12-18-55

roblourens commented 1 year ago

If you can get it to work with your ProxyCommand by running an ssh command manually in a terminal, then you can probably get it to work with Remote-SSH. You might also be interested in the Remote Tunnels workflow which avoids having to set this up with SSH entirely https://code.visualstudio.com/docs/remote/tunnels

github-actions[bot] commented 1 year ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!