D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Dansguardian

 

Austin Gossmeyer wrote:
> I am using ubuntu 9.04
>
Right, I've installed Ubuntu 9.04 Desktop on a virtual machine (in 
VirtualBox on top of Ubuntu 9.04).  It should essentially be the same on 
Ubuntu Server too.

What I did was install the squid, dansguardian.  I did this through a 
terminal with the following command (although you could use Synaptic):

sudo apt-get install dansguardian squid

I said yes to the additional packages which were to be installed.

When Dansguardian and Squid is installed, Dansguardian is unconfigured.  
That is you need to go into the config file and at least remove the 
UNCONFIGURED line from the configuration.  Now I'm not sure if you're 
running the Desktop version of Ubuntu or the server version, or which 
your favourite editor is (my favourite is vi), but anyway, you need to 
open /etc/dansguardian/dansguardian.conf in an editor as root.

If you're running the Desktop version of Ubuntu then the easiest way of 
editing this file is to press Alt F2 which opens the Run Application 
box, then enter the following:

gksudo gedit /etc/dansguardian/dansguardian.conf

You'll be prompted for your password.

If you prefer to do it via a terminal, or if you're running on the 
server version of Ubuntu then run the following command:

sudo nano /etc/dansguardian/dansguardian.conf

If you go down to line 5 in the configuration file you'll see something 
like this:

UNCONFIGURED - Please remove this line after configuration

Basically add a # before the UNCONFIGURED word to comment it out (I 
prefer to do this than removing the line, just in case I need to disable 
Dansguardian again).

Now you can look through the configuration file and make any changes if 
need be such as changing the log file location, I didn't make any 
changes myself.

When you've made any changes you want to make, save the file (click the 
Save button in gedit or in nano press Control X which will prompt you to 
save any changes, press Y to this question and then press enter to save 
changes).

Now restart Squid and Dansguardian...

Open a terminal window (if you're on Ubuntu desktop) and enter the 
following:

sudo invoke-rc.d squid restart
sudo invoke-rc.d dansguardian restart

You may be asked for your password when you run the first sudo command.

Squid will take a few seconds to restart, Dansguardian is pretty instant 
(took about a second to restart for me).

Now comes the fun bit, testing it out.

Basically you need to configure the proxy on a browser to look at the 
Dansguardian machine.  I did this in Firefox by going into the 
Preferences, clicking on Advanced, going into the network tab and then 
clicking on settings.

I selected Manual Proxy configuration and entered the IP address of the 
proxy machine and the port 8080.

Then try browsing to a site which should be blocked (simply going to 
google and searching for 'boobs' was enough for Dansguardian to block 
it).  You should hopefully see an Access Denied page and it will give a 
reason why the page was blocked (in this case the Weighted Phrase Limit 
was exceeded in the category Pornography).

You can tweak the settings for the filters in the 
/etc/dansguardian/dansguardian.conf and 
/etc/dansguardian/dansguardianf1.conf files (just use the instructions 
above for editing these files).  I left these as default for when my 
kids browse the net but you can tweak them to enable and disable 
categories as you wish.

To troubleshoot that machines are trying to access the proxy, open up a 
terminal and run the following command:

sudo tail -f /var/log/squid/access.log

and then try browsing to a web site on the machine that is configured to 
use the proxy.  You should get some output on the screen which relates 
to what site you're browsing to.  If you do then Squid is probably working.

Then try:

sudo tail -f /var/log/dansguardian/access.log

and again try doing a google search for something which should be 
blocked (for instance, doing a google search for the word boobs).  It 
should then come up with the URL of Google in the log plus the warning 
message about the page being blocked, plus a whole load of words which 
it uses for blocking.  If this happens then Dansguardian should be 
working fine.

Hopefully this will be of use to you.

You'll need to make sure you point the machines to look at the IP 
address of the Dansguardian machine at port 8080.  Dansguardian listens 
for requests on port 8080, then talks to Squid using port 3128.  If you 
configure the machines to use the Dansguardian IP address but use port 
3128 you will get an access denied message.

Now with regards to Dansguardian as a transparent proxy, I haven't gone 
this on Ubuntu but I did find a link which may be helpful, it's a guide 
written by someone who is involved with Ubuntu Christian Edition, it 
looks like it covers setting up a proxy machine which sits in between 
the connection from the ISP and the rest of the network.  I haven't 
tried it myself but it might give you a few pointers anyway: 
http://taksuyama.com/?p=16#more-16

Hope this all helps.

Rob



-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html