I'm trying to connect to an SSH server from a Windows PC behind a corporate HTTP proxy.
The trick works under Debian using OpenSSH client with
ncat from the nmap package, but it does not work under Windows with Plink 0.70 + Ncat 7.70 (https://nmap.org). Putty works fine too, though using pure plink would be better for me.
Plink has the
-proxycmd option, which seems to be similar to the
ProxyCommand option in OpenSSH. However, it does not work as expected (SSH server is running on port 443):
plink.exe -C -ssh -P 443 -i my_pvt_key.ppk -proxycmd "ncat --verbose --proxy-type http --proxy 192.168.101.200:3128 %host %port" -sshlog sshlog.txt firstname.lastname@example.org
The command immediately returns "FATAL ERROR: Server unexpectedly closed network connection".
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2018.07.19 07:38:28 =~=~=~=~=~=~=~=~=~=~=~= Event Log: Writing new session log (SSH packets mode) to file: sshlog.txt Event Log: Starting local proxy command: ncat --verbose --proxy-type http --proxy 192.168.101.200:3128 port Event Log: We claim version: SSH-2.0-PuTTY_Release_0.70 Event Log: Server unexpectedly closed network connection
The third line of the log is confusing. There is the word 'port' in the end of the command, and it should have been replaced with the actual port. Host
192.0.2.123 is not shown at all.
ncat --verbose --proxy-type http --proxy 192.168.101.200:3128 192.0.2.123 443 itself seems to work fine. Thus, I suppose, the problem is that Plink doesn't parse arguments in the ncat command correctly. I am probably wrong.
Any ideas how to fix that?