{"revision": {"id": "f1dd998d-2f95-11f1-b341-e86a64d24d78", "node_id": "f1dce8e3-2f95-11f1-b249-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "SSH Tunnel for HTTP Traffic\r\n==============================\r\n\r\n**Are You stuck behind a firewall?**\r\n\r\n Does your school, library, work, or parents control where you surf and what ports you have open? Do you surf on such public domains and need more privacy? Are you sick of failing proxies?\r\n\r\n If you answered 'Y' to any of these questions then this tutorial is for you.\r\n\r\n**My Story** \r\n\r\n My place of employment has a bastard firewall and it blocks nearly all ports and many great sites. (such as foxhop.net, icodeviruses.com, or youtube.com).  I needed a way to get around the blocks and not get caught.\r\n\r\n\r\n.. contents:: Sections \r\n\r\nCommon Questions\r\n-------------------\r\n**What is the best way to get around a firewall?** \r\n \r\n Create an SSH tunnel from the work network to your home network.\r\n\r\n**My network administrator is smart, will I get caught?**\r\n \r\n No, you will most likely not get caught.  All the firewall sees is a connection to a resource on the internet.  When you browse the web using the tunnel all traffic is encrypted.  If a network administrator captured packets he would only get garbage data.  An SSH tunnel is basically a VPN between two computers or networks.  1337\t\r\n\r\n**Can a network admin stop a person or computer from tunneling?**\r\n \r\n The Admin will typically not know about the tunnel.  From his view a tiny connection is being placed and is normally overlooked.  The admin does have the ability to block the default SSH port 22.  You can build your tunnel over any port.\r\n\r\nArticle Scope\r\n-------------------\r\n\r\n.. _Putty.exe: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html\r\n.. _Firefox: http://portableapps.com/apps/internet/firefox_portable\r\n\r\nWe will discuss the steps of building an SSH Tunnel for HTTP traffic between two computers on different networks.  This guide will cover both windows and linux localhosts.\r\n\r\nThroughout this guide I will use the following terms, here are the definitions:\r\n\r\n*localhost*\r\n The computer at work or school.\r\n*remotehost*\r\n The computer or server that is offsite, which has the SSH server running.\r\n\r\n**What you need ...**\r\n\r\n#. Credentials to a remotehost running an SSH server. (openssh-server)\r\n#. A localhost computer crippled by a pesky network firewall.\r\n#. An SSH client, For windows get Putty.exe_\r\n#. Firefox_ ( Portable is best )\r\n\r\n**Why is this the best method?**\r\n\r\n#. Most of the configuration is done from the localhost (while at school or work).\r\n#. You don't need admin rights to run Putty.exe_, just place it on a USB drive.\r\n#. You don't need admin rights to run Firefox_ Portable, just place it on a USB drive.\r\n#. No changes need to be made on the remotehost ssh server.\r\n\r\n\r\nSSH Tunnel created from a Windows localhost\r\n-----------------------------------------------\r\n\r\n Follow this guide if your localhost (school or work) computer is Windows based.\r\n\r\nConfigure the SSH Server\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n The remotehost SSH server doesn't need to be configured.  \r\n\r\n Just be sure its installed and running and that you have credentials to login. It just needs to be installed and running and you just need credentials.\r\n\r\n To install openSSH-server on Debian or Ubuntu linux type::\r\n\r\n  sudo apt-get install ssh\r\n  \r\n When I'm at work, I establish an SSH Tunnel to my remotehost webserver at home.  \r\n\r\n Keep in mind that this doesn't have to be your server, you just need credentials for SSH. \r\n\r\n\r\nConfigure the SSH Client\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n #. Download Putty.exe_ if you haven't already, you should follow along.\r\n\r\n #. Double click Putty.exe_.\r\n\r\n    .. image:: http://engineer.siue.edu/puttyConnectScreen.gif\r\n\r\n #. The 'Host Name (or IP address)' box should point to the SSH enabled remoteserver. \r\n\r\n #. Toggle the SSH radio button to set the port to 22. (The native SSH port). \r\n\r\n #. Type a name into the 'Saved Sessions' box to save all the settings we toggle.\r\n\r\n #. Click the save button.\r\n\r\n #. There is a list of categories to the left of the putty window.\r\n\r\n #. Navigate to: ( Connection > SSH > Tunnel )\r\n\r\n #. You should be at a menu that is labeled 'Options controlling SSH port forwarding'.\r\n    \r\n #. Click the 'Dynamic' radio button. \r\n\r\n #. Leave 'Destination' text box blank.\r\n \r\n #. Type '7070' into the 'Source port' text box.\r\n\r\n #. Click the 'Add' button.\r\n\r\n #. Save your configuration by going back to the 'Session' category, selecting your saved session, and pressing the 'save' button.\r\n\r\n #. Double-click your saved session.\r\n\r\n #. A black terminal window should appear.\r\n\r\n #. You will be prompted for a username and password.  \r\n\r\n #. You should be greeted by the server if successful.  Leave the putty window open.\r\n\r\n #. `Configure Firefox... <#configure-firefox-to-use-the-ssh-tunnel>`_\r\n\r\n\r\nSSH Tunnel created from a Linux localhost\r\n------------------------------------------------\r\n\r\n Follow this guide if your localhost (work or school) computer is Linux.\r\n\r\nCreate the tunnel\r\n~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nOpen a terminal or console window, and enter the following command::\r\n\r\n ssh -ND 7070 user@remotehost_ip\r\n\r\nYou will be prompted for credentials on the remotehost.  \r\n\r\nAll you need to do is login to establish the tunnel.\r\n\r\n\r\nConfigure Firefox to use the SSH Tunnel\r\n------------------------------------------\r\n\r\nSetup Socks 5 proxy.\r\n\r\n#. Open Firefox_.\r\n\r\n#. Click **Edit** -> **Preferences**\r\n\r\n#. Click the **Advanced** and **Network** tabs.\r\n\r\n#. Click the **Settings...** button.\r\n\r\n#. Click the **Manual Proxy Configuration** radio button\r\n\r\n#. In **Socks Host** type *localhost*.  In port type *7070*.\r\n\r\nYou should now be able to browse the Internet using your remote connection.  All data will be passed through the remote hosts internet connection.  All traffic will be encrypted between the localhost and the remotehost.\r\n", "source_format": "rst", "revision_number": 1, "created": 1276973224000}}