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 https://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 porn {
domainlist porn/domains
expressionlist porn/expressions
urllist porn/urls
}
dest gambling {
domainlist gambling/domains
urllist gambling/urls
}
acl {
default {
pass local !in-addr !untrusted !porn !gambling all
redirect https://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:
192.168.2.8
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:
amgolf.com basketballnews.com cypriankeyes.com flowgo.com go.com golfcourse.com golfdigest.com golfonline.com golfriverbend.com golfweb.com jcrew.com patriots.com pgatour.com shakerhills.com ticketmaster.com weather.com espn.com espn.go.com fleet.com fleetcenter.com sportingnews.com cdnow.com hockeysfuture.com homelink.fleet.com ediets.com
The "porn" and "gambling" databases were supplied by the RPM's. Good examples of using expressions are found in the porn/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
http_proxy="https://e-smith.yourdomain.com:3128" 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 https://www.mail-archive.com/devinfo%40lists.e-smith.org/msg04815.html
Got something to add? Send me email.
More Articles by Tony Lawrence © 2011-03-18 Tony Lawrence
640K ought to be enough for anybody. (Bill Gates)
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) ?
------------------------
Printer Friendly Version
SquidGuard Copyright © September 2001 Tony Lawrence
Have you tried Searching this site?
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
Printer Friendly Version