In the beginning was the command line..

Free Web Content Filtering

, posted: 15-Jun-2006 17:57

Thought I'd show you all how shocking my english is and try to document how I setup web content filtering at a Primary School, without paying a cent for software. It's a real home-brew solution compared to commerical software but it's very fast and does the job just as well.

    Basic Linux/UNIX knowledge (apt-get install doesn't count)
    An Internet connection
    Any Linux system with GCC

    1. Download and/or setup squid. (might blog how to do this another day)
    2. Goto and download the DG source code. Extract it (tar zxvf <filename>)
    3. configure dansguardian (./configure --help to look at compilation options)
    4. if you downloaded DG version you might need to modify some code to make it work. hopefully this will be fixed in the next release. in the src/ directory, using your favorite text editor make the following changes to ListContainer.cpp
Line number 50: #define GRAPHENTRYSIZE 128 //was 64
Line number 968: ppos = pos << 7; //was 8
    5. save those changes and run make in the top level of the sources directory.
    6. as root, make install

DG is quite easy to configure and the configuration files installed when you 'make install' are well commented.
start by editing dansguardian.conf which with default configure options will be installed in /usr/local/etc/dansguardian
the vital settings to change are:
filterport = # 8080 is a good choice
proxyip = #this must be where your squid is serving
proxyport = # 3128 is squid default
accessdeniedaddress = #it usually helps to have apache running on the filtering server, set an apache hostname in here that has this file in it's cgi-bin directory.

BTW when configuration files are read, # denotes a comment until the line's end.
to start dansguardian run /usr/local/sbin/dansguardian
to stop dansguardian run /usr/local/sbin/dansguardian -q

when you first start DG, wait 30 seconds then do a 'ps aux' to double check it is running, then try it with your proxy clients.
if it worked, congratulations! if only beer was this free =)

If you want to elaborate on this software, checkout
they have a script that updates DG to the latest blacklists available and is reasonably priced with a free trial.

Good luck, Linux hackers.

Other related posts:
Sound the alarm: ACTA negotiations delayed
I'm not protesting S92a
watch Al Jazeera on XBMC

Comment by juha, on 16-Jun-2006 09:44

Good post... the only thing I'd say is to use packages for your Linux distro instead of source tarballs if possible (easier managemenet). Also, it's worth allocating a decent amount of disk space for squid and ideally, keeping it on its own spindle using the diskd file system for better performance.

Comment by Alex Ott, on 23-Jun-2006 22:47

DG's code is very bad :-( I had worked with it - it has brocken design, possible memory leaks, and hard to improve with new functionality. It working primarily with English texts only, and rely on the information from headers. But this information is often not enougth to make proper check. For example, some of servers serve .iso files as text/plain :-( Is better to look to the swiftsurf or WebCleaner or project Poesia. But most of free content filtering solutions, require many hand work to support blacklists, word phrases, and has bad report facilities

Add a comment

Please note: comments that are inappropriate or promotional in nature will be deleted. E-mail addresses are not displayed, but you must enter a valid e-mail address to confirm your comments.

Are you a registered Geekzone user? Login to have the fields below automatically filled in for you and to enable links in comments. If you have (or qualify to have) a Geekzone Blog then your comment will be automatically confirmed and placed in the moderation queue for the blog owner's approval.

Your name:

Your e-mail:

Your webpage:

barf's profile

Stuart MacIntosh
New Zealand

Hello world.