Linux Tips and Tricks

A collection of tips, tricks and everything linux

Bypass firewalls using ssh and tunnelling.

with 2 comments

Ever wanted to access a service behind a firewall that has port 22 open for ssh connections? This is a common setup known as using a jump-box for security access and to be successful at this we your firewall must allow port 22 traffic to your ssh jump-box. We can test our if port 22 is open by typing the following line.

telnet ssh-jump-box 22

If all is good then we should see something like
Trying 192.168.1.200...
Connected to ssh-jump-box.
Escape character is '^]'.
SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1.2

In this example we’re going to create a tunnel for port 3389 windows rdekstop and we’ll begin by creating a local loopback port 3390 that ssh will tunnel from myMachine to myFireWalledMachine on port 3389

ssh -L 3390:server-behindFirewall:3389 user@ssh-jumpbox -N

Now we can access the service on port 3389 that was previously inaccessible through the firewall by pointing our connection to the local loopback port we just created through ssh. In this case we\’ll use rdesktop to hit that port as we are trying to remote desktop to a firewalled machine.

rdesktop localhost:3390

Written by mnk0

September 23rd, 2008 at 3:23 pm

Posted in ssh

Tagged with , , ,

2 Responses to 'Bypass firewalls using ssh and tunnelling.'

Subscribe to comments with RSS or TrackBack to 'Bypass firewalls using ssh and tunnelling.'.

  1. Well Sir, in my office the port 22 is blocked by Trend Micro Firewall.

    Is there any command to unblock it?

    Razaul Hassan

    11 Nov 08 at 0:00

  2. so .. i think ud have to find out what ports are available through your firewall, you might have to change the service port for ssh on your server, and then create a tunnel to that available port.

    mnk0

    11 Nov 08 at 9:00

Leave a Reply