Tuesday, May 22, 2012

How To Configure Squid Proxy with Dansguardian

How to configure squid internet proxy can be found in the following link. 

HowTo Configure Squid

After configuring the Squid proxy, You can install and configure Dansguardian.

Dansguardian is an add-on for squid. DG is having lots of list files to which we can add and remove entries easily. No need to write complicated ACL rules in squid.

DG acts as a filter point before the squid. We have to configure two things in DG. A filter port and filter IP. The web request will be hitting this port first. Then only it'll goto squid.

The data flows is as shown below.

From web browser request will hit iptables rules first. Then the DG and then Squid.

The package can be downloaded from site dansguardian.org.Before installation check whether all the pre-requisites are met.

pcre – [perl compatible regular expressions] , pcre-devel

Download the package from dansguardian.org
#wget http://dansguardian.org/downloads/2/Stable/dansguardian-

Extract the package:
#tar zxvf dansguardian-

Change Directory:
#cd dansguardian-

Configure the software:
We are going to install the DG in the location /usr/local/dans
#./configure --prefix=/usr/local/dans


#make install

Installation is over. Now we can see four directories created under /usr/local/dans/
etc - configuration files
sbin - deamons
share - language and display settings
var - log files

Edit the configuation file:
#vi /usr/local/dans/etc/dansguardian/dansguardian.conf

filterip =
filterport = 9999
proxyip =
proxyport = 8080

Give the proper permissions and ownership:
#chown -R root:squid /usr/local/dans/var/log/dansguardian/
#chmod -R 777 /usr/local/dans/var/log/dansguardian/

Now start the server.
# /usr/local/dans/sbin/dansguardian
Change the proxy IP & Port in browser to filter IP and Port

Important files:
#cd /usr/local/dans/etc/dansguardian/lists/
All the files in this directory are the Access control files..

For example:
in bannedsitelist if you add youtube.com, and restart the DG as below
# /usr/local/dans/sbin/dansguardian -Q
You can no more access youtube.com

in bannedphraselist if you add and restart the DG
Then you can no more view any page which contains the word football.

Use and syntax is explained with each and every file in lists.

DISCLAIMER: The information provided on this website comes without warranty of any kind and is distributed AS IS. Every effort has been made to provide the information as accurate as possible, but no warranty or fitness is implied. The information may be incomplete, may contain errors or may have become out of date. The use of this information described herein is your responsibility, and to use it in your own environments do so at your own risk.

Copyright © 2012 LINUXHOWTO.IN


  1. This essay is very attractive and useful. Your this work defiantly helps other.
    access Mp3skull in UK

  2. This post is really informative, by using software to unblock YouTube is the best way to access any social site and specially hotspot shield is the best to use for block websites.
    Mp3lemon UK proxy

  3. Great post yet I was thinking about whether you could compose a litte more on this subject? I"d be exceptionally grateful in the event that you could expound a tad bit further. Value it! VPN to Unblock British TV