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

remote-ssh couldn't establish connection to the remote via proxy, while openSSH and putty could #3968

Closed
Euruson opened this issue Nov 7, 2020 · 4 comments
Assignees
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH

Comments

@Euruson
Copy link

Euruson commented Nov 7, 2020

  • VSCode Version: 1.51.0
  • Local OS Version: Windows_NT x64 10.0.18363
  • Remote OS Version: Ubuntu 18.04 LTS
  • Remote Extension/Connection Type: SSH

Steps to Reproduce:

  1. Have a server behind a firewall. The server is connected to the Internet, but cannot be directly reached from local.
  2. Build a proxy like a tunel between remote and local. For me, I use v2ray's "reverse" proxy, which redirects traffic from local to remote.
  3. Use remote-ssh via this proxy.

Here is my ssh config:

Host trainer
    HostName localhost
    ProxyCommand connect -S 127.0.0.1:1080 %h %p
    IdentityFile ~/.ssh/id_rsa
    User euruson

I can ssh to the remote with openSSH client using this config file, as well as with putty. But with VScode's Remote-SSH, the connection cannot be established.

Remote-SSH works perfectly with the server in LAN.

And here is the log in VScode's console:

[18:30:24.913] Log Level: 2
[18:30:24.915] remote-ssh@0.55.0
[18:30:24.915] win32 x64
[18:30:24.916] SSH Resolver called for "ssh-remote+trainer", attempt 1
[18:30:24.916] SSH Resolver called for host: trainer
[18:30:24.916] Setting up SSH remote "trainer"
[18:30:24.935] Using commit id "fcac248b077b55bae4ba5bab613fd6e9156c2f0c" and quality "stable" for server
[18:30:24.937] Install and start server if needed
[18:30:24.940] Checking ssh with "ssh -V"
[18:30:24.979] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

[18:30:24.982] Running script with connection command: ssh -T -D 4632 trainer bash
[18:30:24.985] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[18:30:25.038] > 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> �]0;C:\WINDOWS\System32\cmd.exe�
[18:30:25.038] Got some output, clearing connection timeout
[18:30:25.047] > 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
[18:30:25.055] > 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
[18:30:25.069] > CreateProcessW failed error:2
> 
[18:30:25.079] > posix_spawn: No such file or directory
> 过程试图写入的管道不存在。
> 
[18:30:25.353] "install" terminal command done
[18:30:25.354] Install terminal quit with output: 过程试图写入的管道不存在。
[18:30:25.354] Received install output: 过程试图写入的管道不存在。
[18:30:25.354] Stopped parsing output early. Remaining text: 过程试图写入的管道不存在。
[18:30:25.355] Failed to parse remote port from server output
[18:30:25.361] Resolver error: Error: 
	at Function.Create (c:\Users\yulin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:1:130564)
	at Object.t.handleInstallOutput (c:\Users\yulin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:1:127671)
	at I (c:\Users\yulin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:106775)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async c:\Users\yulin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:104774
	at async Object.t.withShowDetailsEvent (c:\Users\yulin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:109845)
	at async Object.t.resolve (c:\Users\yulin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:107960)
	at async c:\Users\yulin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:141955
[18:30:25.364] ------

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

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Nov 7, 2020
@roblourens
Copy link
Member

[18:30:25.069] > CreateProcessW failed error:2
> 
[18:30:25.079] > posix_spawn: No such file or directory

I have no clue. Does something like this work? echo "echo hello" | ssh -T <yourhost> bash?

@roblourens roblourens added the info-needed Issue requires more information from poster label Nov 9, 2020
@roblourens roblourens self-assigned this Nov 9, 2020
@Euruson
Copy link
Author

Euruson commented Nov 11, 2020

[18:30:25.069] > CreateProcessW failed error:2
> 
[18:30:25.079] > posix_spawn: No such file or directory

I have no clue. Does something like this work? echo "echo hello" | ssh -T <yourhost> bash?

In win10's cmd, I got this:

C:\Users\Euruson>where ssh
C:\Windows\System32\OpenSSH\ssh.exe

C:\Users\Euruson>echo "echo hello" | ssh -T euruson@trainer bash
CreateProcessW failed error:2
posix_spawn: No such file or directory

In git-bash, I got this:

Euruson@DESKTOP-4RLUREV MINGW64 ~
$ echo "echo hello" | ssh -T euruson@trainer bash
hello

@Euruson
Copy link
Author

Euruson commented Nov 11, 2020

Following this, I found it works by setting connect in ssh_config's ProxyCommand to absolute path.

So this problem may be resulted from environment variables. But it's really confusing that the same config with relative path works fine for git, like this:

Host github.com *.github.com
    ProxyCommand connect -S 127.0.0.1:1080 %h %p
    IdentityFile ~/.ssh/id_rsa
    User git

Anyway, thanks for pointing out the key information.

@roblourens
Copy link
Member

Strange. Glad you were able to work it out.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

2 participants