I'm going to attempt to show anyone who is interested how I got Tor up and running on my FreeBSD system.
NOTE: I am most definitely not a security expert. I just did this out of interest really, so comments/criticisms are welcome. That said, I hope someone finds this as useful as I would have before attempting to set up Tor + web proxy.
I will edit and update this HOWTO as needed to reflect issues and suggestions.
So here is what we'll do:
Here goes...
1. Install tor:
Copy the sample configuration file and prepare to edit it:
We want tor to start as a daemon so find /usr/local/etc/tor/torrc and uncomment the line that reads:
Let's have it run at boot by adding the following to /etc/rc.conf:
2. Let's install and configure our web proxy:
Polipo:
We'll start with Polipo. Install Polipo:
Copy the sample configuration file, and get ready to edit it:
The config file is very well-commented, so I will list only the lines uncommented or changed. The config file should explain well what they mean. For a more complete list of options, run:
Find /usr/local/etc/polipo/config and uncomment or change the following lines as necessary:
Let's start the polipo service:
Now, let's have it run at boot by adding the following to /etc/rc.conf:
That should be enough for Polipo.
NOTE: Polipo needs to be restarted for any changes to take effect.
Privoxy:
Let's look at how to install and set up www/privoxy:
Install privoxy:
Now, let's have it run at boot by adding the following to /etc/rc.conf:
To start Privoxy manually, and copy the necessary config files run:
Privoxy's config files should be copied to usr/local/etc/privoxy.
If you installed Privoxy as package and are using the default configuration, you have to make sure the directory /var/run/privoxy exists and is owned by privoxyrivoxy.
Let's edit the config file to use Privoxy with Tor.
Uncomment the lines:
NOTE the trailing "dot".
If you want to use Tor ONLY for .onion sites, use the following instead:
That should be enough to get it up and working.
3. Let's configure Firefox to use Tor and your web proxy of choice.
First, start Firefox with
When you have your new profile, go to --> Preferences --> Advanced --> Network --> Settings
Now choose "manual proxy configuration". Enter "127.0.0.1" into the HTTP Proxy box, and choose port "8118". Click "use this proxy for all protocols". Click OK.
That should be enough to get you onto the Tor network. However, you should really install the following addons too:
NoScript
HTTPSEverywhere
Ghostery
AdBlock Plus
Here is a good visual example of why you should use Tor with HTTPS.
Hidden Settings
There are some other "hidden" settings we can change to improve privacy. In the address bar, type "about:config". This will show you all the options available to you.
If you choose to use SOCKS5 in your web proxy configuration, instead of SOCKS4a, you should also make sure that you don't have a DNS leaks problem. As stated above, type the following into your address bar:
Enter the following in the search bar:
Make sure this is set to "true" - it should look like this:
Now find "Network.http.sendRefererHeader" and change the value to suit you. Here are the possible values and what they mean:
I chose "0".
You may also want to change the "User agent" of your browser, although this may result in a few broken web pages.
To change the user agent in Firefox, go to "about:config" and right-click on the page. Select "New" and select "String". Enter the following "general.useragent.override". Then enter your Useragent of choice. A nice list can be found here.
Here are some more things you may change:
Set "browser.cache.disk.enable" to false
Set "browser.cache.memory.enable" to false.
Set "browser.privatebrowsing.autostart" to true
Set "browser.search.defaultenginename" to "Startpage HTTPS"
Set "browser.search.selectedEngine" to "Startpage HTTPS"
Set "network.cookie.cookieBehavior" to 2 (disable cookies)
Set "privacy.clearOnShutdown.cookies" to true
Set "network.http.sendRefererHeader" to 0 (zero)
Set "network.proxy.socks_remote_dns" to true
Set "general.useragent.override" to a common useragent
Set "browser.sessionstore.privacy_level" to 2
Also consider adding "net.inet.ip.random_id=1" in /etc/sysctl.conf because it prevents traffic analysis that exploits sequential IP IDs.
4. Test your setup
Go to Tor check to see if you're connected to the network.
Test your anonymity here and here.
Check your browser fingerprint here (unique is bad when it comes to anonymity).
Hope that helps someone out there!
NOTE: I am most definitely not a security expert. I just did this out of interest really, so comments/criticisms are welcome. That said, I hope someone finds this as useful as I would have before attempting to set up Tor + web proxy.
I will edit and update this HOWTO as needed to reflect issues and suggestions.
So here is what we'll do:
- Install and configure security/tor.
- Install and configure your web proxy of choice (www/polipo or www/privoxy).
- Configure our browser to use the installed applications.
- Test that it works.
Here goes...
1. Install tor:
# portmaster security/tor
Copy the sample configuration file and prepare to edit it:
# cp /usr/local/etc/tor/torrc.sample /usr/local/etc/tor/torrc
We want tor to start as a daemon so find /usr/local/etc/tor/torrc and uncomment the line that reads:
Code:
RunAsDaemon1
Let's have it run at boot by adding the following to /etc/rc.conf:
Code:
tor_enable="YES"
2. Let's install and configure our web proxy:
Polipo:
We'll start with Polipo. Install Polipo:
# portmaster www/polipo
Copy the sample configuration file, and get ready to edit it:
# cp /usr/local/etc/polipo/config.sample /usr/local/etc/polipo/config
The config file is very well-commented, so I will list only the lines uncommented or changed. The config file should explain well what they mean. For a more complete list of options, run:
polipo -v
.Find /usr/local/etc/polipo/config and uncomment or change the following lines as necessary:
Code:
proxyAddress = "127.0.0.1"
proxyPort = 8118
allowedClients = 127.0.0.1
allowedPorts = 1-65535
proxyName = "localhost"
cacheIsShared = false
socksParentProxy = "localhost:9050"
socksProxyType = socks4a
chunkHighMark = 819200
objectHighMark = 128
diskCacheRoot = ""
disableLocalInterface = true
disableConfiguration = true
localDocumentRoot = ""
dnsUseGethostbyname = yes
disableVia=falsecensoredHeaders = from, accept-language, x-pad, link
censorReferer = maybe
daemonise = true
logSyslog = true
maxConnectionAge = 5m
maxConnectionRequests = 120
serverMaxSlots = 8
serverSlots = 2
tunnelAllowedPorts = 1-65535
Let's start the polipo service:
# /usr/local/etc/rc.d/polipo start
Now, let's have it run at boot by adding the following to /etc/rc.conf:
Code:
polipo_enable="YES"
That should be enough for Polipo.
NOTE: Polipo needs to be restarted for any changes to take effect.
Privoxy:
Let's look at how to install and set up www/privoxy:
Install privoxy:
# portmaster www/privoxy
Now, let's have it run at boot by adding the following to /etc/rc.conf:
Code:
privoxy_enable="YES"
To start Privoxy manually, and copy the necessary config files run:
# /usr/local/etc/rc.d/privoxy forcestart
Privoxy's config files should be copied to usr/local/etc/privoxy.
If you installed Privoxy as package and are using the default configuration, you have to make sure the directory /var/run/privoxy exists and is owned by privoxyrivoxy.
Let's edit the config file to use Privoxy with Tor.
Uncomment the lines:
Code:
# Set the listen address to 127.0.0.1:8118
listen-address 127.0.0.1:8118
# forward privoxy to TOR
forward-socks4a / 127.0.0.1:9050 .
If you want to use Tor ONLY for .onion sites, use the following instead:
Code:
forward-socks4a .onion localhost:9050 .
That should be enough to get it up and working.
3. Let's configure Firefox to use Tor and your web proxy of choice.
First, start Firefox with
firefox -P
to get into the profile manager. Create a new profile for Tor browsing (as you won't want to use it all the time, especially when logging into Google, Facebook, etc.).When you have your new profile, go to --> Preferences --> Advanced --> Network --> Settings
Now choose "manual proxy configuration". Enter "127.0.0.1" into the HTTP Proxy box, and choose port "8118". Click "use this proxy for all protocols". Click OK.
That should be enough to get you onto the Tor network. However, you should really install the following addons too:
NoScript
HTTPSEverywhere
Ghostery
AdBlock Plus
Here is a good visual example of why you should use Tor with HTTPS.
Hidden Settings
There are some other "hidden" settings we can change to improve privacy. In the address bar, type "about:config". This will show you all the options available to you.
If you choose to use SOCKS5 in your web proxy configuration, instead of SOCKS4a, you should also make sure that you don't have a DNS leaks problem. As stated above, type the following into your address bar:
about:config
Enter the following in the search bar:
network.proxy.socks_remote_dns
Make sure this is set to "true" - it should look like this:
Code:
network.proxy.socks_remote_dns true
Now find "Network.http.sendRefererHeader" and change the value to suit you. Here are the possible values and what they mean:
Code:
0 – Disable referrer.
1 – Send the Referer header when clicking on a link, and set document.referrer for the following page.
2 – Send the Referer header when clicking on a link or loading an image.
I chose "0".
You may also want to change the "User agent" of your browser, although this may result in a few broken web pages.
To change the user agent in Firefox, go to "about:config" and right-click on the page. Select "New" and select "String". Enter the following "general.useragent.override". Then enter your Useragent of choice. A nice list can be found here.
Here are some more things you may change:
Set "browser.cache.disk.enable" to false
Set "browser.cache.memory.enable" to false.
Set "browser.privatebrowsing.autostart" to true
Set "browser.search.defaultenginename" to "Startpage HTTPS"
Set "browser.search.selectedEngine" to "Startpage HTTPS"
Set "network.cookie.cookieBehavior" to 2 (disable cookies)
Set "privacy.clearOnShutdown.cookies" to true
Set "network.http.sendRefererHeader" to 0 (zero)
Set "network.proxy.socks_remote_dns" to true
Set "general.useragent.override" to a common useragent
Set "browser.sessionstore.privacy_level" to 2
Also consider adding "net.inet.ip.random_id=1" in /etc/sysctl.conf because it prevents traffic analysis that exploits sequential IP IDs.
4. Test your setup
Go to Tor check to see if you're connected to the network.
Test your anonymity here and here.
Check your browser fingerprint here (unique is bad when it comes to anonymity).
Hope that helps someone out there!
Last edited: