Most blogs you read online will feature articles about web content filtering in Windows systems and not many will tell you the same in Linux systems. This blog is going to show you how to install a content filtering system in Ubuntu. There are few to choose from, and one good one is DansGuardian web content filtering proxy for Linux systems. DanGuardian uses many methods to filter contents including, URL and Domain filtering, phrase filtering, file extensions filtering and many more.
In this short tutorial, I’ll show you how to install DansGuardian content filtering system in Ubuntu and help protect yourself from contents online you find disgusting.
Installing and configuring DanGuardian:
To get started, type Alt-F2 on your keyboard and enter the below commands, then click Run.
gksu synaptic
Type dansguardian in the search box, then press enter. Select the package, then click the package and install
Next type squid in the search box again and install it.
Click the Apply button to install both packages.
Next press Alt-F2 keys on the keyboard again to open the Run Application, then enter the below commands and click Run
gksu gedit /etc/dansguardian/dansguardian.conf
Next type the # just before the select line in the file or delete the entire line. The click File Save and close out.
Next type Alt-F2 again, and type the commands below, then click Run:
gksu gedit /etc/squid/squid.conf
Next, find the line and add transparent right after it.
Configuring Firefox:
Open Firefox, then click Edit –> Preferences
Next select the Advanced tab and select Network. Then click Settings.
Choose Manual proxy configuration and type 127.0.0.1 in the HTTP Proxy box and Port 8080. Then select Use this proxy server for all protocols and click OK.
Next press Alt-F2 on your keyboard, then type the commands below
Next, run the below commands separately:
sudo dansguardian restartsudo /etc/init.d/squid restart
Try searching for inappropriate contents, and you should get access deny message but other websites will work just fine.
Next, press Alt-F2 on our keyboard, then type the commands below:
gksu gedit /etc/rc.local
Edit the rc.local file to run this command everytime your computer starts:
/bin/bash /sbin/iptables -t net -A OUTPUT -p tcp -m owner ! --uid-owner squid --dport 80 -j REDIRECT --to-port 8080
That’s all. Enjoy and come back soon.



![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=29d32002-447a-4b66-9e28-2355fada8db3)














Great tutorial – thanks. A couple of things though – firstly a small typo (sudo dansquardian restart) and secondly that the iptables command is one time only and needs scripting for startup (which on 10.04 seems to be the tricky bit!)
great tutorial – i have just configured this on my friends icafe
i have a question regarding this,, since we edited the network connection in the browser, isnt it easy enough for the user to disable it? ….
not unless you have it installed in a ubuntu server right?( with 2 nics )
That's why you configure iptables to redirect all traffic through the proxy, so if someone changes the configuration settings in the browser, they will not be able to connect to anything except reconfigure proxy in the browser.
very nice!
i have a question: how can i use dansguardian to filter and control a windows machine?
dansgaurdian does not work on Windows machines. You probably want to read this post for Windows machines :http://www.liberiangeek.net/2010/03/protect-your-kids-online-with-k9-web-protection-for-free/
Hi
Great tutorial. I'd like to know if I can do this on Ubuntu server (old PC) for having a web filter in a little 10 PC company's lan…I want to block p2p, messengers, p0rn, MU, RS, etc.
Should I connect the ubuntu to dsl modem, and then make every pc browse through old pc? should I go through an additional guide for doing this? Thanks
It is possible but requires more work. I think this might be a good solution. http://www.liberiangeek.net/2010/04/how-to-setu...
This link also should help
http://www.liberiangeek.net/2010/04/opendns-the...
Thanks! will give a look
I'm having trouble. When I test it, it's not working. I had to replace 'sudo /etc/init.d/squid restart' with 'sudo service squid restart', but I don't believe that's the problem.
Any help?
Eric Nelson again. I had to reinstall Ubuntu (enough was going wrong, so I had to reinstall), so I tried again, and it worked.
Thanks for the excellent walkthrough!