Privoxy tor squid

From openSUSE

Contents

How to Privoxy, Tor and Squid

Author: [Swerdna]

Modified for OpenSuse 11.0 by marsii 7 July 2008

Firstly why all 3?

Privoxy is a web proxy with advanced filtering capabilities this will remove a lot of internet Junk and has plenty of configurations.

Tor is a an anonymizer which will use a random path to anything you are viewing/using if configured.

Squid is web proxy cache.

Now using all 3 possibly will not give you complete anonymity, which isn't the purpose of this how to any way. As this link [http://wiki.noreply.org/noreply/TheOnionRouter/SquidProxy]

NOTE! See [SquidWarning]. I don't know wheter these problems still remains (July 2008).

For the quick howto go to the bottom.

Installation

Privoxy

Firstly we setup Privoxy. Using Yast -> Software -> Software Management Search for Privoxy and install. (You need a Yast installation source OSS repo)

Check if the privoxy is executing:

  • Restart your computer and log in as the root user
  • Open a terminal window and execute: ps -ef | grep privoxy
  • You should get a listing with two lines:
    • The privoxy process
    • The "grep privoxy" process
  • If you only get "grep privoxy", then the proxy is not started!

In my Opensuse 11.0 installation, I had to add the privoxy to the "init" startup. Script "/etc/init.d/privoxy" was installed, but no links were set in the "rc?.d" directories to the script.

Check your privoxy installation by connecting to: http://p.p/

If you have trouble with privoxy, see FAQ at: http://www.privoxy.org/

We need to do one more thing. As root user, edit file: "/var/lib/privoxy/etc/config"

Search for the line: "forward-socks4a".

#      To chain Privoxy and Tor, both running on the same system,
#      you should use the rule:
#  
forward-socks4a / localhost:9050 .

We need to uncomment it by deleting the # So it looks as the above.

So know we have Privoxy working but as its pointing to Tor we now need to set this up

Tor

Install from binaries

If you are using OpenSuse 11.0 do as follows:

  • Open YAST, select "Install Software"
  • Search for "Tor" in the "Network" group
  • If you don't find "Tor", you have to add a Repository where it is. For example you can use the "Packman" repository
  • Install "Tor"

If you are using older OpenSuse version, I don't know if above procedure works.

You can also install from rpm file, which can be got from here [http://tor.eff.org/dist/rpm-suse/]

Install from source

Firstly tar.gz method. As the rpm wished to downgrade things I acquired the tar.gz from here [tor site] I choose the latest alpha.

So before we go further you also need zlib-devel, zlib-devel-32bit(If 64bit), openssl-devel and openssl-devel-32bit(If 64bit) once again OSS repo. If not already installed I guess also gcc

So now we have all the bits we need to use the normal routine. Extract contents tar etc or with ark cd into top folder and ..

./configure
make
make install

I actually used checkinstall as a replacement for make install to assist in the removal if needed. Which after running will tell that it has created an rpm at /usr/src/packages/RPMS/arch/tor-version.arch.rpm so now you can choose the way you wish to install it. rpm -i, yast etc..

If we did this with the tar.gz

Configuration

Also see the install procedure at: [Install Tor on Linux ]

We need to configure some bits.

  • Log in as root
  • Check if there is a torrc file. The location of the rcfile directory has changed with newer tor versions:
    • Tor version 0.1.2.19 (available July 2008): /etc/tor
    • Older tor versions: /usr/local/etc/tor
  • Check if in the directory is a file: torrc
  • If not, execute: cp (path_to_tor_rc_dircetory)/torrc.sample (path_to_tor_rc_dircetory)/torrc

So now we have Privoxy running with Tor.

Firstly go to Yast -> System -> System Services(Runlevel)

So here we need to enable Tor and Privoxy to run, click on Expert Mode find privoxy and highlight click on set/reset and enable service. Start service and do the same for Tor(If its there on a 32bit rpm install.)

So now if we set our proxy we'd have them both running and running at boot.

NOTE If tar.gz install As I found with the default tar.gz install this is slightly different. We don't seem to have it in runlevel, so for a simple fix we create a little script, as user.

#!/bin/bash/
tor

Save as what you like in /home/user/.kde/Autostart/

chmod u+x or left click and modify permissions ticking is executable. END NOTE

So now if you use 127.0.0.1:8118 as proxy you'll be surfing with them both in my experience this is a little slow to speed things up we now install/configure squid so we have a local cache to use.

Squid

NOTE! See [SquidWarning]. I don't if these problems still remains (July 2008).

So once again Yast -> Software -> Software Management search and install Squid.

As the config script is well documented we'll just do the important bits. Just need to make sure these bits are uncommented(Del #) or added as needed.

Open editor i.e kdesu kate /etc/squid/squid.conf

http_port 127.0.0.1:3128  #line 73ish (Listening port)
cache_dir ufs /var/cache/squid 1000 16 256 #line 990ish 
(where and size cache is first number caches size mb 2nd folders 3rd sub-folders)
#line 2390ish (Check the acl bit and configure as needed, the defaults should be good to go)
http_access allow localhost    # line 2520ish (Need to just make sure this is uncommented)
cache_peer localhost parent 8118 7 no-query default  #line 2627ish (These are the important ones)
visible_hostname localhost #line 2827ish
never_direct allow all  #line 3363ish (Force the use of privoxy/tor in all cases)

Back to Runlevels So here we need to enable Squid to run, click on Expert Mode find squid and highlight click on set/reset and enable service.

Browser

Next to configure the browser to use them. Konqueror ->Settings -> Configure Konqueror -> Proxy -> Manually specify the proxy Settings -> 127.0.0.1 port number 3128

Firefox -> Edit -> Preferences -> Advanced -> Network -> Connection -> Settings -> Select Manual --> 127.0.0.1 port 3128 Make sure No proxy is empty i.e remove local host and 127.0.0.1

For Firefox you can enable a Tor Button that'll give you the option to Disable as Needed from here. addons.mozilla.org/firefox/2275/ https://addons.mozilla.org/firefox/2275/

For additional config for Privoxy type http://config.privoxy.org/ into your browser or amend the Config files. Readmes here for Privoxy http:/www.privoxy.org/user-manual/index.html http://www.privoxy.org/user-manual/index.html Readme for Squid http:/www.deckle.co.za/squid-users-guide/Main_Page http://www.deckle.co.za/squid-users-guide/Main_Page Readme for Tor http:/tor.eff.org/documentation.html.en http://tor.eff.org/documentation.html.en

Plenty of reading material and this is just to get you started. The above docs will help you with the various configs you may wish for.


Quick and Dirty

The quick and dirty for all those that didn't want to read.

Install squid, tor, privoxy (Need OSS source) Tor from here tor.eff.org/dist http://tor.eff.org/dist/ Also will need zlib-devel, zlib-devel-32bit(If 64bit), openssl-devel and openssl-devel-32bit(If 64bit) if using tar.gz

Uncomment /var/lib/privoxy/etc/config at line 1053 forward-socks4a / localhost:9050 .

If tar.gz cp /usr/local/etc/tor/torrc.sample /usr/local/etc/tor/torrc otherwise check /etc/tor/torrc exists

If tar.gz create script ~/.kde/Autostart

#!/bin/bash
tor

chmod u+x file

Check /etc/squid/squid.conf has these

http_port 127.0.0.1:3128  #line 73ish (Listening port)
cache_dir ufs /var/cache/squid 1000 16 256 #line 990ish  
(where and size cache is first number caches size mb 2nd folders 3rd sub-folders)
# line 2390ish (Check the acl bit and configure as needed, the defaults should be good to go)
http_access allow localhost    # line 2520ish (Need to just make sure this is uncommented)
cache_peer localhost parent 8118 7 no-query default  #line 2627ish (These are the important ones)
visible_hostname localhost #line 2827ish
never_direct allow all  #line 3363ish (Force the use of privoxy/tor in all cases)

Enable Runlevels

Configure Browser to use proxy. On 127.0.0.1:3128


Credits: [FeatherMonkey]