squidguard & google safe search

Trying to turn on Google Safe Search for all of your clients behind your Squid+squidGuard server? Well, you aren’t the first and probably won’t be the last, but it’s not that hard, once you find the right words to plug in to Google.

You need a little patch that Eric Harrison (of MESD fame) wrote. If you are already using his recent RPMs, you already have the patch. If you are compiling from source, you’ll need to grab the source RPM from his testing area and extract the squidguard-sed.patch file. Once you’ve applied that patch to the squidGuard 1.2.0 source and recompiled, you should be able to use the following code snippets in squidGuard.conf to append “safe=strict” to all google urls:
rewrite google {
s@(google.com/search.*q=.*)@1&safe=strict@i
s@(google.com/images.*q=.*)@1&safe=strict@i
s@(google.com/groups.*q=.*)@1&safe=strict@i
s@(google.com/news.*q=.*)@1&safe=strict@i
# log google
}

and in your acl section add:
default {
# for google to be in "safe mode"
rewrite google

Then, there are fewer inappropriate pictures available via google.

Thanks to Eric’s post to K12OSN and a Louisiana library page with a full squidGuard.conf linked for examples.

3 thoughts on “squidguard & google safe search

  1. it might be worth noting that google.ca and google.co.uk would be unaffected. but then, if the kids want their unsafe searching that much…

  2. The rules below block even the .ca and .uk sites from being searched without strict safe search. Used Dag Weirs Rpm for
    Squidguard. May be overkill but they work.

    s@safe=images@safe=strict@ir
    s@safe=off@safe=strict@ir
    s@http://froogle.google.com/froogle_advanced_search.*@http://froogle.com@i
    s@(.*.google..*)(/imghp?&hl)@imghp?&safe=strict&hl@ir
    s@(.*.google..*)(.safe.off)@images?&safe=strict&@ir
    s@(.*.google..*)(/images?tab)@images?&safe=strict&tab@ir
    s@(.*.google..*)(/images?q)@images?&safe=strict&q@ir
    s@(.*.google..*)(/images?as_q)@images?&safe=strict&as_q@ir
    s@(.*.google..*)(/images?hl)@images?&safe=strict&hl@ir
    s@(.*.google..*)(/search?hl)@search?&safe=strict&hl@ir
    s@(.*.google..*)(/search?as_q)@search?&safe=strict&as_q@ir
    s@(.*.google..*)(/news?t)@news?&safe=strict&t@ir
    s@(.*.google..*)(/news?hl)@news?&safe=strict&h1@ir
    s@(.*.google..*)(/froogle?tab)@froogle?&safe=strict&tab@ir
    s@(.*.google..*)(/froogle?q)@froogle?&safe=strict&q@ir

  3. Pingback: Problema/consulta - consulta squidGuard

Leave a Reply

Your email address will not be published. Required fields are marked *