How to set up Tor and Privoxy on Ubuntu Linux

About Tor

Tor, an innovation of the Electronic Frontier Foundation, is a distributed network of virtual tunnels (you can think of it as a peer to peer network of proxy servers). Essentially data is transferred in encrypted form through multiple servers. It is very useful as a privacy measure because the data is encrypted and it’s very difficult to find the source of the data directly. It also comes in handy for getting around overly restrictive firewall policies (such as the Chinese government firewall, or the firewall my university campus network has) because it can be tunneled over any port you wish.

Overview [Tor]

About Privoxy

Privoxy is basically an HTTP proxy that has the additional feature of hiding all DNS requests. This is simply used on top of Tor to provide that additional layer of privacy (Tor behaves as a SOCKS 4 proxy, and as such browsers can leak requests if it’s used directly instead of going through Privoxy).

What you need

  • A computer running Ubuntu 6.06 on which you have root privileges
  • An internet connection

Installation

Open /etc/apt/sources.list as root in your favorite text editor, and add the following line to the end

# Tor
deb http://mirror.noreply.org/pub/tor dapper main
deb-src http://mirror.noreply.org/pub/tor dapper main

Then, open a terminal, and install the necessary components by executing the following commands:

sudo apt-get update
sudo apt-get install tor privoxy tsocks

Configure Privoxy to use Tor

Open /etc/privoxy/config as root in your favorite text editor, and add the following line to the top of the file (don’t forget the dot at the end of the line, it’s important):

forward-socks4a / localhost:9050 .

If you’re using Privoxy for privacy, you might also want to disable logging. To do that comment out the following lines in the file by putting a # before them:

logfile logfile
jarfile jarfile

Configure Tor’s ports to use HTTP/HTTPS (useful for getting through firewalls)

Add the following lines to /etc/tor/torrc

ReachableDirAddresses *:80
ReachableORAddresses *:443

Configure tsocks (for quick and easy tunneling of applications on the fly without configuring)

Edit /etc/tsocks.conf and edit the server lines at the bottom to look like this

server = 127.0.0.1
server_type = 4
server_port = 9050

Once you have done that, you can now use tsocks to start applications tunneled like so:

tsocks <command>

You can also start a tunneled subshell like this:

tsocks

Configuring individual applications for Tor

HTTP Proxy: localhost:9118 (this configuration is preferred for privacy but does not work for all applications).

SOCKS 4 Proxy: localhost:9050 (don’t use this if the above works due to the potential for DNS request leakage).

Alternatively, you can use tsocks to start applications that don’t support configuration (also can suffer from DNS leakage).

I hope you enjoyed this post!

This post was submitted to ProBlogger’s ‘how to’ writing project. Make sure to check it out and read the useful ‘how to’ posts others have written.

Linux/BSD/Unix Install Instructions [Tor]


28 Responses to “How to set up Tor and Privoxy on Ubuntu Linux”  

  1. No Comments

Leave a Reply