How To Filter Web Contents With DansGuardian In Ubuntu

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

 

dansguardian_ubuntu_two

 

Type dansguardian in the search box, then press enter. Select the package, then click the package and install

 

dansguardian_ubuntu_two_1

 

Next type squid in the search box again and install it.

 

dansguardian_ubuntu_two_2

 

Click the Apply button to install both packages.

 

dansguardian_ubuntu_two_3

 

 

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

dansguardian_ubuntu_two_4

 

Next type the # just before the select line in the file or delete the entire line. The click File Save and close out.

 

dansguardian_8

 

 

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.

 

dansguardian_9

 

 

Configuring Firefox:

 

Open Firefox, then click Edit –> Preferences

 

dansguardian_10

 

Next select the Advanced tab and select Network. Then click Settings.

 

dansguardian_11

 

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.

 

dansguardian_12

 

 

Next press Alt-F2 on your keyboard, then type the commands below

 

dansguardian_ubuntu_two_5

 

Next, run the below commands separately:

sudo dansguardian restart
sudo /etc/init.d/squid restart

 

Try searching for inappropriate contents, and you should get access deny message but other websites will work just fine.

 

dansguardian_14 

 

 

Next, press Alt-F2 on our keyboard, then type the commands below:

gksu gedit /etc/rc.local

dansguardian_ubuntu_two_6

 

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

 

dansguardian_ubuntu_two_7

 

That’s all. Enjoy and come back soon.

Reblog this post [with Zemanta]

View Comments to “How To Filter Web Contents With DansGuardian In Ubuntu”

  1. jason says:

    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!)

  2. solexTZ says:

    great tutorial – i have just configured this on my friends icafe

  3. james says:

    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 )

  4. 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.

  5. 3n!Gma says:

    very nice!
    i have a question: how can i use dansguardian to filter and control a windows machine?

  6. 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/

  7. kabeza says:

    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

  8. It is possible but requires more work. I think this might be a good solution. http://www.liberiangeek.net/2010/04/how-to-setu...

  9. kabeza says:

    Thanks! will give a look

  10. Eric Nelson says:

    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?

  11. Eric Nelson says:

    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!

Leave a Reply

blog comments powered by Disqus
Twitter Delicious Facebook Digg Stumbleupon Favorites More