squidGuard works with Squid to block access to sites by domain, ip address or even keywords. It is very flexible, even allowing you to block access at certain times of day and allow it at others, and even to define groups within your organization that have different access privileges.

This all works because Squid allows you to define a redirector program that gets to examine each requested web page before Squid goes and gets it. If the redirector decides to send you somewhere else, that's what happens.

I installed squidGuard on an E-Smith server. I used a partially packaged set of rpm's from http://netsourced.com/servers/docs/squidguard-howto.html. Complete directions for the installation are there.

However, although these rpm's appeared to install, it didn't work. Just a little bit of investigation showed that although everything was indeed installed correctly, the supplied conf file ( /usr/local/squidGuard/squidGuard.conf ) didn't quite match the distribution. A little editing fixed it, and a "squid -k reconfigure" started the squidGuard processes running.

Check that with "ps -e | grep squid"- you should see several squidGuard processes running. The number is controlled by the "redirect_children" entry in the squidlog.conf (remember that on E-Smith this file gets created by scripts in /etc/e-smith/templates - the rpm's take care of that for you).

I also needed to adjust the redirect cgi (this is the page that people get redirected to when their access is blocked by squidGuard)- the rpm correctly installs it in the primary/cgi-bin directory (where e-smith html files live), but the supplied conf file doesn't point there.

Here's the configuration file I used:

logdir /usr/local/squidGuard/log
dbhome /usr/local/squidGuard/db

dest local {
        domainlist      local/domains

dest untrusted {
   urllist      untrusted/urls

dest *redacted* {
   domainlist   *redacted*/domains
   expressionlist       *redacted*/expressions
   urllist      *redacted*/urls

dest gambling {
   domainlist   gambling/domains
   urllist      gambling/urls

acl {
         default {
             pass  local !in-addr !untrusted !*redacted* !gambling all
             redirect http://e-smith.customer.com/cgi-bin/blocked.cgi?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&url=%u          }

Each "dest" entry refers to a directory in /usr/local/squidGuard/db. Each directory can have lists of domains, precise url's or expressions ( see squidGuard for details ) that will be blocked or passed. For example, the file "local/domains" just contains one line:

That's the local address of the internal web server. Normally, raw ip addreses are always blocked ( by the "!in-addr" in the "pass" section of the acl ), but we want to let the internal machine be accessed that way. The "local" database accomplishes that.

The "untrusted" database contains specific sites that this client wants to block:


The "*redacted*" and "gambling" databases were supplied by the RPM's. Good examples of using expressions are found in the *redacted*/expressions files; I'm not going to reproduce that here because it would cause this page to get indexed for searches I don't want it to show up in!

I tested with lynx by setting

export http_proxy

but you could of course also test from any client that is using the proxy. Keep in mind that if you are using NAT (the default on E-smith), any user that knows how to NOT use the proxy can just bypass all this entirely.

Also see http://www.mail-archive.com/devinfo%40lists.e-smith.org/msg04815.html

Got something to add? Send me email.


Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Tony Lawrence

Tue Dec 9 12:47:17 2008: 4886   anonymous

Could you help me out?
I'm trying to integrate squidguard with LDAP, but since CN has white space in between, squidguard is going into emergency mode.

Tue Dec 9 14:13:04 2008: 4888   TonyLawrence

Did you try quoting the spaces with "\"'s or URL escaping them (%20) ?

Kerio Connect Mailserver

Kerio Samepage

Kerio Control Firewall

Have you tried Searching this site?

Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us