<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.ledhed.net/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.ledhed.net/index.php?action=history&amp;feed=atom&amp;title=SquidGuard.conf_Reference</id>
		<title>SquidGuard.conf Reference - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.ledhed.net/index.php?action=history&amp;feed=atom&amp;title=SquidGuard.conf_Reference"/>
		<link rel="alternate" type="text/html" href="https://wiki.ledhed.net/index.php?title=SquidGuard.conf_Reference&amp;action=history"/>
		<updated>2026-04-08T15:35:33Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.2</generator>

	<entry>
		<id>//wiki.ledhed.net/index.php?title=SquidGuard.conf_Reference&amp;diff=2989&amp;oldid=prev</id>
		<title>Ledhed: Created page with &quot;I found this page to be very detailed. I'm relisting its content for redundancy purposes. Please see: http://squidguard.shalla.de/config/   == squidguard.conf reference ==  Th...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.ledhed.net/index.php?title=SquidGuard.conf_Reference&amp;diff=2989&amp;oldid=prev"/>
				<updated>2013-09-29T21:13:39Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;I found this page to be very detailed. I&amp;#039;m relisting its content for redundancy purposes. Please see: http://squidguard.shalla.de/config/   == squidguard.conf reference ==  Th...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;I found this page to be very detailed. I'm relisting its content for redundancy purposes.&lt;br /&gt;
Please see: http://squidguard.shalla.de/config/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== squidguard.conf reference ==&lt;br /&gt;
 The configuration file&lt;br /&gt;
 &lt;br /&gt;
 The default path for the squidGuard configuration file is &amp;quot;/usr/local/squidGuard/squidGuard.conf&amp;quot; but another default can be set at compile time, and can be changed at runtime. From here we'll use squidGuard.conf for short.&lt;br /&gt;
&lt;br /&gt;
 Note: The number of configuration options and the flexibility may look overwhelming. Don't panic! Concentrate on the options that suits your needs. Start with a simple working configuration and extend as your needs and experience grows. Don't try to solve everything in your first attempt..&lt;br /&gt;
 In general&lt;br /&gt;
 The Structure&lt;br /&gt;
 &lt;br /&gt;
 The recommended structure for squidGuard.conf is:&lt;br /&gt;
&lt;br /&gt;
    Path declarations 	 (i.e. logdir and dbhome) 	 (optional)&lt;br /&gt;
    Time space declarations 	 (i.e. time zones) 	 (optional)&lt;br /&gt;
    Source group declarations 	 (i.e. clients) 	 (optional)&lt;br /&gt;
    Destination group declarations 	 (i.e. URLs) 	 (optional)&lt;br /&gt;
    Rewrite rule group declarations 		 (optional)&lt;br /&gt;
    Access control rule declarations 		 (required)&lt;br /&gt;
 &lt;br /&gt;
 Note: No forward references are allowed! Within this strong limitation you may actually chose any structure you prefer. &lt;br /&gt;
Reserved words&lt;br /&gt;
 &lt;br /&gt;
 The following words are reserved in squidGuard.conf and should be avoided in declaration names:&lt;br /&gt;
 &lt;br /&gt;
       acl             fri             outside         sun             urllist &lt;br /&gt;
       anonymous       friday          pass            sunday          user &lt;br /&gt;
       date            fridays         redirect        sundays         userlist &lt;br /&gt;
       dbhome          ip              rew             thu             wed &lt;br /&gt;
       dest            log             rewrite         thursday        wednesday &lt;br /&gt;
       destination     logdir          sat             thursdays       wednesdays &lt;br /&gt;
       domain          logfile         saturday        time            weekly &lt;br /&gt;
       domainlist      mon             saturdays       tue             within &lt;br /&gt;
       else            monday          source          tuesday         &lt;br /&gt;
       expressionlist  mondays         src             tuesdays        &lt;br /&gt;
    &lt;br /&gt;
 &lt;br /&gt;
 In adition is:&lt;br /&gt;
    # 	used to start a comment. Everything from the # to the end of line is ignored.&lt;br /&gt;
    { } 	used to delimit the start and end of a group declaration.&lt;br /&gt;
    - 	often used to declare a range (i.e. &amp;quot;from-to&amp;quot; or &amp;quot;from - to&amp;quot;).&lt;br /&gt;
 &lt;br /&gt;
 Declaration names/lables&lt;br /&gt;
 &lt;br /&gt;
 Declaration names/lables have the same limitations as domainnames except _ is allowed too (i.e. [-_.a-z0-9]+). Reserved words should be avoided as they may cause unpredictable results.&lt;br /&gt;
 Breaking long lines&lt;br /&gt;
 &lt;br /&gt;
 Generally you may break a (long) line by repeating the leading keyword. Repeated lines of the same type within a class will bee joined when the rule trees are built. So:&lt;br /&gt;
 &lt;br /&gt;
 src foo {&lt;br /&gt;
    ip 1.2.3.4&lt;br /&gt;
    ip 2.3.4.5 &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 is equivalent to:&lt;br /&gt;
 &lt;br /&gt;
 src foo {&lt;br /&gt;
    ip 1.2.3.4 2.3.4.5 &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 Path declarations&lt;br /&gt;
 &lt;br /&gt;
 The default for the following directories may be overruled by:&lt;br /&gt;
    logdir 	defines the diretory for the standard logfiles &amp;quot;squidGuard.error&amp;quot; and &amp;quot;squidGuard.log&amp;quot;, and the base for relative logfilenames in log rules. The default is &amp;quot;/usr/local/squidGuard/logs&amp;quot; but another default can be set at compile time.&lt;br /&gt;
    dbhome 	defines the base for relative list filenames. The default is &amp;quot;/usr/local/squidGuard/db&amp;quot; but another default can be set at compile time.&lt;br /&gt;
&lt;br /&gt;
 Although the defaults can be used silently it is recommended to declare these explicitly for clarity. For instance:&lt;br /&gt;
 &lt;br /&gt;
     logdir /usr/local/squidGuard/logs&lt;br /&gt;
     dbhome /usr/local/squidGuard/db&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Time space declarations&lt;br /&gt;
&lt;br /&gt;
Time spaces, or zones if you prefer, are declared by:&lt;br /&gt;
&lt;br /&gt;
time name {&lt;br /&gt;
    specification&lt;br /&gt;
    specification&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
where specification can be any reasonable combination of:&lt;br /&gt;
&lt;br /&gt;
Days of the week with an optional time constraint for each day:&lt;br /&gt;
    weekly {smtwhfa} [HH:MM-HH:MM] &lt;br /&gt;
    or &lt;br /&gt;
    weekly dayname [...] [HH:MM-HH:MM] &lt;br /&gt;
    where s=sun, m=mon, t =tue, w=wed, h=thu, f=fri, a=sat. &lt;br /&gt;
    and dayname is one of:&lt;br /&gt;
&lt;br /&gt;
        &amp;quot;mon&amp;quot;, &amp;quot;monday&amp;quot;, &amp;quot;mondays&amp;quot;, (synonymous) &lt;br /&gt;
        &amp;quot;tue&amp;quot;, &amp;quot;tuesday&amp;quot;, &amp;quot;tuesdays&amp;quot;, (synonymous) &lt;br /&gt;
        &amp;quot;wed&amp;quot;, etc. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    For instance for monday to friday, mornings and evenings:&lt;br /&gt;
&lt;br /&gt;
        weekly mtwhf 00:00-08:00&lt;br /&gt;
        weekly mtwhf 17:00-24:00 &lt;br /&gt;
&lt;br /&gt;
    and for saturdays and sundays:&lt;br /&gt;
&lt;br /&gt;
        weekly as &lt;br /&gt;
        or &lt;br /&gt;
        weekly saturday&lt;br /&gt;
        weekly sunday &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Time of the day:&lt;br /&gt;
    weekly * HH:MM-HH:MM &lt;br /&gt;
    which is just a special case of weekly.&lt;br /&gt;
&lt;br /&gt;
    For instance:&lt;br /&gt;
&lt;br /&gt;
        weekly * 00:00-08:00&lt;br /&gt;
        weekly * 17:00-24:00 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dates with an optional time constraint for each date:&lt;br /&gt;
    date YYYY-MM-DD [...] [HH:MM-HH:MM ...] &lt;br /&gt;
    or &lt;br /&gt;
    date YYYY.MM.DD [...] [HH:MM-HH:MM ...] &lt;br /&gt;
    where the preferred of the two dateformats is just a matter of personal taste.&lt;br /&gt;
&lt;br /&gt;
    For instance for the Ascension Day and the Whit Monday of 1999:&lt;br /&gt;
&lt;br /&gt;
        date 1999.05.13 1999.05.24 &lt;br /&gt;
&lt;br /&gt;
    or for the Ash Wednesday afternoon of 1999:&lt;br /&gt;
&lt;br /&gt;
        date 1999.03.31 12:00-24:00 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Date range with an optional time constraint for each day:&lt;br /&gt;
    date YYYY-MM-DD-YYYY-MM-DD [HH:MM-HH:MM ...] &lt;br /&gt;
    or &lt;br /&gt;
    date YYYY.MM.DD-YYYY.MM.DD [HH:MM-HH:MM ...]&lt;br /&gt;
&lt;br /&gt;
    For instance for the Easter of 1999:&lt;br /&gt;
&lt;br /&gt;
        date 1999.04.01-1999.04.05 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Date wildcard with an optional time constraint:&lt;br /&gt;
    date YYYY-MM-DD [HH:MM-HH:MM ...] &lt;br /&gt;
    or &lt;br /&gt;
    date YYYY.MM.DD [HH:MM-HH:MM ...] &lt;br /&gt;
    where YYYY, MM and DD may be an asterisk, &amp;quot;*&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
    For instance for the New Year's Day:&lt;br /&gt;
&lt;br /&gt;
        date *.01.01 &lt;br /&gt;
&lt;br /&gt;
    and for the Christmas Eve:&lt;br /&gt;
&lt;br /&gt;
        date *.12.24 12:00-24:00 &lt;br /&gt;
&lt;br /&gt;
Note1: The numeric formats are strict (I.e. 08:00 not 8:00 for HH:MM etc).&lt;br /&gt;
Note2: Overlaps are OK, and the result is the union.&lt;br /&gt;
&lt;br /&gt;
Thus for instance a Norwegian time space definition for leisure time including holidays and short days could look something like:&lt;br /&gt;
&lt;br /&gt;
     time leisure-time {&lt;br /&gt;
	  weekly   * 00:00-08:00  	      # night&lt;br /&gt;
	  weekly   * 17:00-24:00  	      # evening&lt;br /&gt;
	  weekly   fridays 16:00-17:00	      # weekend&lt;br /&gt;
	  weekly   saturdays sundays	      # weekend&lt;br /&gt;
	  date	   *.01.01		      # New Year's Day&lt;br /&gt;
	  date	   *.05.01		      # Labour Day&lt;br /&gt;
	  date	   *.05.17		      # National Day&lt;br /&gt;
	  date	   *.12.24 12:00-24:00	      # Christmas Eve&lt;br /&gt;
	  date	   *.12.25		      # Christmas Day&lt;br /&gt;
	  date	   *.12.26		      # Boxing Day&lt;br /&gt;
	  date	   1999.03.31 12:00.24:00     # Ash Wednesday&lt;br /&gt;
	  date	   1999.04.01-1999.04.05      # Easter&lt;br /&gt;
	  date	   1999.05.13 1999.05.24      # Ascension Day and Whitsun&lt;br /&gt;
	  date	   2000.04.19 12:00.24:00     # Ash Wednesday y2000&lt;br /&gt;
	  date	   2000.04.20-2000.04.24      # Easter y2000&lt;br /&gt;
	  date	   2000.06.01 2000.06.12      # Ascension Day and Whitsun y2000&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Source group declarations&lt;br /&gt;
&lt;br /&gt;
Source group, or client groups if you prefer, are declared by:&lt;br /&gt;
&lt;br /&gt;
src|source name [within|outside time_space_name] {&lt;br /&gt;
    specification&lt;br /&gt;
    specification&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
src|source name within|outside time_space_name {&lt;br /&gt;
    specification&lt;br /&gt;
    specification&lt;br /&gt;
    ...&lt;br /&gt;
} else {&lt;br /&gt;
    specification&lt;br /&gt;
    specification&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
    src and source are synonymous; use the one you prefer.&lt;br /&gt;
    within and outside sets an optional time constraint to the definition.&lt;br /&gt;
    the else part refers to the time constraint.&lt;br /&gt;
&lt;br /&gt;
Time constraints on clientgroups can be used to make these clients unknown (i.e. use the default rule) within or outside a given time space. Or it can be used to define a usergroup that is expected to move between two locations at given times (like office/home)&lt;br /&gt;
&lt;br /&gt;
Specification can be any reasonable combination of:&lt;br /&gt;
&lt;br /&gt;
IP addresses and/or ranges (multiple):&lt;br /&gt;
    ip xxx.xxx.xxx.xxx [...] &lt;br /&gt;
    or &lt;br /&gt;
    ip xxx.xxx.xxx.xxx/nn [...] &lt;br /&gt;
    or &lt;br /&gt;
    ip xxx.xxx.xxx.xxx/mmm.mmm.mmm.mmm [...] &lt;br /&gt;
    or &lt;br /&gt;
    ip xxx.xxx.xxx.xxx-yyy.yyy.yyy.yyy [...] &lt;br /&gt;
    where:&lt;br /&gt;
&lt;br /&gt;
        xxx.xxx.xxx.xxx is an IP address (host or net, i.e. 10.11.12.13 or 10.11.12.0),&lt;br /&gt;
        /nn a net prefix (i.e. /23),&lt;br /&gt;
        mmm.mmm.mmm.mmm is a netmask (i.e. 255.255.254.0) and&lt;br /&gt;
        yyy.yyy.yyy.yyy is a host address (must be &amp;gt;= xxx.xxx.xxx.xxx) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
IP address/range list (single):&lt;br /&gt;
    iplist filename &lt;br /&gt;
    where:&lt;br /&gt;
&lt;br /&gt;
        filename is either a path relative to dbhome or an absolute path (i.e. /full/path) to a database file. &lt;br /&gt;
        the iplist file format is simply addresses and/or networks separated by a newline as above but without the ip keyword. Thus an iplist for all the private addresses could look something like (Though the preferred use of &amp;quot;iplist&amp;quot; over &amp;quot;ip&amp;quot; is for long lists of WS/PC addresses primarily to reduce the size of the configuration file):&lt;br /&gt;
&lt;br /&gt;
            10.0.0.0/8&lt;br /&gt;
            172.16.0.0/12&lt;br /&gt;
            192.168.0.0/16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Domains (multiple):&lt;br /&gt;
    domain foo.bar [...]  *) &lt;br /&gt;
    where:&lt;br /&gt;
&lt;br /&gt;
        foo.bar is a domain (zone) the domain name (from a reverse lookup on the client addresses) belongs to (directly or as a subdomain). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Users (multiple):&lt;br /&gt;
    user foo [...]  **) &lt;br /&gt;
    where:&lt;br /&gt;
&lt;br /&gt;
        foo is a username (from a ident/RFC-931 lookup to the client. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User list (single):&lt;br /&gt;
    userlist filename **) &lt;br /&gt;
    where:&lt;br /&gt;
&lt;br /&gt;
        filename is either a path relative to dbhome or an absolute path (i.e. /full/path) to a database file. &lt;br /&gt;
        the userlist file format is simply RFC-931 usernames, optionally followed by a `:' and a comment (i.e. /etc/passwd or a .htpasswd file may be used) separated by a newline as in the user declaration but without the user keyword. Thus a userlist could look something like:&lt;br /&gt;
&lt;br /&gt;
            root&lt;br /&gt;
            administrator&lt;br /&gt;
            foo&lt;br /&gt;
            bar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Special clientgroup translation log (single):&lt;br /&gt;
    log|logfile [anonymous] filename &lt;br /&gt;
&lt;br /&gt;
    where:&lt;br /&gt;
&lt;br /&gt;
        filename is either a path relative to logdir or an absolute path (i.e. /full/path) to a logfile where translation for this group should be logged. If the anonymous option is specified the logged info is somewhat anonymized to protect the individual. &lt;br /&gt;
&lt;br /&gt;
*) The use of domain match for clientsgroups requires Squid is set up to do revese lookups on clients.&lt;br /&gt;
**) The use of username match for clientsgroups requires Squid is set up to do ident/RFC-931 lookups.&lt;br /&gt;
&lt;br /&gt;
Note1: Overlaps are OK, and the groups are matched in the order they are defined.&lt;br /&gt;
Note2: The logical operator between different types within a group (ip/domain/user) is AND. The default is any. Thus one of each defined type must match but undefined types are ignored.&lt;br /&gt;
&lt;br /&gt;
Thus an administrator client group could look something like:&lt;br /&gt;
&lt;br /&gt;
     src admin within leisure-time {&lt;br /&gt;
	  ip	   10.11.12.13 10.11.12.26    # The administrators home WS/PCs&lt;br /&gt;
	  domain   ras.teledanmark.no	      # The RAS domain&lt;br /&gt;
	  user	   root administrator foo bar # The administrators login names&lt;br /&gt;
     } else {&lt;br /&gt;
	  ip	   10.1.1.15 10.1.2.17        # The administrators office WS/PCs&lt;br /&gt;
	  domain   lan.teledanmark.no	      # The LAN domain&lt;br /&gt;
	  user	   root administrator foo bar # The administrators login names&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Destination group declarations&lt;br /&gt;
&lt;br /&gt;
Destination group, or target groups if you prefer, are declared by:&lt;br /&gt;
&lt;br /&gt;
dest|destination name [within|outside time_space_name] {&lt;br /&gt;
    specification&lt;br /&gt;
    specification&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
dest|destination name within|outside time_space_name {&lt;br /&gt;
    specification&lt;br /&gt;
    specification&lt;br /&gt;
    ...&lt;br /&gt;
} else {&lt;br /&gt;
    specification&lt;br /&gt;
    specification&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
    dest and destination are synonymous.&lt;br /&gt;
    within and outside sets an optional time constraint to the definition.&lt;br /&gt;
    the else part refers to the time constraint.&lt;br /&gt;
&lt;br /&gt;
Time constraints on destinationgroups can be used to make these groups void (i.e. ignored) within or outside a given time space.&lt;br /&gt;
&lt;br /&gt;
Specification can be any combination of zero or one of each of:&lt;br /&gt;
&lt;br /&gt;
Domainlist (single):&lt;br /&gt;
    domainlist filename &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
URL list (single):&lt;br /&gt;
    urllist filename &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Expressionlist (single):&lt;br /&gt;
    expressionlist filename &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    where:&lt;br /&gt;
&lt;br /&gt;
        filename is either a path relative to dbhome or an absolute path (i.e. /full/path) to a database file. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Special destinationgroup redirect URL (single):&lt;br /&gt;
    redirect [302:]url &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Special destinationgroup redirect log (single):&lt;br /&gt;
    log|logfile [anonymous] filename &lt;br /&gt;
&lt;br /&gt;
    where:&lt;br /&gt;
&lt;br /&gt;
        filename is either a path relative to logdir or an absolute path (i.e. /full/path) to a logfile where redirects caused by match of this group should be logged. If the anonymous option is specified the logged info is somewhat anonymized to protect the individual. &lt;br /&gt;
&lt;br /&gt;
Note1: Overlaps are OK, and the groups are matched in the order they are listed in the pass declaration in for the actual clientgroup.&lt;br /&gt;
Note2: The logical operator between different types (domainlist/urllist/expressionlist) is OR. The default is void. Thus the destinationgroup is matched if one of the defined types match. Within a destination group the test order is domainlist, urllist, and expressionlist.&lt;br /&gt;
&lt;br /&gt;
Thus an entertainment destination group declaration could look something like:&lt;br /&gt;
&lt;br /&gt;
     dest not-business-related outside leisure-time {&lt;br /&gt;
	  domainlist	 entertainment/domains&lt;br /&gt;
	  urllist	 entertainment/urls&lt;br /&gt;
	  expressionlist entertainment/expressions&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Rewrite rule group declarations&lt;br /&gt;
&lt;br /&gt;
Rewrite rule groups, or rewrite rule sets if you prefer, are declared by:&lt;br /&gt;
&lt;br /&gt;
rew|rewrite name [within|outside time_space_name] {&lt;br /&gt;
    substitution&lt;br /&gt;
    substitution&lt;br /&gt;
    ...&lt;br /&gt;
    [logging]&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
rew|rewrite name within|outside time_space_name {&lt;br /&gt;
    substitution&lt;br /&gt;
    substitution&lt;br /&gt;
    ...&lt;br /&gt;
    [logging]&lt;br /&gt;
} else {&lt;br /&gt;
    substitution&lt;br /&gt;
    substitution&lt;br /&gt;
    ...&lt;br /&gt;
    [logging]&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
    rew and rewrite are synonymous.&lt;br /&gt;
    within and outside sets an optional time constraint to the definition.&lt;br /&gt;
    the else part refers to the time constraint.&lt;br /&gt;
&lt;br /&gt;
Time constraints on rewritegroups can be used to make these groups functional within or outside a given time space only; Like redirect to local copies within peek business hours.&lt;br /&gt;
&lt;br /&gt;
Substitution is sed style (multiple):&lt;br /&gt;
&lt;br /&gt;
    s@from@to@[irR] &lt;br /&gt;
where:&lt;br /&gt;
    from is a regular expression that will be replaced with the string to. &lt;br /&gt;
    the i option makes the from part match case insensitive. &lt;br /&gt;
    the r option makes the redirection visible to the user with a HTTP code 302 - Moved Temporarily (The default is to make Squid silently fetch the alternate URL). &lt;br /&gt;
    the R option makes the redirection visible to the user with a HTTP code 301 - Moved Permanently. &lt;br /&gt;
&lt;br /&gt;
and logging is (single):&lt;br /&gt;
    log|logfile [anonymous] filename &lt;br /&gt;
    where:&lt;br /&gt;
&lt;br /&gt;
        filename is either a path relative to logdir or an absolute path (i.e. /full/path) to a logfile where succeded rewrites should be logged. If the anonymous option is specified the logged info is somewhat anonymized to protect the individual. &lt;br /&gt;
&lt;br /&gt;
Note1: Sed style substitutions uses regular expressions and thus slows down squidGuard more than B-tree lookups.&lt;br /&gt;
Note2: Suport for visible redirects (i.e. 302: URL prefix) is broken in some versions of Squid.&lt;br /&gt;
&lt;br /&gt;
A rewrite rule set declaration could look something like:&lt;br /&gt;
&lt;br /&gt;
     rew get-local {&lt;br /&gt;
	  s@.*/cb32e46.exe$@http://ftp/pub/www/client/windows/cb32e46.exe@r&lt;br /&gt;
	  s@.*/cc32e46.exe$@http://ftp/pub/www/client/windows/cc32e46.exe@r&lt;br /&gt;
	  s@.*/cp32e46.exe$@http://ftp/pub/www/client/windows/cp32e46.exe@r&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Access Control Lists&lt;br /&gt;
&lt;br /&gt;
The Access Control List, ACL, combies the previous definitions into distinct rulesets for each clientgroup:&lt;br /&gt;
&lt;br /&gt;
acl {&lt;br /&gt;
    sourcegroupname [within|outside timespacename] { &lt;br /&gt;
&lt;br /&gt;
    pass [!]destgroupname [...] &lt;br /&gt;
    [rew|rewrite rewritegroupname [...] &lt;br /&gt;
    [redirect [301:|302:]new_url] &lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    sourcegroupname within|outside timespacename { &lt;br /&gt;
&lt;br /&gt;
    pass [!]destgroupname [...] &lt;br /&gt;
    [rew|rewrite rewritegroupname [...] &lt;br /&gt;
    [redirect [301:|302:]new_url] &lt;br /&gt;
&lt;br /&gt;
    } else { &lt;br /&gt;
&lt;br /&gt;
    pass [!]destgroupname [...] &lt;br /&gt;
    [rew|rewrite rewritegroupname [...] &lt;br /&gt;
    [redirect [301:|302:]new_url] &lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    default [within|outside timespacename] { &lt;br /&gt;
&lt;br /&gt;
    pass [!]destgroupname [...] &lt;br /&gt;
    [rew|rewrite rewritegroupname [...] &lt;br /&gt;
    redirect [301:|302:]new_url &lt;br /&gt;
&lt;br /&gt;
    }[ else { &lt;br /&gt;
&lt;br /&gt;
    pass [!]destgroupname [...] &lt;br /&gt;
    [rew|rewrite rewritegroupname [...] &lt;br /&gt;
    redirect [301:|302:]new_url &lt;br /&gt;
&lt;br /&gt;
    ] &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Note: There may be no more than one acl block.&lt;br /&gt;
&lt;br /&gt;
The default rule set:&lt;br /&gt;
&lt;br /&gt;
The default section defines fallbacks for all acl rulesets. Thus if you define a rewrite rule here it will be used in acls where there are no rewrite rules defined. (i.e. the other acls inherits the definitions in the default acl optionally overruled by own definitions). The default rule set is used for all clients that match no clientgroup and for clientgroups with no acls declared.&lt;br /&gt;
&lt;br /&gt;
The pass rule:&lt;br /&gt;
&lt;br /&gt;
The pass rules declares destination groups that should pass for the actual client group. &amp;quot;!&amp;quot; is the NOT operator and indicates a destination group that should not pass (i.e. be redirected to the actual redirect URL).&lt;br /&gt;
Note: Pass rules ends with an implicit &amp;quot;all&amp;quot;. It is good practice to allways en the pass rules with either &amp;quot;all&amp;quot; or &amp;quot;none&amp;quot; to make them clear. Ie. use:&lt;br /&gt;
  pass good none&lt;br /&gt;
or&lt;br /&gt;
  pass good !bad all&lt;br /&gt;
Note: If there is a !group there must also be a redirect definition for eiter that destination group, the actual acl or the default acl. If you want some rules for unknown clients that should not apply to the other acls you should define a last clientgroup named &amp;quot;unknown&amp;quot; and with an IP range 0.0.0.0/0 (i.e. any), and put those rules in the &amp;quot;unknown&amp;quot; acl.&lt;br /&gt;
&lt;br /&gt;
Built in wildcard groups:&lt;br /&gt;
&lt;br /&gt;
The following are built in wildcard destination groups:&lt;br /&gt;
&lt;br /&gt;
in-addr&lt;br /&gt;
    !in-addr can be used to enforce the use of domainnames over IP addresses in the host part of URLs. in-addr is a fast equivalent to a group with the expressionlist &amp;quot;^[^:/]+://[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}($|[:/])&amp;quot;. &lt;br /&gt;
any&lt;br /&gt;
    matches any URL and is a fast equivalent to the expression &amp;quot;.*&amp;quot;. &lt;br /&gt;
all&lt;br /&gt;
    is a synonym to any. Use the one you prefer. &lt;br /&gt;
none&lt;br /&gt;
    is a fast equivalent to !any and should be used to terminate pass rules where only the listed destination groups should pass. &lt;br /&gt;
&lt;br /&gt;
The rewrite rule:&lt;br /&gt;
&lt;br /&gt;
The rewrite rules declares the substitution rulsets that applies to the actual acl.&lt;br /&gt;
&lt;br /&gt;
The redirect rule:&lt;br /&gt;
&lt;br /&gt;
The redirect rules declares the altenative URL to be used for blocked destination groups (!groups) for the actual acl.&lt;br /&gt;
Note: Inside an acl, this is a fallback used when there is no special redirect declared for the actual destination group, and the default redirect is the last resort.&lt;br /&gt;
&lt;br /&gt;
squidGuard can do runtime string substitutions in the redirectors. Therefor the character &amp;quot;%&amp;quot; has special meaning in the redirector URLs:&lt;br /&gt;
%a 	is replaced with IP address of the client.&lt;br /&gt;
%n 	is replaced with the domainname of the client or &amp;quot;unknown&amp;quot; if not available.&lt;br /&gt;
%i 	is replaced with the user ID (RFC931) or &amp;quot;unknown&amp;quot; if not available.&lt;br /&gt;
%s 	is replaced with the matched source group (client group) or &amp;quot;unknown&amp;quot; if no groups were matched.&lt;br /&gt;
%t 	is replaced with the matched destination group (target group) or &amp;quot;unknown&amp;quot; if no groups were matched.&lt;br /&gt;
%u 	is replaced with the requested URL.&lt;br /&gt;
%p 	is replaced with the REQUEST_URI, i.e. the path and the optional query string of %u, but note for convenience without the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
%% 	is replaced with a single &amp;quot;%&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Thus you can pass usefull information to a more or less intelligent CGI page:&lt;br /&gt;
&lt;br /&gt;
     http://proxy/cgi/squidGuard?clientaddr=%a&amp;amp;clientname=%n&amp;amp;clientident=%i&amp;amp;clientgroup=%s&amp;amp;destinationgroup=%t&amp;amp;url=%u&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
For a start, there is a sample of such a script in samples/squidGuard.cgi in the source tree.&lt;br /&gt;
The database&lt;br /&gt;
&lt;br /&gt;
squidGuard uses a database that can be devided into an unlimited number of distinct categories like &amp;quot;local&amp;quot;, &amp;quot;customers&amp;quot;, &amp;quot;vendors&amp;quot;, &amp;quot;banners&amp;quot;, &amp;quot;banned&amp;quot; etc. Each category may consist of separate unlimited lists of domains, URLs and/or regular expressions. For easy revision the lists are stored in separate plain text files that. The lists are for efficiency stored in in-memory-only B-trees at startup.&lt;br /&gt;
&lt;br /&gt;
Note: All URLs are converted to lowercase before match search. So the lists should not contain uppercase leters.&lt;br /&gt;
Domainlists&lt;br /&gt;
&lt;br /&gt;
The domainlist file format is simply domainnames/zonenames separated by a newline. The length of these lists have neglectable influence on the performance.&lt;br /&gt;
&lt;br /&gt;
For instance a start for a financial category:&lt;br /&gt;
&lt;br /&gt;
     amex.com&lt;br /&gt;
     asx.com.au&lt;br /&gt;
     bourse-de-paris.fr&lt;br /&gt;
     exchange.de&lt;br /&gt;
     londonstockex.co.uk&lt;br /&gt;
     nasdaq.com&lt;br /&gt;
     nyse.com&lt;br /&gt;
     ose.no&lt;br /&gt;
     tse.or.jp&lt;br /&gt;
     xsse.se&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Note: squidGuard will match any URL with the domainname itself an any subdomains and hosts (i.e. amex.com, www.amex.com, whatever.amex.com and www.what.ever.amex.com but not .*[^.]amex.com (i.e. aamex.com etc.)).&lt;br /&gt;
URLlists&lt;br /&gt;
&lt;br /&gt;
The urllist file format is simply URLs separated by newline but with the &amp;quot;proto://((www|web|ftp)[0-9]*)?&amp;quot; and &amp;quot;(:port)?&amp;quot; parts and normally also the ending &amp;quot;(/|/[^/]+\.[^/]+)$&amp;quot; part (i.e. ending &amp;quot;/&amp;quot; or &amp;quot;/filename&amp;quot;) choped off. (i.e. &amp;quot;http://www3.foo.bar.com:8080/what/ever/index.html&amp;quot; =&amp;gt; &amp;quot;foo.bar.com/what/ever&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
For instance a category for banned sites:&lt;br /&gt;
&lt;br /&gt;
     foo.com/~badguy&lt;br /&gt;
     bar.com/whatever/suspect&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Note: The removed parts above are ignored by squidGuard in URL matching. Thus all these URLs will match the above urllist:&lt;br /&gt;
&lt;br /&gt;
     http://foo.com/~badguy&lt;br /&gt;
     http://foo.com/~badguy/whatever&lt;br /&gt;
     ftp://foo.com/~badguy/whatever&lt;br /&gt;
     wais://foo.com/~badguy/whatever&lt;br /&gt;
     http://www2.foo.com/~badguy/whatever&lt;br /&gt;
     http://web56.foo.com/~badguy/whatever&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
but not:&lt;br /&gt;
&lt;br /&gt;
     http://barfoo.com/~badguy&lt;br /&gt;
     http://bar.foo.com/~badguy&lt;br /&gt;
     http://foo.com/~goodguy&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
New in 1.0.0 is the ability to do 1-1 redirects on url basis with &amp;quot;key new_url&amp;quot;. Thus as an alternative to using rewrites to redirect to local distributions you can have a destination group with an urllist like:&lt;br /&gt;
&lt;br /&gt;
     netscape.com/pub/communicator/4.51/english/windows/windows95_or_nt/complete_install/cc32e451.exe http://ftp.teledanmark.no/pub/www/client/windows/cc32e451.exe&lt;br /&gt;
     netscape.com/pub/communicator/4.51/english/windows/windows95_or_nt/base_install/cb32e451.exe http://ftp.teledanmark.no/pub/www/client/windows/cb32e451.exe&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
and an acl with pass ... !download .... This may be a faster alternative than using lots of s@from@to@ rewrites for 1-1 mapping since it will be faster to search the B-tree than perform a bunch of string edits.&lt;br /&gt;
Expressionlists&lt;br /&gt;
&lt;br /&gt;
The expressionlist file format is lines with regular expressions as described in regex(5). Of most interrest is:&lt;br /&gt;
. 	Matches any single character (use &amp;quot;\.&amp;quot; to match a &amp;quot;.&amp;quot;).&lt;br /&gt;
[abc] 	Matches one of the characters (&amp;quot;[abc]&amp;quot; matches a single &amp;quot;a&amp;quot; or &amp;quot;b&amp;quot; or &amp;quot;c&amp;quot;).&lt;br /&gt;
[c-g] 	Matches one of the characters in the range (&amp;quot;[c-g]&amp;quot; matches a single &amp;quot;c&amp;quot; or &amp;quot;d&amp;quot; or &amp;quot;e&amp;quot; or &amp;quot;f&amp;quot; or &amp;quot;g&amp;quot;.&lt;br /&gt;
&amp;quot;[a-z0-9]&amp;quot; matches any single letter or digit.&lt;br /&gt;
&amp;quot;[-/.:?]&amp;quot; matches any single &amp;quot;-&amp;quot; or &amp;quot;/&amp;quot; or &amp;quot;.&amp;quot; or &amp;quot;:&amp;quot; or &amp;quot;?&amp;quot;.).&lt;br /&gt;
? 	None or one of the preceding (&amp;quot;words?&amp;quot; will match &amp;quot;word&amp;quot; and &amp;quot;words&amp;quot;.&lt;br /&gt;
&amp;quot;[abc]?&amp;quot; matches a single &amp;quot;a&amp;quot; or &amp;quot;b&amp;quot; or &amp;quot;c&amp;quot; or nothing (i.e. &amp;quot;&amp;quot;)).&lt;br /&gt;
* 	None or more of the preceding (&amp;quot;words*&amp;quot; will match &amp;quot;word&amp;quot;, &amp;quot;words&amp;quot; and &amp;quot;wordsssssss&amp;quot;. &amp;quot;.*&amp;quot; will match anything including nothing).&lt;br /&gt;
+ 	One or more of the preceding (&amp;quot;xxx+&amp;quot; will match a sequence of 3 or more &amp;quot;x&amp;quot;).&lt;br /&gt;
(expr1|expr2) 	One of the expressions, which in turn may contain a similar construction (&amp;quot;(foo|bar)&amp;quot; will match &amp;quot;foo&amp;quot; or &amp;quot;bar&amp;quot;.&lt;br /&gt;
&amp;quot;(foo|bar)? will match &amp;quot;foo&amp;quot; or &amp;quot;bar&amp;quot; or nothing (i.e. &amp;quot;&amp;quot;)).&lt;br /&gt;
$ 	The end of the line (&amp;quot;(foo|bar)$&amp;quot; will match &amp;quot;foo&amp;quot; or &amp;quot;bar&amp;quot;only at the end of a line).&lt;br /&gt;
\x 	Disable the special meaning of x where x is one of the special regex characters &amp;quot;.?*+()^$[]{}\&amp;quot;  (&amp;quot;\.&amp;quot; will match a single &amp;quot;.&amp;quot;, &amp;quot;\\&amp;quot; a single &amp;quot;\&amp;quot; etc.)&lt;br /&gt;
&lt;br /&gt;
Thus a start to block possible sexual material by expression match could look like:&lt;br /&gt;
&lt;br /&gt;
    (^|[-\?+=/_])(bondage|boobs?|busty?|hardcore|porno?|sex|xxx+)([-\?+=/_]|$) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
    Unless you build your expressions very very carefully there is a high risk you will have annoyed users on your neck. Typically you might accidentally block &amp;quot;Essex&amp;quot;, &amp;quot;Sussex&amp;quot;, &amp;quot;breastcancer&amp;quot;, &amp;quot;www.x.org&amp;quot; etc. in your eagerness for blocking pornographic material. In practice you would probably replace some of the words in the example above with some more clearly pornographic related words that I don't find appropriate to list here.&lt;br /&gt;
&lt;br /&gt;
    While the size of the domain and urllists only has marginal influence on the performance, too many large or complex expressions will quickly degrade the performance of squidGuard. Though it may depend heavily on the performance of the regex library you link with.&lt;br /&gt;
&lt;br /&gt;
    There is a rich set of sample files for a group of supposedly pornographic sites under samples/dest/adult in the source tree that you can use as a start if porn blocking is one of your tasks. Please note: We recommend that you review these lists before using them. Those domains and urls have been collected automagically by a robot. No manual evaluation of the corresponding contents has been performed. Therefor there is a chance some nonpornographic sites have sliped in. Please report such errors but don't blame us if your fine site is on the list. (Blame those who have pointers to appropriate sites mixed in on their heavy porn link pages!)&lt;br /&gt;
&lt;br /&gt;
    To avoid publishing to your users a complete guide to banned sites, you probably want to have some or all of these files protected by for instance:&lt;br /&gt;
&lt;br /&gt;
        chmod 640 /wherever/filter/db/dest/adult/*&lt;br /&gt;
        chown cache_effective_user /wherever/filter/db/dest/adult/*&lt;br /&gt;
        chgrp cache_effective_group /wherever/filter/db/dest/adult/* &lt;br /&gt;
&lt;br /&gt;
    where cache_effective_user and cache_effective_group are the values for the corresponding tags as defined in squid.conf.&lt;br /&gt;
&lt;br /&gt;
Prebuilt databases&lt;br /&gt;
Creating a prebuilt database&lt;br /&gt;
&lt;br /&gt;
To convert a domainlist or urllist from plain text file to a prebuilt database use:&lt;br /&gt;
&lt;br /&gt;
    squidGuard -C listfile &lt;br /&gt;
&lt;br /&gt;
and send Squid a HUP signal to respawn squidGuard. Note: listfile is the absolute plain text filename or relative to dbhome.&lt;br /&gt;
&lt;br /&gt;
Updating a prebuilt database&lt;br /&gt;
&lt;br /&gt;
To add and remove entries from a prebuilt database in runtime put the changes in a diff file (file.diff for file.db) with the following simple format:&lt;br /&gt;
&lt;br /&gt;
    +new&lt;br /&gt;
    -old&lt;br /&gt;
    ... &lt;br /&gt;
&lt;br /&gt;
Then use:&lt;br /&gt;
&lt;br /&gt;
    squidGuard -u &lt;br /&gt;
&lt;br /&gt;
and remove the diff files. The changes should take effect immediately.&lt;br /&gt;
&lt;br /&gt;
Tuning hints&lt;br /&gt;
&lt;br /&gt;
For optimal performance try:&lt;br /&gt;
&lt;br /&gt;
    limiting both the number of regular expressions and their complexity. Use domainlists and/or urllists where possible.&lt;br /&gt;
    limiting the number of rewrite rules. Use redirectors where possible.&lt;br /&gt;
    limiting the number of useless url list entries. Move the domainnames to the domainlist and remove redundant urllist entries where aplicable.&lt;br /&gt;
    using ip addressranges rather than long lists of single ip addresses. If possible try grouping different usergroups into different ranges or subnets (virtual or physical).&lt;br /&gt;
&lt;br /&gt;
Working configuration examples&lt;br /&gt;
Example 0 - The absolutely minimal do nothing config:&lt;br /&gt;
&lt;br /&gt;
The absolutely minimal config file is an emty but existing file (i.e. squidGuard -c /dev/null) which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
     acl {&lt;br /&gt;
	  default {&lt;br /&gt;
	       pass all&lt;br /&gt;
	  }&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Example 1 - The recommended minimal do nothing config:&lt;br /&gt;
&lt;br /&gt;
We do recommend, for clarity, to say explicitly what squidGuard is expected to do (makes things less magic for a new operator):&lt;br /&gt;
&lt;br /&gt;
     logdir /usr/local/squidGuard/log&lt;br /&gt;
&lt;br /&gt;
     acl {&lt;br /&gt;
	 default {&lt;br /&gt;
	     pass all&lt;br /&gt;
	 }&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Example 2 - Limiting the access to one destination group only:&lt;br /&gt;
&lt;br /&gt;
     logdir /usr/local/squidGuard/log&lt;br /&gt;
     dbhome /usr/local/squidGuard/db&lt;br /&gt;
&lt;br /&gt;
     dest local {&lt;br /&gt;
	 domainlist local/domains&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     acl {&lt;br /&gt;
	 default {&lt;br /&gt;
	     pass local none&lt;br /&gt;
	     redirect http://localhost/cgi/blocked?clientaddr=%a&amp;amp;clientname=%n&amp;amp;clientuser=%i&amp;amp;clientgroup=%s&amp;amp;url=%u&lt;br /&gt;
	 }&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
This implies there must be a domain list file &amp;quot;/usr/local/squidGuard/db/local/domains&amp;quot; that may simply look like:&lt;br /&gt;
&lt;br /&gt;
     teledanmark.no&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Example 3 - Blocking the access for unknown or unprivileged clients:&lt;br /&gt;
&lt;br /&gt;
     logdir /usr/local/squidGuard/log&lt;br /&gt;
     dbhome /usr/local/squidGuard/db&lt;br /&gt;
&lt;br /&gt;
     src privileged {&lt;br /&gt;
	 ip	10.0.0.1 10.0.0.73 10.0.0.233	# ONE OF single clients&lt;br /&gt;
	 ip	10.0.0.10-10.0.0.20		# OR WITHIN range 10.0.0.10 - 10.0.0.20&lt;br /&gt;
	 ip	10.0.1.32/27			# OR WITHIN range 10.0.1.32 - 10.0.1.63&lt;br /&gt;
	 ip	10.0.2.0/255.255.255.0		# OR WITHIN range 10.0.2.0  - 10.0.2.255&lt;br /&gt;
						# AND&lt;br /&gt;
	 domain foo.bar				# MATCH foo.bar. OR *.foo.bar.&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     acl {&lt;br /&gt;
	 privileged {&lt;br /&gt;
	     pass all&lt;br /&gt;
	 }&lt;br /&gt;
&lt;br /&gt;
	 default {&lt;br /&gt;
	     pass none&lt;br /&gt;
	     redirect http://info.foo.bar/cgi/blocked?clientaddr=%a&amp;amp;clientname=%n&amp;amp;clientuser=%i&amp;amp;clientgroup=%s&amp;amp;url=%u&lt;br /&gt;
	 }&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Using client domainname match implies reverse lookup is enabled (log_fqdn on) in squid.conf.&lt;br /&gt;
&lt;br /&gt;
     teledanmark.no&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Example 4 - Blocking inappropriate sites:&lt;br /&gt;
&lt;br /&gt;
     logdir /usr/local/squidGuard/log&lt;br /&gt;
     dbhome /usr/local/squidGuard/db&lt;br /&gt;
&lt;br /&gt;
     dest porn {&lt;br /&gt;
	 domainlist porn/domains&lt;br /&gt;
	 urllist    porn/urls&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     acl {&lt;br /&gt;
	 default {&lt;br /&gt;
	     pass !porn all&lt;br /&gt;
	     redirect http://localhost/cgi/blocked?clientaddr=%a&amp;amp;clientname=%n&amp;amp;clientuser=%i&amp;amp;clientgroup=%s&amp;amp;url=%u&lt;br /&gt;
	 }&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
This implies there must be a domain list file &amp;quot;/usr/local/squidGuard/db/porn/domains&amp;quot; and a domain list file &amp;quot;/usr/local/squidGuard/db/porn/urls&amp;quot;. The domain list file may have a zillion lines like:&lt;br /&gt;
&lt;br /&gt;
     porn.com&lt;br /&gt;
     sex.com&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;url list file may have an other zillion lines like:&lt;br /&gt;
&lt;br /&gt;
     foo.com/~porn&lt;br /&gt;
     bar.com/img/sex&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Example 5 - Blocking inappropriate sites for some users and blocking unknown clients:&lt;br /&gt;
&lt;br /&gt;
     logdir /usr/local/squidGuard/log&lt;br /&gt;
     dbhome /usr/local/squidGuard/db&lt;br /&gt;
&lt;br /&gt;
     src grownups {&lt;br /&gt;
	 ip	   10.0.0.0/24	  # range 10.0.0.0  - 10.0.0.255&lt;br /&gt;
			       # AND&lt;br /&gt;
	 user   foo bar	  # ident foo or bar&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     src kids {&lt;br /&gt;
	 ip	   10.0.0.0/22	  # range 10.0.0.0 - 10.0.3.255&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     dest porn {&lt;br /&gt;
	 domainlist porn/domains&lt;br /&gt;
	 urllist    porn/urls&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     acl {&lt;br /&gt;
	 grownups {&lt;br /&gt;
	     pass all&lt;br /&gt;
	 }&lt;br /&gt;
&lt;br /&gt;
	 kids {&lt;br /&gt;
	     pass !porn all&lt;br /&gt;
	 }&lt;br /&gt;
&lt;br /&gt;
	 default {&lt;br /&gt;
	     pass none&lt;br /&gt;
	     redirect http://info.foo.bar/cgi/blocked?clientaddr=%a&amp;amp;clientname=%n&amp;amp;clientuser=%i&amp;amp;clientgroup=%s&amp;amp;targetgroup=%t&amp;amp;url=%u&lt;br /&gt;
	 }&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Using userident match implies RFC931/ident lookup is enabled in squid.conf, optionally only for the actual client groups, and that foo and bar's workstations must support RFC931.&lt;br /&gt;
Example 6 - Blocking inappropriate sites partially with regex:&lt;br /&gt;
&lt;br /&gt;
 + ensuring local and good sites are passed even if they would match a blocking regex:&lt;br /&gt;
 + limiting the usage of IP-address URLs:&lt;br /&gt;
&lt;br /&gt;
     logdir /usr/local/squidGuard/log&lt;br /&gt;
     dbhome /usr/local/squidGuard/db&lt;br /&gt;
&lt;br /&gt;
     dest local {&lt;br /&gt;
	 domainlist     local/domains&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     dest good {&lt;br /&gt;
	 domainlist     local/domains&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     dest porn {&lt;br /&gt;
	 domainlist     porn/domains&lt;br /&gt;
	 urllist        porn/urls&lt;br /&gt;
	 expressionlist porn/expressions&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     acl {&lt;br /&gt;
	 default {&lt;br /&gt;
	     pass local good !in-addr !porn all&lt;br /&gt;
	     redirect http://localhost/cgi/blocked?clientaddr=%a&amp;amp;clientname=%n&amp;amp;clientuser=%i&amp;amp;clientgroup=%s&amp;amp;url=%u&lt;br /&gt;
	 }&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Example 7 - Blocking inappropriate sites within business hours only:&lt;br /&gt;
&lt;br /&gt;
    Lets extend example 5 with:&lt;br /&gt;
    a time constraint on censorship&lt;br /&gt;
    logging redirections of inappropriate sites anonymized&lt;br /&gt;
    redirecting inappropriate sites specially.&lt;br /&gt;
    and still protecting the kids 24h.&lt;br /&gt;
&lt;br /&gt;
     logdir /usr/local/squidGuard/log&lt;br /&gt;
     dbhome /usr/local/squidGuard/db&lt;br /&gt;
&lt;br /&gt;
     time leisure-time {&lt;br /&gt;
	 weekly * 00:00-08:00 17:00-24:00	# night and evening&lt;br /&gt;
	 weekly fridays 16:00-17:00		# weekend&lt;br /&gt;
	 weekly saturdays sundays		# weekend&lt;br /&gt;
	 date	*.01.01				# New Year's Day&lt;br /&gt;
	 date	*.05.01				# Labour Day&lt;br /&gt;
	 date	*.05.17				# National Day&lt;br /&gt;
	 date	*.12.24 12:00-24:00		# Christmas Eve&lt;br /&gt;
	 date	*.12.25				# Christmas Day&lt;br /&gt;
	 date	*.12.26				# Boxing Day&lt;br /&gt;
	 date	1999.03.31 12:00.24:00		# Ash Wednesday&lt;br /&gt;
	 date	1999.04.01-1999.04.05		# Easter&lt;br /&gt;
	 date	1999.05.13 1999.05.24		# Ascension Day and Whitsun&lt;br /&gt;
	 date	2000.04.19 12:00.24:00		# Ash Wednesday y2000&lt;br /&gt;
	 date	2000.04.20-2000.04.24		# Easter y2000&lt;br /&gt;
	 date	2000.06.01 2000.06.12		# Ascension Day and Whitsun y2000&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     src grownups {&lt;br /&gt;
	 ip	10.0.0.0/24			# range 10.0.0.0  - 10.0.0.255&lt;br /&gt;
						# AND&lt;br /&gt;
	 user	foo bar				# ident foo or bar&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     src kids {&lt;br /&gt;
	 ip	10.0.0.0/22			# range 10.0.0.0 - 10.0.3.255&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     dest porn {&lt;br /&gt;
	 domainlist	porn/domains		# file listing domains	(clear text)&lt;br /&gt;
	 urllist	porn/urls		# file listing URLs	(clear text)&lt;br /&gt;
	 expressionlist porn/expressions	# file with expressions (clear text regex)&lt;br /&gt;
	 redirect       302:http://info.foo.bar/images/blocked.gif&lt;br /&gt;
						# redirect matches to this URL&lt;br /&gt;
	 log anonymous  porn.log		# log redirects anonymized to logdir/porn.log&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     acl {&lt;br /&gt;
	 grownups within leisure-time {&lt;br /&gt;
	     pass all				# don't censor peoples leisure-time&lt;br /&gt;
	 } else {&lt;br /&gt;
	     pass !in-addr !porn all		# restrict access during business hours&lt;br /&gt;
	 }&lt;br /&gt;
&lt;br /&gt;
	 kids {&lt;br /&gt;
	     pass !porn all			# protect the kids 24h anyway&lt;br /&gt;
	 }&lt;br /&gt;
&lt;br /&gt;
	 default {&lt;br /&gt;
	     pass none				# reject unknown clients&lt;br /&gt;
	     redirect http://info.foo.bar/cgi/blocked?clientaddr=%a&amp;amp;clientname=%n&amp;amp;clientuser=%i&amp;amp;clientgroup=%s&amp;amp;targetgroup=%t&amp;amp;url=%u&lt;br /&gt;
	 }&lt;br /&gt;
     }&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:SquidGuard]]&lt;/div&gt;</summary>
		<author><name>Ledhed</name></author>	</entry>

	</feed>