Wednesday, April 28, 2010

Installing and configuring Dansguardian with Squid proxy in linux rhel5 or centos5


 Installing and configuring squid internet proxy can be found in the following link.

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 installation check whether all the pre-requisites are met.

  1. gcc
  2. rpm-build
  3. kernel-devel
  4. pcre – [perl compatible regular expressions] , pcre-devel

Download the package from

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, and restart the DG as below
# /usr/local/dans/sbin/dansguardian -Q
You can no more access

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.


  1. Thats nice helping guied yar good yar

  2. Dear, All

    how block Gtalk and Yahoo messanger
    in squid proxy server
    and how to set authentication password in squid

  3. No Idea dear. Authentication can be done using .htpasswd

    Dont remember the exact steps. Not been to squid recently.

  4. hi,
    i have dansguardian in my network and blocked facebook throught banned sitelis. Now i have to give access this site to 2 ips in my network and donot want to let them access other sites which are blocked.


Be nice. That's all.