DansGuardian

DansGuardian is an award winning Open Source web content filter which currently runs on Linux, FreeBSD, OpenBSD, NetBSD, Mac OS X, HP-UX, and Solaris. It filters the actual content of pages based on many methods including phrase matching, PICS filtering and URL filtering.

Installation
Install the necessary PCRE libraries:

yum install pcre-devel

Download the latest version of DansGuardian:

cd /extra/src
wget http://usmirror.dansguardian.org/downloads/2/Stable/dansguardian-2.10.1.1.tar.gz
tar zxf dansguardian-2.10.1.1.tar.gz
cd dansguardian-2.10.1.1

Configure it:

./configure
make
make install

Change the ownership on the log file directory:

chown nobody:nobody /usr/local/var/log/dansguardian

To test it out, you can run it directly from the shell:

dansguardian

Redirect your web traffic to port 8080 of the Squid/Dansguardian machine and watch /usr/local/var/log/dansguardian/access.log for activity.

Blacklists

cd /usr/local/etc/dansguardian/lists/blacklists

Blacklist files can be downloaded from a variety of sources:

  • Malware Patrol
  • URLBlacklist.com
  • Shalla's Blacklists
    cd /extra/src
    wget http://www.shallalist.de/Downloads/shallalist.tar.gz
    tar zxf shallalist.tar.gz
    cd BL

    Copy which blacklists you want from /extra/src/BL to /usr/local/etc/dansguardian/lists/blacklists

Edit /usr/local/etc/dansguardian/lists/bannedurllist and /usr/local/etc/dansguardian/lists/bannedsitelist to add the lists you want used. There are examples in those files.
Restart DansGuardian:

dansguardian -g

Automatic startup
We're going to use daemontools. If you haven't already, install daemontools.

Create a directory for the Dansguardian service:

mkdir -m 1755 /var/service/dansguardian
cd /var/service/dansguardian

Create the /var/service/dansguardian/run script, making sure to change the servername:

#!/bin/sh
exec /usr/local/sbin/dansguardian -N 2>&1

Make the script executable:

chmod 755 run

Our log script comes from John Simpson's:

mkdir -m 755 log
cd log
wget http://qmail.jms1.net/scripts/service-any-log-run
mv service-any-log-run run
chmod 755 run

Finally, add the service to daemontools by creating the symbolic link in /service

ln -s /var/service/dansguardian /service/dansguardian

Confirm that the service is running:

svstat /service/dansguardian /service/dansguardian/log

Logging
MySAR & Squid, edit /usr/local/etc/dansguardian/dansguardian.conf and change:

forwardedfor = on

Edit /usr/loca/squid/etc/squid.conf and add:

forwarded_for on

Recent Updates

  • 8 months 2 weeks ago
    1.27.2 update
  • 8 months 3 weeks ago
    Drupal 10/11 config
  • 8 months 3 weeks ago
  • PHP
    8 months 3 weeks ago
    PHP 8.3.11 and AlmaLinux
  • 8 months 4 weeks ago
    New version of Pound