APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

squidGuard


© September 2001 Tony Lawrence

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.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> Squid Guard

2 comments


Inexpensive and informative Apple related e-books:

iOS 10: A Take Control Crash Course

Take Control of Automating Your Mac

Take Control of Parallels Desktop 12

Are Your Bits Flipped?

iOS 8: A Take Control Crash Course




More Articles by © 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

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

------------------------


Printer Friendly Version

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





640K ought to be enough for anybody. (Bill Gates)




Linux posts

Troubleshooting posts


This post tagged:

Linux

Networking

Reviews

SME

Security

Squid

Unix

Web/HTML



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode





SCO Unix Sales, Support, & Service

Phone:  707-SCO-UNIX (707-726-8649Toll Free: 833-SCO-UNIX (833-726-8649)
www.SCOsales.com