I have been trying to get DansGuardian to force everyone to go through Google SafeSearch when they are searching using any Google service (images, web search, code, whatever). DansGuardian, as of 188.8.131.52, includes the ability to run Regular Expressions on urls, body content, and headers.
Google allows you to force safesearch by adding the option safe=on or safe=active to the url. In addition, Google has an undocumented feature that allows you to set “VerySafeSearch” by adding the safe=vss option. What I am trying to do is use the regexp url function to add this option.
DansGuardian has an example included that should force VSS on image search. Sadly, it does not work. Here is what I came up with:
These two lines need to be put into the file /etc/dansguardian/lists/urlregexplist. This should force Google VSS on all Google search services (except youtube) in all country codes (e.g. google.uk, google.cn, google.ca).
There are two parts to this. The first line removes the option that disables safe search: safe=off. The second line adds the safe=vss option.
The basic replacement syntax is this:
Simply, what is found between the first set of quotes is replaced by what is found in the second. For more details about regular expressions and danguardian see the following sites:
Perl Regular Expressions
Regular Expressions in Perl
Regular Expressions in DansGuardian
If anyone finds a way to get around this, please comment.