Hi,
The native SSH client, that uses this project, doesn't have support for connecting through a PROXY.
However, until native support will be added... here a "tip" for you:
.ssh/config file:Host myhost
HostName myhost-address
ProxyCommand ncat.exe --proxy-type socks4 --proxy <proxy-addr>:1080 %h %p
ncat.exe in your Windows directory (or any other in your path).And that's all! Then you can connect to your dev host over a proxy (or over another SSH session without using the native Jump functionality).
I hope you like it! 馃槈
@lars18th, can you elaborate on
The native SSH client, that uses this project, doesn't have support for connecting through a PROXY.
ProxyCommand and ProxyJump are the standard way to setup jump boxes in ssh.
ProxyCommandandProxyJumpare the standard way to setup jump boxes in ssh.
Hi, I know it! However, note that Windows doesn't have ANY native tool to execute as the ProxyCommand. So for this reason no native solution exists.
In any case my proposal of using ncat.exe works. Perhaps the Microsoft group will like to include it as native.
@lars18th, can you elaborate on
The native SSH client, that uses this project, doesn't have support for connecting through a PROXY.
ProxyCommandandProxyJumpare the standard way to setup jump boxes in ssh.
Hi kieferrm,
IsProxyJumpeven supported by vscode-remote? I tried but failed quickly with a "unreachable or not Linux x86_64". But ssh client works fine with proxyjump in cmd(win10).
@lars18th, can you elaborate on
Yes.
ProxyComand in the .ssh/config file.ProxyCommand you need an EXTERNAL TOOL, as Microsoft doesn't provide _any_ native helper tool to work with the ProxyCommand.So, two solutions can be possible:
ncat.exe or connect.exe (or distribute them with the package Win32-OpenSSH).The main problem is that many developers connect to the target server using SOCKS or HTTP proxies.
I hope it's more clear now. :wink:
Regards.
@lars18th, can you elaborate on
Yes.
- Current Remote-SSH plugin uses the "native" Win32-OpenSSH SSH Client.
- With this client, the ONLY solution to connect to the target machine using a PROXY (HTTP or SOCKS4) it's using the parameter
ProxyComandin the.ssh/configfile.- In the WINDOWS PLATFORM to use the
ProxyCommandyou need an EXTERNAL TOOL, as Microsoft doesn't provide _any_ native helper tool to work with theProxyCommand.So, two solutions can be possible:
- Or the Microsoft people will expand the Win32-OpenSSH Client with native support of proxies.
- Or they provide a tool similar to
ncat.exeorconnect.exe(or distribute them with the package Win32-OpenSSH).The main problem is that many developers connect to the target server using SOCKS or HTTP proxies.
I hope it's more clear now. 馃槈
Regards.
There is a know bug of win32-openssh when use parameter ProxyJump, see: https://github.com/PowerShell/Win32-OpenSSH/issues/1172
there is a PRIVATE fix for this bug, it works fine for a separate ssh process, but when it is called by vscode-remote, still not working. Guess it is a vscode-remote problem.
for the other param ProxyCommand, ssh works fine also, yet still vscode-remote is not working.
either way vscode-remote keeps telling "Can't connect to xx: unreachable or not Linux x86_64 (Thus no job control in this shell.)"
Hi @juztinzhu ,
There is a know bug of win32-openssh when use parameter ProxyJump, see: https://github.com/PowerShell/Win32-OpenSSH/issues/1172
there is a PRIVATE fix for this bug, it works fine for a separate ssh process, but when it is called by vscode-remote, still not working. Guess it is a vscode-remote problem.
I don't understand your comment. Please, take note that:
for the other param ProxyCommand, ssh works fine also, yet still vscode-remote is not working.
either way vscode-remote keeps telling "Can't connect to xx: unreachable or not Linux x86_64 (Thus no job control in this shell.)"
Regards.
@lars18th Hi, sorry I confused you. I was thinking that if you had noticed the problem of vscode-remote it self, but clearly you have mentioned it in another post, which I just saw. Please ignore it.
Hello,
I have slightly different configuration that works for me in both Powershell and VSCode ssh remote over http proxy, it uses connect.exe and ssh.exe from git for windows distribution:
(My windows is the Windows 10 Pro 1809)
1) I have Git for Windows installed in c:\Git\
2) My system path has c:\Git\usr\bin directory appearing before the %SystemRoot%\system32 in order to have ssh.exe from Git tools as default instead of the ssh.exe delivered by windows that doesn't understand ProxyCommand
3) in %USERPROFILE%\.ssh\config I have this as typical entry (sanitized)
Host badscrew_web
User badscrew
Port 22
Hostname 123.123.123.123
IdentityFile "c:\Users\badscrew\mykeys\ssh\id_rsa"
TCPKeepAlive yes
IdentitiesOnly yes
ProxyCommand "c:\Git\mingw64\bin\connect.exe" -H myproxy.mycompany.com:80 %h %p
This works in both powershell command line (ssh badscrew_web) and in VSCode (RemoteSSH - Connect to Host... > badscrew_web).
@badscrew it works!
@badscrew , thanks, I checked, socks proxy also works.
ProxyCommand "C:\Program Files\Git\mingw64\bin\connect.exe" -H 127.0.0.1:1080 %h %p
@imaemo
ProxyCommand "C:\Program Files\Git\mingw64\bin\connect.exe" -H 127.0.0.1:1080 %h %p
does this mean you need to have socks proxy connected in cmd before you connect via vs code remote ssh?
edit: nevermind I got it to work with ProxyCommand ssh -W %h:%p proxy-hostname as mentioned in https://github.com/microsoft/vscode-remote-release/issues/18#issuecomment-497653207
Thanks for the discussion here! Upon reviewing this thread, it looks like there are solutions listed, and this isn't quite an issue or feature request lying with Remote - SSH specifically? If folks agree, I'll go ahead and close the issue.
I think the path of connect.exe need escape
ProxyCommand C:\\Program\ Files\\Git\\mingw64\\bin\\connect.exe -H 127.0.0.1:8080 %h %p it works
Based on the above, going to close out this thread, but please let me know if there are any other Remote - SSH related inquiries here. Thank you!
Most helpful comment
Hello,
I have slightly different configuration that works for me in both Powershell and VSCode ssh remote over http proxy, it uses connect.exe and ssh.exe from git for windows distribution:
(My windows is the Windows 10 Pro 1809)
1) I have Git for Windows installed in c:\Git\
2) My system path has
c:\Git\usr\bindirectory appearing before the%SystemRoot%\system32in order to havessh.exefrom Git tools as default instead of thessh.exedelivered by windows that doesn't understand ProxyCommand3) in
%USERPROFILE%\.ssh\configI have this as typical entry (sanitized)This works in both powershell command line (
ssh badscrew_web) and in VSCode (RemoteSSH - Connect to Host... > badscrew_web).