Privoxy: installation and setup (Linux)
$ sudo apt-get install privoxy
Now we can check, that privoxy is installed:
$ systemctl status privoxy
It will show you something like this:
By default, privoxy will be installed to /etc/privoxy:
How to start privoxy:
$ /etc/init.d/privoxy start
or this way:
$ systemctl start privoxy
If you have troubles with rights, you can try to do it with sudo:
$ sudo /etc/init.d/privoxy start
$ sudo systemctl start privoxy
As a result you'll see something like this:
Setting up privoxy
Now, let's check file config in /etc/privoxy and search for listen-address param:
This address is important, because proxy server will "hear" and analyze traffic through this address. You can change it to your own, for example 192.168.0.1:8118 (you can change port 8118 to your own, as well).
Now we should tell the system, that all the internet traffic should go through out local proxy (privoxy).
Proxy settings in linux can be system or can be set in browswer.
System setting of proxy server could be set up in system settings:
$ export http_proxy="http://127.0.0.1:8118"$ export https_proxy="https://127.0.0.1:8118"$ export ftp_proxy="http://127.0.0.1:8118"
Browser proxy settings
This is the way to set up proxy settings in Mozilla Firefox:
In order to check, that browser is working with proxy settings, we can go to url : http://p.p/
Then you will see this:
Now we see, that privoxy is installed, working and now we can filter the traffic (for example, block sites).
Blocking webs with privoxy
There're two ways of blocking websites: we can create whitelist (block all webs and allow to visit only several of them), or blacklist (block only certain webs).
Actually, privoxy is very powerful and flexible tool to block not only particular webs, but part of webs, selected media type etc. In this article we'll focus only on simple blocking urls. Other features of privoxy could be found on official website of privoxy.
Let's open file user.action (I'm using vim editor, but you can open this file in graphic interface as well)
$ sudo vim /etc/privoxy/user.action
and add urls to block in this particular format:
then we save the file and restarting privoxy:
$ sudo /etc/init.d/privoxy restart
And then let's try to resolve this url:
Well done. It's blocked!
To make a whitelist of allowed webs using privoxy, we can block all webs and then allow only selected one to visit: