Ssh through a proxy from your Apple Mac OS X

For Linux using Corkscrew and for Windows using Putty it is possible to punch through proxies to connect to a remote SSH-server. Let's do the exact same thing from an Apple, using Mac OS X.

You will need to download Corkscrew. Open a Terminal to type some of these commands:

$ cd Downloads
$ tar -xvzf corkscrew-x.y.tar.gz
$ cd corkscrew-x-y
$ ./configure --host=apple
$ make
$ cp corkscrew $HOME/.ssh/

If that does not work; try downloading my compiled version (right click -download linked file), maybe that works on your mac.

Now you need to tell your ssh client (also on your Apple) to use corkscrew. In that same terminal, either use vi(1) or simple copy-change-paste these commands to suit your situation:

echo "Host machine-on-the-outside-network.example.com" >> $HOME/.ssh/config
echo "ProxyCommand $HOME/.ssh/corkscrew proxy.on-the-inside-network.example.com 8080 %h %p" >> $HOME/.ssh/config

Replace machine-on-the-outside-network.example.com by the machine that you want to reach, mostly a server, or your home-computer running an ssh daemond. Replace proxy.on-the-inside-network.example.com by the name of the proxy server you are using. You can find this at the Network preference in Advanced at Proxies. Replace 8080 by the port your proxy is listening to, mostly 8080 or 3128.

You are now done, in that terminal that is or was open, type:

$ ssh machine-on-the-outside-network.example.com

and you should be done!

AttachmentSize
corkscrew.17.42 KB

Comments

For some reason I cannot do

For some reason I cannot do ssh over my HTTP proxy. I can view webpage using

~/.ssh/corkscrew PROXY_IP_HERE PORT ya.ru 80 /Users/timothyha/.ssh/proxyauth (where I have my login and password to the proxy)

But when I put corkscrew in .ssh/config and try to login to a ssh server through proxy, I have

MacBook-Pro-Timothy:corkscrew-2.0 timothyha$ ssh -v myserver.info
OpenSSH_5.9p1, OpenSSL 0.9.8y 5 Feb 2013
debug1: Reading configuration data /Users/timothyha/.ssh/config
debug1: /Users/timothyha/.ssh/config line 9: Applying options for krotov.info
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Executing proxy command: exec $HOME/.ssh/corkscrew PROXY_IP_HERE PORT SERVER_IP_HERE SERVER_PORT $HOME/.ssh/proxyauth
debug1: identity file /Users/timothyha/.ssh/id_rsa type -1
debug1: permanently_drop_suid: 501
debug1: identity file /Users/timothyha/.ssh/id_rsa-cert type -1
debug1: identity file /Users/timothyha/.ssh/id_dsa type -1
debug1: identity file /Users/timothyha/.ssh/id_dsa-cert type -1
ssh_exchange_identification: Connection closed by remote host
MacBook-Pro-Timothy:corkscrew-2.0 timothyha$

The same server DOES support ssh - I tried that in Windows - putty session can be configured to use that HTTP proxy.

Does this work if the proxy

Does this work if the proxy has a username and password?

Did you ever find out how to

Did you ever find out how to use this technique with a username and password on the inside proxy?

I have been trying for

I have been trying for months to get corkscrew to run on my machine and I can't do a "make" command. I get "-bash: make: command not found
". This really alarms me because I can do it on other programs but just not corkscrew.

Can you help here? I am just using the wrong path or something.

Thanks.

Adam

you need to install Apple

you need to install Apple Xcode from the apple XCode site - or the developer tools from your dvd.

I guess you need to install

I guess you need to install some extra tools on your Mac. Try inserting your Mac OS X install CD and add "developer" (or something similar) tools.

Regards,

Robert de Bock
[email protected]

The download link is dead,

The download link is dead, I've used http://ftp.de.debian.org/debian/pool/main/c/corkscrew/corkscrew_2.0.orig.tar.gz

You should change the link on your page :)

The syntax of the authfile (if needed) is username:password

I´m using this software:

I´m using this software: corkscrew, and this already was configured:

MacBook-Pro-de-Jaime:.ssh jaimealbertoquijanomartinez$ /usr/local/bin/corkscrew -?
corkscrew 2.0 ([email protected])

usage: corkscrew
[authfile]

However when I try to connect with the remote host I have this messages:

MacBook-Pro-de-Jaime:.ssh jaimealbertoquijanomartinez$ ssh [email protected]
Couldn't establish connection to proxy: Can't assign requested address
ssh_exchange_identification: Connection closed by remote host

or

MacBook-Pro-de-Jaime:.ssh jaimealbertoquijanomartinez$ ssh [email protected]
Couldn't establish connection to proxy: Can't assign requested address
ssh_exchange_identification: Connection closed by remote host

This is my cofigure file:

acBook-Pro-de-Jaime:.ssh jaimealbertoquijanomartinez$ more config
Host 190.13.96.28
ProxyCommand /usr/local/bin/corkscrew wwww-proxy.us.oracle.com 80 %h %p

Do you have any idea about this issue?

About Consultancy Articles Contact




References Red Hat Certified Architect By Robert de Bock Robert de Bock
Curriculum Vitae By Fred Clausen +31 6 14 39 58 72
By Nelson Manning [email protected]