sam keen's corner of the web

Getting Around Clients that only allow connection from a single IP

As a freelance Web Developer, I often find myself this circumstance.
Client X states…

We can allow you access to our network but only through your single dedicated IP

I won’t go into how ‘un’-realword this is in this day and age (what freelance coder always works behind a single IP?). I tend to work from coffee shops and at home I prefer (cheaper) dynamic ip broadband.

Overview: We will use a ‘trusted’ server we have ssh access to as a ‘proxy’ to connect to the ClientX server. From ClientX’s point of view, it will simply look as though you are connecting directly from the proxy server but you will be able to connect to clientX from any server (through the proxy server).

Step 1:

Give clientX the IP to any “trusted” static IP server you have ssh access to (this will be the proxy server).

Step 2:

The setup

On local, issue this command…

$ ssh -L2001:clientX:22 proxy

You are instructing SSH to encrypt traffic from port 2001 (chosen arbitrarily, you can choose any unprivleged port that is available) on your local computer and send it to port 22 on clientX, using the SSH server on proxy.

Leave this terminal open (where you issue the above command. It will be logged into proxy through ssh).

Now in a new terminal window you can ssh, scp, sftp to clientX by using local port 2001. You can even use your favorite graphical ssh, scp,or sftp client, just point it to localhost and port 2001.

ex:

$ ssh -p2001 user@localhostuser@localhost's password:Last login: Fri Jan 19 17:29:23 2007 from 99.99.180.136[user@clientX user]$ hostnameclientX.com[user@clientX user]$

As you can see, you ssh to localhost port 2001 and end up on clientX

Shown below, you can take your GUI sftp client and point it to localhost and port 2011, after logging in (with your clientX credentials), you will see your files on clientX

To close the connection, disconnect any ssh, scp, or sftp clients then simply type exit in the original terminal where you typed $ ssh -L2001:clientX:22 proxy

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>