Saturday, July 5, 2014

Tor in Ubuntu 14.04

Earlier I had written how to use tor with Ubuntu 12.04 and 11.10 . Those methods have become pretty outdated. With the recent versions of tor browser bundle the process of setting up tor is simpler. But to use use tor with other applications you need to still a bit of tweaking.


1. Set up tor browser bundle

         The first step is to download tor browser bundle and extract  it. Tor can be launched by running start-tor-browser script in extracted directory. If permission is denied then run "chmod -R a+x * in a terminal to add executable bit to the files. During first run, set the proxy  settings and exit tor. Start tor again. Once the connection is established tor browser will come automatically. This is a tweaked version of firefox. By default, add-ons and other extensions are disabled.  If you want to use tor just for browsing rest of the steps are irrelevant for you.

2. Find out the Control and Socks Port

          Inside the tor browser bundle directory  there is a Data/Tor directory which contains the torrc-defaults file. The Control and SocksPort are present in the file. In my case it is as follows :
SocksPort 9150
ControlPort 9151

3. Socks proxy
      
        Your socks proxy will be 127.0.0.1:SocksPort. In my case it is 127.0.0.1:9151. This can be set as the proxy in any application to use it under socks proxy provided by tor.

4.  Setting up http and https proxy for tor

     4.1 For this install polipo and make sure that privoxy is not installed.

           

     4.2 Use  sudo visudo and add the following lines at the end of file:

           

    4.3 Using editor command sudo gedit /etc/polipo/config replace the contents of /etc/polipo/config with the following content. Make sure that 9150 is replaced with your Socks Port found in step 3.

         

   4.4 Restart polipo.

           

   4.5 Set polipo not to start by default

        We have to remove the polipo service from startup. For that sudo apt-get install sysv-rc-conf. After installation run sudo sysv-rc-conf. It will display a table , scroll down by the use of arrow key to the line with polipo and disable all selections by the use of space key.  sysv-rc-conf  can be quit by using the key q.
 
Now u can use the proxy 127.0.0.1:8118 as http, https and ftp proxies under tor. After tor connects run 'sudo service polipo start' to start the polipo service.

5.  To use tor in firefox follow either steps
 
a) Set the proxy to
http , https and ftp 127.0.0.1:8118
socks host 127.0.0.1:9150
bc) Use foxyproxy for custom proxy management
use 27.0.0.1:8118 and other proxies in a mixed manner specifying custom patterns in urls. (I prefer this method ).
6.  For torrent use the client vuze. and set the http or socks proxy.

7. Using tor from Virtual machine.

 If you are using virtualbox then we can use the host tor network in the guest os. For that set all proxy in guest OS as : 10.0.2.2:8188