Wednesday, April 28, 2010

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

Sponsored Links
 Installing and configuring squid internet proxy can be found in the following link.
http://helpinlinux.blogspot.com/2010/04/how-to-install-and-configure-squid.html

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.

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

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


Steps:
Download the package from dansguardian.org

Extract the package:
#tar zxvf dansguardian-2.10.0.3.tar.gz

Change Directory:
#cd dansguardian-2.10.0.3

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


Compile:
#make

Install:
#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 = 192.168.0.21
filterport = 9999
proxyip = 192.168.0.21
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.
Sponsored Links

9 comments:

  1. Thats nice helping guied yar good yar

    ReplyDelete
  2. Dear, All

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

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

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

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

    ReplyDelete

Be nice. That's all.