Thursday, March 15, 2012

SETTING UP VIDALIA IN UBUNTU 11.10

 I am working behind a proxy in Ubuntu. Many softwares doesn't work properly behind the proxy in my Campus (IIT Kharagpur) . The best solution is to use them through a socket connection using tor.
1. Vidalia can be installed from the command line or synaptic or USC. I prefer to use the terminal for installation. For installation additional repositories or PPA are not needed.  If privoxy is already installed in the system then it needs to be removed as it will interfere with working of polipo.


2. The config file of torr needs to edited (replaced) with the following text. Run the command in terminal gedit ~/.vidalia/torrc and paste the following :

 

3. Now edit the  /etc/tor/torrc  file and remove the "#" from the line " ControlPort 9051" so that vidalia could control tor (sudo nano /etc/tor/torrc )

4. Use  sudo visudo and add the following lines at the end of file
 

Save by Ctrl+O followed by enter key and exit by Ctrl+X

5. Using editor command sudo gedit /etc/polipo/config replace the contents of /etc/polipo/config with
 

6. When using vidalia, it attempts to start tor and polipo, but as default this is already running! But it not connected to the tor network. As a result vidalia returns an error message.To solve this problem we have to remove the 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 tor and disable all ticks by the use of space key. Do the same for polipo. sysv-rc-conf  can be quit by using the key q.

7. Run vidalia and edit the settings. Set the proxy which you use.

proxy: 10.3.100.211
Type: HTTP and HTTPS

8. Open startup applications from the settings button on left extreme of top panel  and add two new entries. One for vidalia and one for polipo. Tor will be started by vidalia. So donot setup startup for tor. The polipo startup is set with a delay. If polipo starts before vidalia and tor it will control the port and tor will fail. So polipo must start after vidalia and tor. This is ensured by the delay (sleep 100). Startup application commands are:

vidalia
sleep 100 && polipo &

9. Go to System Settings in top panel and open Network  and select Network Proxy. Set the following values in manual mode. This will globally make the system configured to use tor proxy values.

http , https and ftp 127.0.0.1:8118
socks host 127.0.0.1:9050

10. Reboot the system
12. 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:9050
b) Install torbutton mozilla addon
Use toggle tor status for enabling and disabling tor in firefox

c) 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 ).

13. In google chrome/ chromium use proxy switchy :  
https://chrome.google.com/webstore/detail/caehdcpeofiiigpdhbabniblemipncjj 

13.  For torrent use the client vuze. and set the proxy to socks  127.0.0.1:9050

14.  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

6 comments:

  1. Nice Post.. A couple of queries:
    1.Followed all the steps, but the tor connection stops at statues - "Establishing an encrypted directory connection"

    2.I can use the vidalia-bundle externally, without installing it, perfectly well.. but can't connect vuze using it.. so i thought to install it using your blog and then use vuze,. Can i connect vuze through the vidalia-bundle?

    ReplyDelete
    Replies
    1. Thank you.

      1. I have never used this method for a long time. This method was used when I used Ubuntu 11.10. But in Ubuntu 12.10 this method started to fail with the same error you are facing. So I started using Tor browser bundle.

      2. Vuze can connect using the bundle. But you will need to set a constant Control port. The bundle uses random ports each time by default and it varies with each run. This can be accomplished by editing the vidalia.conf in Data/Vidalia folder. The tor section should mention the control port. If you are behind a proxy server mention it in Network section. I am pasting the sections from my file below:

      [Tor]
      ControlPort=9151
      TorExecutable=./tor
      Torrc=../Data/Tor/torrc
      DataDirectory=../Data/Tor

      [Network]
      ProxyType=httphttps
      ProxyAddress=10.3.100.211:8080

      Now in Data/Tor directory edit the .torrc file and set same control port but different SocksPort
      My file is pasted below:

      AvoidDiskWrites 1
      ControlPort 9151
      DataDirectory /home/nithin/tor-browser_en-US/Data/Tor
      DirReqStatistics 0
      GeoIPFile ./Data/Tor/geoip
      HTTPSProxy 10.3.100.211:8080
      Log notice stdout
      SocksListenAddress 127.0.0.1
      SocksPort 9150

      Also edit torrc.orig.1 same way to set SocksPort and Controlport. This is what it looks like in my case:

      # If non-zero, try to write to disk less frequently than we would otherwise.
      AvoidDiskWrites 1
      # Store working data, state, keys, and caches here.
      DataDirectory ./Data/Tor
      GeoIPFile ./Data/Tor/geoip
      # Where to send logging messages. Format is minSeverity[-maxSeverity]
      # (stderr|stdout|syslog|file FILENAME).
      Log notice stdout
      # Bind to this address to listen to connections from SOCKS-speaking
      # applications.
      SocksListenAddress 127.0.0.1
      SocksPort 9150
      ControlPort 9151

      Delete
    2. It seems all the files on my system already have these settings..
      What are the settings in vuze?
      I have selected Socks proxy in proxy options and set it to
      Host: 127.0.0.1
      Port: 9150
      Socks Version: v5

      Any other setting that needs attention?

      Delete
    3. I dont think there is any other settings needed to run vuze. With this it must work fine

      Delete
    4. Hey, I got vuze working through vidalia, and torrents are downloading, but speed is slow.
      I have yellow smileys with the torrent, and its because of some NAT problem.
      My listen port was set to 28729. I used Help->NAT/Firewall Test to test the port, and it gives me -
      Testing port 28729 ...
      NAT Error - Connect attempt to 77.247.181.162:28729 (your computer) timed out after 20 seconds. This means your port is probably closed.

      Then, I changed the port to 45000(randomly), and again it said-
      Testing port 45000 ...
      NAT Error - Connection to 173.254.216.68:45000 (your computer) refused.

      Before testing, I manually allowed the ports through firewall by command-
      sudo ufw allow 45000

      Please help me through this. Thanks!

      Delete
  2. hi i was using vidalia tor bundle w7, few days back it is not working the status showing Establishing ency like tis pl helo me how to reconnect

    ReplyDelete