SSHing thru an HTTP proxy
- by Siler
Typical scenario: I'm trying to SSH thru a corporate HTTP proxy to a remote machine using corkscrew, and I get:
ssh_exchange_identification: Connection closed by remote host
Obviously, there's a lot of reasons this might be happening - the proxy might not allow this, the remote box might not be running sshd, etc.
So, I tried to tunnel manually via telnet:
$ telnet proxy.evilcorporation.com 82
Trying XX.XX.XX.XX...
Connected to proxy.evilcorporation.com.
Escape character is '^]'.
CONNECT myremotehost.com:22 HTTP/1.1
HTTP/1.1 200 Connection established
So, unless I'm mistaken... it looks like the connection is working.
So, why then, doesn't it work via corkscrew?
ssh -vvv [email protected] -p 22 -o "ProxyCommand corkscrew proxy.evilcorporation.com 82 myremotehost.com 22"
OpenSSH_6.6, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Executing proxy command: exec corkscrew proxy.evilcorporation.com 82 myremotehost.com 22
debug1: permanently_set_uid: 0/0
debug1: permanently_drop_suid: 0
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6p1 Ubuntu-2ubuntu1
ssh_exchange_identification: Connection closed by remote host