Page 1 of 1

SSH works with HTTPS Proxy but Doesnt with SOCKS, why?

Posted: 03 Apr 2017 18:03
by firesh
Hi all,

I have a situation that i do not understand, i hope the SSH experts here will be able to explain to me,
on what's happening.

Here is the question:

Look at the commands below, One runs on HTTPS proxy and another one runs on SOCKS 5 proxy.
However, to reach successfully to the destination reverse SSH, only HTTPS proxy was successful
and not SOCKS, can someone explain to me why is that ?

command that works (HTTPS Proxy)

Code: Select all

ssh -vvv -o ProxyCommand='nc -x connect -X %h %p' -o StrictHostKeyChecking=no -f -i /mykey -R 1031:localhost:9050 -p 80 <command>

command that doesn't work (SOCKS Proxy)

Code: Select all

ssh -vvv -o ProxyCommand='nc -x %h %p' -o StrictHostKeyChecking=no -f -i /mykey -R 1031:localhost:9050 -p 80 <command>
The error i get whenever i try with SOCKS 5 proxy is "ssh_exchange_identification: Connection closed by remote host"

List of absolute working assumptions:
- exist and working (yes it is)
- is a SOCKS 5 proxy (yes it is)
- is a HTTPS proxy (yes it is)
- /mykey exist with correct permissions (yes it is)
- nc -x or nc -x 5 is the same as nc defaults to SOCKS 5 by default