File: configuration.html

package info (click to toggle)
squidguard 1.2.0-8.2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,908 kB
  • ctags: 225
  • sloc: perl: 2,796; yacc: 1,951; ansic: 1,455; makefile: 409; sh: 224; lex: 74
file content (2595 lines) | stat: -rw-r--r-- 62,851 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
<HTML>

 <HEAD>
  <TITLE>squidGuard - Configuration</TITLE>
  <META name="keywords" lang="en" content="configuring,configuration,config,squidGuard,squidguard,squid,Squid,free,redirector,filter">
  <META name="author" content="Pl Baltzersen">
  <META name="copyright" content="&copy; 2000 ElTele st AS.">
 </HEAD>

 <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
 <BODY
  BACKGROUND="/images/background.jpg"
  BGCOLOR="#8EE5EE"
  TEXT="#000000"
  LINK="#0000FF"
  VLINK="#000080"
  ALINK="#FF0000">

  

  <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%>
   <TR>
    <TD ALIGN=LEFT VALIGN=TOP>
     <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
      <TR>
       <TD ALIGN=LEFT VALIGN=BOTTOM>
	<A HREF="http://ftp.ost.eltele.no/pub/www/proxy/squidGuard/"><IMG
	SRC="/images/squidGuard.gif" BORDER=0
	VALIGN=TOP></A>
	<FONT SIZE=+3>
	 <B>Configuring squidGuard</B>
	</FONT>
	<IMG SRC="/images/config.gif" BORDER=0 VALIGN=TOP>
       </TD>
      </TR>
      <TR>
       <TH ALIGN=LEFT VALIGN=TOP>
	<FONT SIZE=-1>
	 <A HREF="/">squidGuard</A> is an ultrafast and free filter,
	 redirector and access controller for <A
	 HREF="http://www.squid-cache.org/">Squid</A>
	 <BR>
	 By <A HREF="/authors/">Pl Baltzersen</A> and <A
	 HREF="/authors/">Lars Erik Hland</A>
	 <BR>
	 <A HREF="/copyright/">Copyright</A> &copy; 1999-2000, <A
	 HREF="http://www.ost.eltele.no/">ElTele st AS</A>
	</FONT>
       </TH>
      </TR>
     </TABLE>
    </TD>
    <TD ALIGN=RIGHT VALIGN=TOP>
     <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
      <TR>
       <TH ALIGN=RIGHT>
	<FONT SIZE=-1>
	 <BR>
	 This page was last modified 2000-03-17
	</FONT>
       </TH>
      </TR>
     </TABLE>
    </TD>
   </TR>
  </TABLE>

  <H2>
   <A NAME="contents">Contents</A>
  </H2>

   <LI>
    <A HREF="#Configuration_file">The configuration file</A>
   </LI>
   <UL>
    <LI>
     <A HREF="#General">In general</A>
    </LI>
   <UL>
     <LI>
      <A HREF="#Structure">The Structure</A>
     </LI>
     <LI>
      <A HREF="#Reserved">Reserved words</A>
     </LI>
     <LI>
      <A HREF="#Lables">Declaration names/lables</A>
     </LI>
     <LI>
      <A HREF="#Breaking">Breaking long lines</A>
     </LI>
    </UL>
    <LI>
     <A HREF="#Directories">Path declarations</A>
    </LI>
    <LI>
     <A HREF="#Timespace">Time space declarations</A>
    </LI>
    <LI>
     <A HREF="#Sourcegroups">Source group declarations</A>
    </LI>
    <LI>
     <A HREF="#Destinationgroups">Destination group declarations</A>
    </LI>
    <LI>
     <A HREF="#Rewritegroups">Rewrite rule group declarations</A>
    </LI>
    <LI>
     <A HREF="#Acls">Access control rule declarations</A>
    </LI>
   </UL>
   <LI>
    <A HREF="#Lists">The database</A>
   </LI>
   <UL>
    <LI>
     <A HREF="#Domainlists">Domainlists</A>
    </LI>
    <LI>
     <A HREF="#URLlists">URLlists</A>
    </LI>
    <LI>
     <A HREF="#Expressionlists">Expressionlists</A>
    </LI>
   </UL>
   <LI>
    <A HREF="#Tuning">Tuning hints</A>
   </LI>
   <LI>
    <A HREF="#Examples">Working configuration examples</A>
   </LI>
   <UL>
    <LI>
     <A HREF="#Minimal">Example 0 - The absolutely minimal <EM>do
     nothing</EM></A>
    </LI>
    <LI>
     <A HREF="#example01">Example 1 - The recommended minimal <EM>do
     nothing</EM></A>
    </LI>
    <LI>
     <A HREF="#example02">Example 2 - Limiting the access to one
     destination group only</A>
    </LI>
    <LI>
     <A HREF="#example03">Example 3 - Blocking the access for unknown
     or unprivileged clients</A>
    </LI>
    <LI>
     <A HREF="#example04">Example 4 - Blocking inapropriate sites</A>
    </LI>
    <LI>
     <A HREF="#example05">Example 5 - Blocking inapropriate sites for
     some users and blocking unknown clients</A>
    </LI>
    <LI>
     <A HREF="#example06">Example 6 - Blocking inapropriate sites
     partially with regex</A>
    </LI>
    <LI>
     <A HREF="#example07">Example 7 - Blocking inapropriate sites
     during business hours only</A>
    </LI>
   </UL>

  <H2>
   <IMG SRC="/images/arrow-red.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Configuration_file">The configuration file</A>
  </H2>

  <P>
   The default path for the squidGuard configuration file is
   "<TT>/usr/local/squidGuard/squidGuard.conf</TT>" but another
   default can be set at <A
   HREF="/install/#Defaultconfigfile">compile time</A>, and
   can be changed at <A
   HREF="/install/#Configfile">runtime</A>. From here we'll
   use <TT>squidGuard.conf</TT> for short.
  </P>

  <P>
   <B>Note:</B> 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 <A
   HREF="#example01">simple</A> working configuration and extend as your
   needs and experience grows. Don't try to solve everything in your
   first attempt..
  </P>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="General">In general</A>
  </H3>

  <H4>
   <A NAME="Structure">The Structure</A>
  </H4>

  <P>
   The recommended structure for <TT>squidGuard.conf</TT> is:
  </P>

  <DL>
   <DD>
    <TABLE CELLPADDING=3 CELLSPACING=0 BORDER=0>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TD>
       <EM>
	<A HREF="#Directories">Path declarations</A>
       </EM>
      </TD>
      <TD>
       &nbsp;(i.e. logdir and dbhome)
      </TD>
      <TD>
       &nbsp;(optional)
      </TD>
     </TR>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TD>
       <EM>
	<A HREF="#Timespace">Time space declarations</A>
       </EM>
      </TD>
      <TD>
       &nbsp;(i.e. time zones)
      </TD>
      <TD>
       &nbsp;(optional)
      </TD>
     </TR>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TD>
       <EM>
	<A HREF="#Sourcegroups">Source group declarations</A>
       </EM>
      </TD>
      <TD>
       &nbsp;(i.e. clients)
      </TD>
      <TD>
       &nbsp;(optional)
      </TD>
     </TR>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TD>
       <EM>
	<A HREF="#Destinationgroups">Destination group declarations</A>
       </EM>
      </TD>
      <TD>
       &nbsp;(i.e. URLs)
      </TD>
      <TD>
       &nbsp;(optional)
      </TD>
     </TR>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TD>
       <EM>
	<A HREF="#Rewritegroups">Rewrite rule group declarations</A>
       </EM>
      </TD>
      <TD>
      </TD>
      <TD>
       &nbsp;(optional)
      </TD>
     </TR>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TD>
       <EM>
	<A HREF="#Acls">Access control rule declarations</A>
       </EM>
      </TD>
      <TD>
      </TD>
      <TD>
       &nbsp;(required)
      </TD>
     </TR>
    </TABLE>
   </DD>
  </DL>

  <P>
   <B>Note:</B> No forward references are allowed! Within this strong
   limitation you may actually chose any structure you prefer.
  </P>

  <H4>
   <A NAME="Reserved">Reserved words</A>
  </H4>

  <P>
   The following words are reserved in <TT>squidGuard.conf</TT> and
   should be avoided in declaration names:
  </P>

  <TT>
   <B>
    <PRE>
       acl             fri             outside         sun             urllist 
       anonymous       friday          pass            sunday          user 
       date            fridays         redirect        sundays         userlist 
       dbhome          ip              rew             thu             wed 
       dest            log             rewrite         thursday        wednesday 
       destination     logdir          sat             thursdays       wednesdays 
       domain          logfile         saturday        time            weekly 
       domainlist      mon             saturdays       tue             within 
       else            monday          source          tuesday         
       expressionlist  mondays         src             tuesdays        
    </PRE>
   </B>
  </TT>

  <DL>
   <DT>
    In adition is:
   </DT>
    <DD>
    <TABLE CELLPADDING=3 CELLSPACING=0 BORDER=0>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TH ALIGN=CENTER>
       <TT>#</TT>
      </TH>
      <TD>
       used to start a comment. Everything from the <TT>#</TT> to the
       end of line is ignored.
      </TD>
     </TR>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TH ALIGN=CENTER>
       <TT>{ }</TT>
      </TH>
      <TD>
       used to delimit the start and end of a group declaration.
      </TD>
     </TR>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TH ALIGN=CENTER>
       <TT>-</TT>
      </TH>
      <TD>
       often used to declare a range
       (i.e.&nbsp;"<TT><EM>from-to</EM></TT>" or
       "<TT><EM>from</EM>&nbsp;-&nbsp;<EM>to</EM></TT>").
      </TD>
     </TR>
    </TABLE>
    </DD>
  </DL>

  <H4>
   <A NAME="Lables">Declaration names/lables</A>
  </H4>

  <P>
   Declaration names/lables have the same limitations as domainnames
   except _ is allowed too (i.e.&nbsp;<TT>[-_.a-z0-9]+</TT>). <A
   HREF="#Reserved">Reserved words</A> should be avoided as they may
   cause unpredictable results.
  </P>

  <H4>
   <A NAME="Breaking">Breaking long lines</A>
  </H4>

  <P>
   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:
  </P>

  <DL>
   <DL>
    <DT>
     <TT>
      src foo {
     </TT>
    </DT>
    <DD>
     <TT>
      ip 1.2.3.4<BR>
      ip 2.3.4.5
     </TT>
    </DD>
    <DT>
     <TT>
      }
     </TT>
    </DT>
   </DL>
   <BR>
   <DT>
    is equivalent to:<BR><BR>
   </DT>
   <DL>
    <DT>
     <TT>
      src foo {
     </TT>
    </DT>
    <DD>
     <TT>
      ip 1.2.3.4 2.3.4.5
     </TT>
    </DD>
    <DT>
     <TT>
      }
     </TT>
    </DT>
   </DL>
  </DL>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Directories">Path declarations</A>
  </H3>

  <DL>
   <DT>
    The <A HREF="./#Logdir">default</A> for the following directories
    may be overruled by:
   </DT>
   <DD>
    <TABLE CELLPADDING=3 CELLSPACING=0 BORDER=0>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TH>
       <A NAME="Logdir"></A><TT>logdir</TT>
      </TH>
      <TD>
       defines the diretory for the standard logfiles
       "<TT>squidGuard.error</TT>" and "<TT>squidGuard.log</TT>", and
       the base for relative logfilenames in <EM>log</EM> rules. The
       default is "<TT>/usr/local/squidGuard/logs</TT>" but another
       default can be set at <A HREF="/install/#Logdir">compile time</A>.
      </TD>
     </TR>
     <TR ALIGN=LEFT VALIGN=TOP>
      <TH>
       <A NAME="DBhome"></A><TT>dbhome</TT>
      </TH>
      <TD>
       defines the base for relative list filenames. The default is
       "<TT>/usr/local/squidGuard/db</TT>" but another default can be
       set at <A HREF="/install/#DBhome">compile time</A>.
      </TD>
     </TR>
    </TABLE>
   </DD>
  </DL>

  <P>
    Although the defaults can be used silently it is recommended to
    declare these explicitly for clarity. For instance:
  </P>

  <TT>
   <PRE>
     logdir /usr/local/squidGuard/logs
     dbhome /usr/local/squidGuard/db
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Timespace">Time space declarations</A>
  </H3>

  <P>
   Time spaces, or zones if you prefer, are declared by:
  </P>

  <DL>
   <DL>
    <DT>
     <TT>
      <B>time</B>&nbsp;<EM>name</EM>&nbsp;<B>{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>specification</EM><BR>
      <EM>specification</EM><BR>
      <EM>...</EM><BR>
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}</B>
     </TT>
    </DT>
   </DL>
  </DL>

  <P>
   where <EM>specification</EM> can be any reasonable combination of:
  </P>

  <DL>
   <DL>
    <DT>
     <A NAME="Weekly"><B>Days of the week with an optional time
     constraint for each day:</B></A>
    </DT>
    <DD>
     <TT>
      <B>weekly</B>&nbsp;{smtwhfa}&nbsp;[HH:MM-HH:MM]
     </TT>
    </DD>
    <DD>
     or
    </DD>
    <DD>
     <TT>
      <B>weekly</B>&nbsp;<EM>dayname</EM>&nbsp;[...]&nbsp;[HH:MM-HH:MM]
     </TT>
    </DD>
    <DD>
     where s=sun, m=mon, t =tue, w=wed, h=thu, f=fri, a=sat.
    </DD>
    <DD>
     and <EM>dayname</EM> is one of:
     <DL>
      <DD>
       "<TT>mon</TT>", "<TT>monday</TT>", "<TT>mondays</TT>", (synonymous)
      </DD>
      <DD>
       "<TT>tue</TT>", "<TT>tuesday</TT>", "<TT>tuesdays</TT>", (synonymous)
      </DD>
      <DD>
       "<TT>wed</TT>", etc.
      </DD>
     </DL>
    </DD>
    <BR>
    <DD>
     For instance for monday to friday, mornings and evenings:
     <DL>
      <DD>
       <TT>
	weekly&nbsp;mtwhf&nbsp;00:00-08:00
	<BR>
	weekly&nbsp;mtwhf&nbsp;17:00-24:00
       </TT>
      </DD>
     </DL>
     and for saturdays and sundays:
     <DL>
      <DD>
       <TT>
	weekly&nbsp;as
       </TT>
      </DD>
      <DD>
       or
      </DD>
      <DD>
       <TT>
	weekly&nbsp;saturday<BR>
	weekly&nbsp;sunday
       </TT>
      </DD>
     </DL>
    </DD>
    <BR>
    <DT>
     <A NAME="Daily"><B>Time of the day:</B></A>
    </DT>
    <DD>
     <TT>
      <B>weekly&nbsp;*</B>&nbsp;HH:MM-HH:MM
     </TT>
    </DD>
    <DD>
     which is just a special case of <A
     HREF="#Weekly">weekly</A>.<BR><BR>
    </DD>
    <DD>
     For instance:
     <DL>
      <DD>
       <TT>
	weekly&nbsp;*&nbsp;00:00-08:00
	<BR>
	weekly&nbsp;*&nbsp;17:00-24:00
       </TT>
      </DD>
     </DL>
    </DD>
    <BR>
    <DT>
     <A NAME="Date"><B>Dates with an optional time
     constraint for each date:</B></A>
    </DT>
    <DD>
     <TT>
      <B>date</B>&nbsp;YYYY-MM-DD&nbsp;[...]&nbsp;[HH:MM-HH:MM&nbsp;...]
     </TT>
    </DD>
    <DD>
     or
    </DD>
    <DD>
     <TT>
      <B>date</B>&nbsp;YYYY.MM.DD&nbsp;[...]&nbsp;[HH:MM-HH:MM&nbsp;...]
     </TT>
    </DD>
    <DD>
     where the preferred of the two dateformats is just a matter of
     personal taste.<BR><BR>
    </DD>
    <DD>
     For instance for the Ascension Day and the Whit Monday of 1999:
     <DL>
      <DD>
       <TT>
	date&nbsp;1999.05.13&nbsp;1999.05.24
       </TT>
      </DD>
     </DL>
     or for the Ash Wednesday afternoon of 1999:
     <DL>
      <DD>
       <TT>
	date&nbsp;1999.03.31&nbsp;12:00-24:00
       </TT>
      </DD>
     </DL>
    </DD>
    <BR>
    <DT>
     <A NAME="Daterange"><B>Date range with an optional time
     constraint for each day:</B></A>
    </DT>
    <DD>
     <TT>
      <B>date</B>&nbsp;YYYY-MM-DD-YYYY-MM-DD&nbsp;[HH:MM-HH:MM&nbsp;...]
     </TT>
    </DD>
    <DD>
     or
    </DD>
    <DD>
     <TT>
      <B>date</B>&nbsp;YYYY.MM.DD-YYYY.MM.DD&nbsp;[HH:MM-HH:MM&nbsp;...]<BR><BR>
     </TT>
    </DD>
    <DD>
     For instance for the Easter of 1999:
     <DL>
      <DD>
       <TT>
	date&nbsp;1999.04.01-1999.04.05
       </TT>
      </DD>
     </DL>
     <BR>
    </DD>
    <DT>
     <A NAME="Datewildcard"><B>Date wildcard with an optional time
     constraint:</B></A>
    </DT>
    <DD>
     <TT>
      <B>date</B>&nbsp;<EM>YYYY</EM>-<EM>MM</EM>-<EM>DD</EM>&nbsp;[HH:MM-HH:MM&nbsp;...]
     </TT>
    </DD>
    <DD>
     or
    </DD>
    <DD>
     <TT>
      <B>date</B>&nbsp;<EM>YYYY</EM>.<EM>MM</EM>.<EM>DD</EM>&nbsp;[HH:MM-HH:MM&nbsp;...]
     </TT>
    </DD>
    <DD>
     where <TT><EM>YYYY</EM></TT>, <TT><EM>MM</EM></TT> and
     <TT><EM>DD</EM></TT> may be an asterisk,
     "<TT><B>*</B></TT>".<BR><BR>
    </DD>
    <DD>
     For instance for the New Year's Day:
     <DL>
      <DD>
       <TT>
	date&nbsp;*.01.01
       </TT>
      </DD>
     </DL>
    </DD>
    <DD>
     and for the Christmas Eve:
     <DL>
      <DD>
       <TT>
	date&nbsp;*.12.24 12:00-24:00
       </TT>
      </DD>
     </DL>
    </DD>
   </DL>
  </DL>

  <P>
   <B>Note1:</B> The numeric formats are strict (I.e. 08:00 not 8:00
   for HH:MM etc).
   <BR>
   <B>Note2:</B> Overlaps are OK, and the result is the <EM>union</EM>.
  </P>

  <P>
   Thus for instance a Norwegian time space definition for leisure
   time including holidays and short days could look something like:
  </P>

  <TT>
   <PRE>
     time leisure-time {
	  weekly   * 00:00-08:00  	      # night
	  weekly   * 17:00-24:00  	      # evening
	  weekly   fridays 16:00-17:00	      # weekend
	  weekly   saturdays sundays	      # weekend
	  date	   *.01.01		      # New Year's Day
	  date	   *.05.01		      # Labour Day
	  date	   *.05.17		      # National Day
	  date	   *.12.24 12:00-24:00	      # Christmas Eve
	  date	   *.12.25		      # Christmas Day
	  date	   *.12.26		      # Boxing Day
	  date	   1999.03.31 12:00.24:00     # Ash Wednesday
	  date	   1999.04.01-1999.04.05      # Easter
	  date	   1999.05.13 1999.05.24      # Ascension Day and Whitsun
	  date	   2000.04.19 12:00.24:00     # Ash Wednesday y2000
	  date	   2000.04.20-2000.04.24      # Easter y2000
	  date	   2000.06.01 2000.06.12      # Ascension Day and Whitsun y2000
     }
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Sourcegroups">Source group declarations</A>
  </H3>

  <P>
   Source group, or client groups if you prefer, are declared by:
  </P>

  <DL>
   <DL>
    <DT>
     <TT>
      <B>src|source&nbsp;</B><EM>name</EM>&nbsp;[within|outside&nbsp;<EM>time_space_name</EM>]&nbsp;<B>{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>specification</EM><BR>
      <EM>specification</EM><BR>
      <EM>...</EM><BR>
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}</B>
     </TT>
    </DT>
   </DL>
   or
   <DL>
    <DT>
     <TT>
      <B>src|source&nbsp;</B><EM>name</EM><B>&nbsp;within|outside&nbsp;</B><EM>time_space_name</EM><B>&nbsp;{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>specification</EM><BR>
      <EM>specification</EM><BR>
      <EM>...</EM><BR>
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}&nbsp;else&nbsp;{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>specification</EM><BR>
      <EM>specification</EM><BR>
      <EM>...</EM><BR>
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}</B>
     </TT>
    </DT>
   </DL>
  </DL>

  <P>
   where:
  </P>

  <UL>
   <LI>
    <TT><B>src</B></TT> and <TT><B>source</B></TT> are synonymous; use
    the one you prefer.
   </LI>
   <LI>
    <TT><B>within</B></TT> and <TT><B>outside</B></TT> sets an
    optional time constraint to the definition.
   </LI>
   <LI>
    the <TT><B>else</B></TT> part refers to the time constraint.
   </LI>
  </UL>

  <P>
   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)
  </P>

  <P>
   <EM>Specification</EM> can be any reasonable combination of:
  </P>

  <DL>
   <DL>
    <DT>
     <A NAME="IP"></A><B>IP addresses and/or ranges (multiple):</B>
    </DT>
    <DD>
     <TT>
      <B>ip</B>&nbsp;xxx.xxx.xxx.xxx&nbsp;[...]
     </TT>
    </DD>
    <DD>
     or
    </DD>
    <DD>
     <TT>
      <B>ip</B>&nbsp;xxx.xxx.xxx.xxx/nn&nbsp;[...]
     </TT>
    </DD>
    <DD>
     or
    </DD>
    <DD>
     <TT>
      <B>ip</B>&nbsp;xxx.xxx.xxx.xxx/mmm.mmm.mmm.mmm&nbsp;[...]
     </TT>
    </DD>
    <DD>
     or
    </DD>
    <DD>
     <TT>
      <B>ip</B>&nbsp;xxx.xxx.xxx.xxx-yyy.yyy.yyy.yyy&nbsp;[...]
     </TT>
    </DD>
    <DD>
     where:
     <DL>
      <DD>
       <TT>xxx.xxx.xxx.xxx</TT> is an IP address (host or net,
       i.e. <TT>10.11.12.13</TT> or <TT>10.11.12.0</TT>),<BR>
       <TT>/nn</TT> a net prefix (i.e. <TT>/23</TT>),<BR>
       <TT>mmm.mmm.mmm.mmm</TT> is a netmask
       (i.e. <TT>255.255.254.0</TT>) and<BR> <TT>yyy.yyy.yyy.yyy</TT>
       is a host address (must be <TT>&gt;= xxx.xxx.xxx.xxx</TT>)
      </DD>
     </DL>
    </DD>
   </DL>
   <BR>
   <DL>
    <DT>
     <A NAME="IPlist"></A><B>IP address/range list (single):</B>
    </DT>
    <DD>
     <TT>
      <B>iplist</B>&nbsp;<A HREF="#IPlists">filename</A>
     </TT>
    </DD>
    <DD>
     where:
     <DL>
      <DD>
       <TT>filename</TT> is either a path relative to <A
       HREF="#DBhome"><TT>dbhome</TT></A> or an absolute path
       (i.e.&nbsp;<TT>/full/path</TT>) to a <A
       HREF="#IPlists">database file</A>.
      </DD>
      <DD>
       <A NAME="IPlists">the iplist file format</A> 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 "<TT>iplist</TT>" over "<TT>ip</TT>" is for long lists of
       WS/PC addresses primarily to reduce the size of the
       configuration file):
       <DL>
        <DD>
         <TT>
	  10.0.0.0/8<BR>
	  172.16.0.0/12<BR>
	  192.168.0.0/16<BR>
	 </TT>
	</DD>
       </DL>
      </DD>
     </DL>
    </DD>
   </DL>
   <BR>
   <DL>
    <DT>
     <A NAME="Domain"><B>Domains (multiple):</B></A>
    </DT>
    <DD>
     <TT>
      <B>domain</B>&nbsp;foo.bar&nbsp;[...]&nbsp;&nbsp;*)
     </TT>
    </DD>
    <DD>
     where:
     <DL>
      <DD>
       <TT>foo.bar</TT> is a domain (zone) the domain name (from a
       reverse lookup on the client addresses) belongs to (directly or
       as a subdomain).
      </DD>
     </DL>
    </DD>
   </DL>
   <BR>
   <DL>
    <DT>
     <A NAME="User"><B>Users (multiple):</B></A>
    </DT>
    <DD>
     <TT>
      <B>user</B>&nbsp;foo&nbsp;[...]&nbsp;&nbsp;**)
     </TT>
    </DD>
    <DD>
     where:
     <DL>
      <DD>
       <TT>foo</TT> is a username (from a ident/RFC-931 lookup to the
       client.
      </DD>
     </DL>
    </DD>
   </DL>
   <BR>
   <DL>
    <DT>
     <A NAME="Userlist"></A><B>User list (single):</B>
    </DT>
    <DD>
     <TT>
      <B>userlist</B>&nbsp;<A HREF="#Userlists">filename</A>&nbsp;**)
     </TT>
    </DD>
    <DD>
     where:
     <DL>
      <DD>
       <TT>filename</TT> is either a path relative to <A
       HREF="#DBhome"><TT>dbhome</TT></A> or an absolute path
       (i.e.&nbsp;<TT>/full/path</TT>) to a <A
       HREF="#Userlists">database file</A>.
      </DD>
      <DD>
       <A NAME="Userlists">the userlist file format</A> 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 <A HREF="#User">user declaration</A> but
       without the user keyword. Thus a userlist could look something
       like:
       <DL>
        <DD>
         <TT>
	  root<BR>
	  administrator<BR>
	  foo<BR>
	  bar<BR>
	 </TT>
	</DD>
       </DL>
      </DD>
     </DL>
    </DD>
   </DL>
   <BR>
   <DL>
    <DT>
     <A NAME="Clientgroup log"></A><B>Special clientgroup translation
     log (single):</B>
    </DT>
    <DD>
     <TT>
      <B>log|logfile</B>&nbsp;[anonymous]&nbsp;<EM>filename</EM>
     </TT>
    </DD>
   </DL>
   <DD>
    where:
    <DL>
     <DD>
      <TT>filename</TT> is either a path relative to <A
      HREF="#Logdir"><TT>logdir</TT></A> or an absolute path
      (i.e.&nbsp;<TT>/full/path</TT>) to a logfile where translation
      for this group should be logged. If the <TT>anonymous</TT>
      option is specified the logged info is somewhat anonymized to
      protect the individual.
     </DD>
    </DL>
   </DD>
  </DL>

  <P>
   <FONT SIZE=-1>
    <B>
     *)&nbsp;The use of domain match for clientsgroups requires Squid
     is set up to do revese lookups on clients.<BR> **)&nbsp;The use
     of username match for clientsgroups requires Squid is set up to
     do ident/RFC-931 lookups.<BR>
    </B>
   </FONT>
  </P>

  <P>
   <B>Note1:</B> Overlaps are OK, and the groups are matched in the
   order they are defined.<BR> <B>Note2:</B> The logical operator
   between different types within a group (ip/domain/user) is AND. The
   default is <EM>any</EM>. Thus one of each defined type
   <EM>must</EM> match but undefined types are ignored.
  </P>

  <P>
   Thus an administrator client group could look something like:
  </P>

  <TT>
   <PRE>
     src admin within leisure-time {
	  ip	   10.11.12.13 10.11.12.26    # The administrators home WS/PCs
	  domain   ras.ost.eltele.no	      # The RAS domain
	  user	   root administrator foo bar # The administrators login names
     } else {
	  ip	   10.1.1.15 10.1.2.17        # The administrators office WS/PCs
	  domain   lan.ost.eltele.no	      # The LAN domain
	  user	   root administrator foo bar # The administrators login names
     }
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Destinationgroups">Destination group declarations</A>
  </H3>

  <P>
   Destination group, or target groups if you prefer, are declared by:
  </P>

  <DL>
   <DL>
    <DT>
     <TT>
      <B>dest|destination&nbsp;</B><EM>name</EM>&nbsp;[within|outside&nbsp;<EM>time_space_name</EM>]&nbsp;<B>{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>specification</EM><BR>
      <EM>specification</EM><BR>
      <EM>...</EM><BR>
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}</B>
     </TT>
    </DT>
   </DL>
   or
   <DL>
    <DT>
     <TT>
      <B>dest|destination&nbsp;</B><EM>name</EM><B>&nbsp;within|outside&nbsp;</B><EM>time_space_name</EM><B>&nbsp;{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>specification</EM><BR>
      <EM>specification</EM><BR>
      <EM>...</EM><BR>
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}&nbsp;else&nbsp;{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>specification</EM><BR>
      <EM>specification</EM><BR>
      <EM>...</EM><BR>
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}</B>
     </TT>
    </DT>
   </DL>
  </DL>

  <P>
   where:
  </P>

  <UL>
   <LI>
    <TT><B>dest</B></TT> and <TT><B>destination</B></TT> are synonymous.
   </LI>
   <LI>
    <TT><B>within</B></TT> and <TT><B>outside</B></TT> sets an
    optional time constraint to the definition.
   </LI>
   <LI>
    the <TT><B>else</B></TT> part refers to the time constraint.
   </LI>
  </UL>

  <P>
   Time constraints on destinationgroups can be used to make these
   groups void (i.e. ignored) within or outside a given time space.
  </P>

  <P>
   <EM>Specification</EM> can be any combination of zero or one of
   each of:
  </P>

  <DL>
   <DL>
    <DT>
     <A NAME="Domainlist"></A><B>Domainlist (single):</B>
    </DT>
    <DD>
     <TT>
      <B>domainlist</B>&nbsp;<A HREF="#Domainlists">filename</A>
     </TT>
    </DD>
   </DL>
   <BR>
   <DL>
    <DT>
     <A NAME="URLlist"></A><B>URL list (single):</B>
    </DT>
    <DD>
     <TT>
      <B>urllist</B>&nbsp;<A HREF="#URLlists">filename</A>
     </TT>
    </DD>
   </DL>
   <BR>
   <DL>
    <DT>
     <A NAME="Expressionlist"></A><B>Expressionlist (single):</B>
    </DT>
    <DD>
     <TT>
      <B>expressionlist</B>&nbsp;<A HREF="#Expressionlists">filename</A>
     </TT>
    </DD>
   </DL>
   <BR>
   <DD>
    where:
    <DL>
     <DD>
      <TT>filename</TT> is either a path relative to <A
      HREF="#DBhome"><TT>dbhome</TT></A> or an absolute path
      (i.e.&nbsp;<TT>/full/path</TT>) to a <A HREF="#Lists">database
      file</A>.
     </DD>
    </DL>
   </DD>
   <BR>
   <DL>
    <DT>
     <A NAME="Destinationgroup redirect"></A><B>Special
     destinationgroup redirect URL (single):</B>
    </DT>
    <DD>
     <TT>
      <B>redirect</B>&nbsp;[302:]<EM>url</EM>
     </TT>
    </DD>
   </DL>
   <BR>
   <DL>
    <DT>
     <A NAME="Destinationgroup log"></A><B>Special destinationgroup redirect log (single):</B>
    </DT>
    <DD>
     <TT>
      <B>log|logfile</B>&nbsp;[anonymous]&nbsp;<EM>filename</EM>
     </TT>
    </DD>
   </DL>
   <DD>
    where:
    <DL>
     <DD>
      <TT>filename</TT> is either a path relative to <A
      HREF="#Logdir"><TT>logdir</TT></A> or an absolute path
      (i.e.&nbsp;<TT>/full/path</TT>) to a logfile where redirects
      caused by match of this group should be logged. If the
      <TT>anonymous</TT> option is specified the logged info is
      somewhat anonymized to protect the individual.
     </DD>
    </DL>
   </DD>
  </DL>

  <P>
   <B>Note1:</B> Overlaps are OK, and the groups are matched in the
   order they are listed in the <EM>pass</EM> declaration in for the
   actual clientgroup.<BR> <B>Note2:</B> The logical operator between
   different types (domainlist/urllist/expressionlist) is OR. The
   default is <EM>void</EM>. Thus the destinationgroup is matched if
   <EM>one</EM> of the defined types match. Within a destination group
   the test order is domainlist, urllist, and expressionlist.
  </P>

  <P>
   Thus an entertainment destination group declaration could look
   something like:
  </P>

  <TT>
   <PRE>
     src not-business-related outside leisure-time {
	  domainlist	 entertainment/domains
	  urllist	 entertainment/urls
	  expressionlist entertainment/expressions
     }
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Rewritegroups">Rewrite rule group declarations</A>
  </H3>

  <P>
   Rewrite rule groups, or rewrite rule sets if you prefer, are
   declared by:
  </P>

  <DL>
   <DL>
    <DT>
     <TT>
      <B>rew|rewrite&nbsp;</B><EM>name</EM>&nbsp;[within|outside&nbsp;<EM>time_space_name</EM>]&nbsp;<B>{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>substitution</EM><BR>
      <EM>substitution</EM><BR>
      <EM>...</EM><BR>
      <EM>[logging]</EM><BR>
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}</B>
     </TT>
    </DT>
   </DL>
   or
   <DL>
    <DT>
     <TT>
      <B>rew|rewrite&nbsp</B><EM>name</EM><B>&nbsp;within|outside&nbsp;</B><EM>time_space_name</EM><B>&nbsp;{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>substitution</EM><BR>
      <EM>substitution</EM><BR>
      <EM>...</EM><BR>
      <EM>[logging]</EM><BR>
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}&nbsp;else&nbsp;{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>substitution</EM><BR>
      <EM>substitution</EM><BR>
      <EM>...</EM><BR>
      <EM>[logging]</EM><BR>
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}</B>
     </TT>
    </DT>
   </DL>
  </DL>

  <P>
   where:
  </P>

  <UL>
   <LI>
    <TT><B>rew</B></TT> and <TT><B>rewrite</B></TT> are synonymous.
   </LI>
   <LI>
    <TT><B>within</B></TT> and <TT><B>outside</B></TT> sets an
    optional time constraint to the definition.
   </LI>
   <LI>
    the <TT><B>else</B></TT> part refers to the time constraint.
   </LI>
  </UL>

  <P>
   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.
  </P>

  <P>
   <EM>Substitution</EM> is <B><TT>sed</TT></B> style (multiple):
  </P>

  <DL>
   <DD>
    <TT>
     <B>s@<EM>from</EM>@<EM>to</EM>@[irR]</B>
    </TT>
   </DD>
   <DT>
    where:
   </DT>
   <DD>
    <TT>from</TT> is a <A HREF="#Regular expressions">regular
    expression</A> that will be replaced with the string
    <EM><TT>to</TT></EM>.
   </DD>
   <DD>
    the <TT>i</TT> option makes the <TT>from</TT> part match case
    insensitive.
   </DD>
   <DD>
    the <TT>r</TT> option makes the redirection visible to the user
    with a <A
    HREF="http://ftp.ost.eltele.no/pub/networking/rfc/rfc1945.txt">HTTP
    code <EM>302 - Moved Temporarily</EM></A> (The default is to make
    Squid silently fetch the alternate URL).
   </DD>
   <DD>
    the <TT>R</TT> option makes the redirection visible to the user
    with a <A
    HREF="http://ftp.ost.eltele.no/pub/networking/rfc/rfc1945.txt">HTTP
    code <EM>301 - Moved Permanently</EM></A>.
   </DD>
  </DL>
  <DL>
   <DT>
    <A NAME="Rewrite log"></A>and <EM>logging</EM> is (single):
   </DT>
   <DD>
    <TT>
     <B>log|logfile</B>&nbsp;[anonymous]&nbsp;<EM>filename</EM>
    </TT>
   </DD>
   <DD>
    where:
    <DL>
     <DD>
      <TT>filename</TT> is either a path relative to <A
      HREF="#Logdir"><TT>logdir</TT></A> or an absolute path
      (i.e.&nbsp;<TT>/full/path</TT>) to a logfile where succeded
      rewrites should be logged. If the <TT>anonymous</TT> option is
      specified the logged info is somewhat anonymized to protect the
      individual.
     </DD>
    </DL>
   </DD>
  </DL>

  <P>
   <B>Note1:</B> Sed style substitutions uses regular expressions and
   thus slows down squidGuard more than B-tree lookups.<BR>
   <B>Note2:</B> Suport for visible redirects (i.e. <TT>302:</TT> URL
   prefix) is broken in some versions of Squid.
  </P>

  <P>
   A rewrite rule set declaration could look something like:
  </P>

  <TT>
   <PRE>
     rew get-local {
	  s@.*/cb32e46.exe$@http://ftp/pub/www/client/windows/cb32e46.exe@r
	  s@.*/cc32e46.exe$@http://ftp/pub/www/client/windows/cc32e46.exe@r
	  s@.*/cp32e46.exe$@http://ftp/pub/www/client/windows/cp32e46.exe@r
     }
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Acls">Access Control Lists</A>
  </H3>

  <P>
   The Access Control List, <EM>ACL</EM>, combies the previous
   definitions into distinct rulesets for each clientgroup:
  </P>

  <DL>
   <DL>
    <DT>
     <TT>
      <B>acl&nbsp;{</B>
     </TT>
    </DT>
    <DD>
     <TT>
      <EM>sourcegroupname</EM>&nbsp;[within|outside&nbsp;<EM>timespacename</EM>]<B>&nbsp;{</B>
     </TT>
    </DD>
    <DL>
     <DD>
      <A HREF="#Pass">pass</A>&nbsp;[!]<EM>destgroupname</EM>&nbsp;[...]
     </DD>
     <DD>
      [<A HREF="#Rewrite">rew|rewrite</A>&nbsp;<EM>rewritegroupname</EM>&nbsp;[...]
     </DD>
     <DD>
      [<A HREF="#Redirect">redirect</A>&nbsp;[301:|302:]<EM>new_url</EM>]
     </DD>
    </DL>
    <DD>
     <TT>
      <B>}</B><BR><BR>
     </TT>
    </DD>
    <DD>
     <TT>
      <EM>sourcegroupname</EM><B>&nbsp;within|outside&nbsp;</B><EM>timespacename</EM><B>&nbsp;{</B>
     </TT>
    </DD>
    <DL>
     <DD>
      <A HREF="#Pass">pass</A>&nbsp;[!]<EM>destgroupname</EM>&nbsp;[...]
     </DD>
     <DD>
      [<A HREF="#Rewrite">rew|rewrite</A>&nbsp;<EM>rewritegroupname</EM>&nbsp;[...]
     </DD>
     <DD>
      [<A HREF="#Redirect">redirect</A>&nbsp;[301:|302:]<EM>new_url</EM>]
     </DD>
    </DL>
    <DD>
     <TT>
      <B>}&nbsp;else&nbsp;{</B>
     </TT>
    </DD>
    <DL>
     <DD>
      <A HREF="#Pass">pass</A>&nbsp;[!]<EM>destgroupname</EM>&nbsp;[...]
     </DD>
     <DD>
      [<A HREF="#Rewrite">rew|rewrite</A>&nbsp;<EM>rewritegroupname</EM>&nbsp;[...]
     </DD>
     <DD>
      [<A HREF="#Redirect">redirect</A>&nbsp;[301:|302:]<EM>new_url</EM>]
     </DD>
    </DL>
    <DD>
     <TT>
      <B>}</B><BR><BR>
     </TT>
    </DD>
    <DD>
     <TT>
      ...<BR><BR>
     </TT>
    </DD>
    <DD>
     <TT>
      <B><A HREF="#Default">default</A></B>&nbsp;[within|outside&nbsp;<EM>timespacename</EM>]&nbsp;<B>{</B>
     </TT>
    </DD>
    <DL>
     <DD>
      <B><A HREF="#Pass">pass</A></B>&nbsp;[!]<EM>destgroupname</EM>&nbsp;[...]
     </DD>
     <DD>
      [<A HREF="#Rewrite">rew|rewrite</A>&nbsp;<EM>rewritegroupname</EM>&nbsp;[...]
     </DD>
     <DD>
      <B><A HREF="#Redirect">redirect</A></B>&nbsp;[301:|302:]<EM>new_url</EM>
     </DD>
    </DL>
    <DD>
     <TT>
      <B>}</B>[&nbsp;else&nbsp;{
     </TT>
    </DD>
    <DL>
     <DD>
      <B><A HREF="#Pass">pass</A></B>&nbsp;[!]<EM>destgroupname</EM>&nbsp;[...]
     </DD>
     <DD>
      [<A HREF="#Rewrite">rew|rewrite</A>&nbsp;<EM>rewritegroupname</EM>&nbsp;[...]
     </DD>
     <DD>
      <B><A HREF="#Redirect">redirect</A></B>&nbsp;[301:|302:]<EM>new_url</EM>
     </DD>
    </DL>
    <DD>
     <TT>
      ]
     </TT>
    </DD>
    <DT>
     <TT>
      <B>}</B>
     </TT>
    </DT>
   </DL>
  </DL>

  <P>
   <B>Note:</B> There may be no more than <U>one</U> acl block.
  </P>

  <P>
   <B>
    <A NAME="Default">The <EM>default</EM> rule set</A>:
   </B>
  </P>

  <P>
   The <EM>default</EM> 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.
  </P>

  <P>
   <B>
    <A NAME="Pass">The <EM>pass</EM> rule</A>:
   </B>
  </P>

  <P>
   The <EM>pass</EM> rules declares destination groups that should
   pass for the actual client group. "<B><TT>!</TT></B>" is the
   <EM>NOT</EM> operator and indicates a destination group that should
   not pass (i.e. be redirected to the actual <A
   HREF="#Redirect">redirect</A> URL).
   <BR>
   <B>Note:</B> Pass rules ends with an implicit "all". It is good
   practice to allways en the pass rules with either "all" or "none"
   to make them clear. Ie. use:
   <BR>
   &nbsp;&nbsp;<TT>pass good none</TT>
   <BR>
   or
   <BR>
   &nbsp;&nbsp;<TT>pass good !bad all</TT>
   <BR>
   <B>Note:</B> If there is a <EM>!group</EM> there <U>must</U> 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 "unknown" and with an IP range 0.0.0.0/0
   (i.e. <EM>any</EM>), and put those rules in the "unknown" acl.
  </P>

  <P>
   <B><A NAME="Builtin">Built in <EM>wildcard groups</EM></A>:</B>
  </P>

  <DL>
   <DT>
    The following are built in <EM>wildcard destination groups</EM>:
   </DT>
   <DL>
    <DT>
     <B>in-addr</B>
    </DT>
    <DD>
     <B>!in-addr</B> 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
     "<B><TT>^[^:/]+://[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}($|[:/])</TT></B>".
    </DD>
    <DT>
     <B>any</B>
    </DT>
    <DD>
     matches any URL and is a fast equivalent to the expression
     "<B><TT>.*</TT></B>".
    </DD>
    <DT>
     <B>all</B>
    </DT>
    <DD>
     is a synonym to <B>any</B>. Use the one you prefer.
    </DD>
    <DT>
     <B>none</B>
    </DT>
    <DD>
     is a fast equivalent to <B>!any</B> and should be used to
     terminate pass rules where only the listed destination groups
     should pass.
    </DD>
   </DL>
  </DL>

  <P>
   <B>
    <A NAME="Rewrite">The <EM>rewrite</EM> rule</A>:
   </B>
  </P>

  <P>
    The <EM>rewrite</EM> rules declares the substitution rulsets that
    applies to the actual acl.
  </P>

  <P>
   <B>
    <A NAME="Redirect">The <EM>redirect</EM> rule</A>:
   </B>
  </P>

  <P>
   The <EM>redirect</EM> rules declares the altenative URL to be used
   for blocked destination groups (<EM>!groups</EM>) for the actual
   acl.<BR> <B>Note:</B> 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.
  </P>

  <P>
   squidGuard can do runtime string substitutions in the
   redirectors. Therefor the character "<TT>%</TT>" has special
   meaning in the redirector URLs:
  </P>

  <TABLE CELLPADDING=1 CELLSPACING=0 BORDER=0>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>%a</B></TT>
    </TH>
    <TD VALIGN=TOP>
     is replaced with IP address of the client.
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>%n</B></TT>
    </TH>
    <TD VALIGN=TOP>
     is replaced with the domainname of the client or
     "<TT>unknown</TT>" if not available.
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>%i</B></TT>
    </TH>
    <TD VALIGN=TOP>
     is replaced with the user ID (RFC931) or "<TT>unknown</TT>"
     if not available.
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>%s</B></TT>
    </TH>
    <TD VALIGN=TOP>
     is replaced with the matched source group (client group) or
     "<TT>unknown</TT>" if no groups were matched.
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>%t</B></TT>
    </TH>
    <TD VALIGN=TOP>
     is replaced with the matched destination group (target group)
     or "<TT>unknown</TT>" if no groups were matched.
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>%u</B></TT>
    </TH>
    <TD VALIGN=TOP>
     is replaced with the requested URL.
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>%p</B></TT>
    </TH>
    <TD VALIGN=TOP>
     is replaced with the REQUEST_URI, i.e. the path and the optional
     query string of <TT><B>%u</B></TT>, but <B>note</B> for
     convenience without the leading "<TT><B>/</B></TT>".
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>%%</B></TT>
    </TH>
    <TD VALIGN=TOP>
     is replaced with a single "<TT>%</TT>".
    </TD>
   </TR>
  </TABLE>

  <P>
   Thus you can pass usefull information to a more or less intelligent
   CGI page:
  </P>

  <TT>
   <PRE>
     http://proxy/cgi/squidGuard?clientaddr=%a&clientname=%n&clientident=%i&clientgroup=%s&destinationgroup=%t&url=%u
   </PRE>
  </TT>

  <P>
   For a start, there is a sample of such a script in
   <TT>samples/squidGuard.cgi</TT> in the source tree.
  </P>

  <H2>
   <IMG SRC="/images/arrow-red.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Lists">The database</A>
  </H2>

  <P>
   squidGuard uses a database that can be devided into an unlimited
   number of distinct categories like "local", "customers", "vendors",
   "banners", "banned" etc. Each category may consist of separate
   unlimited lists of <A HREF="#Domainlists">domains</A>, <A
   HREF="#URLlists">URLs</A> and/or <A HREF="#Expressionlists">regular
   expressions</A>. For easy revision the lists are stored in separate
   plain text files that. The lists are for efficiency stored in
   in-memory-only <EM>B-trees</EM> at startup.
  </P>

  <P>
   <B>Note:</B> All URLs are converted to lowercase before match
   search. So the lists should not contain uppercase leters.
  </P>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Domainlists">Domainlists</A>
  </H3>

  <P>
   The domainlist file format is simply domainnames/zonenames
   separated by a newline. The length of these lists have neglectable
   influence on the performance.
  </P>

  <P>
   For instance a start for a financial category:
  </P>

  <TT>
   <PRE>
     amex.com
     asx.com.au
     bourse-de-paris.fr
     exchange.de
     londonstockex.co.uk
     nasdaq.com
     nyse.com
     ose.no
     tse.or.jp
     xsse.se
   </PRE>
  </TT>

  <P>
   <B>Note:</B> squidGuard will match any URL with the domainname
   itself an any subdomains and hosts (i.e.&nbsp;<TT>amex.com</TT>,
   <TT>www.amex.com</TT>, <TT>whatever.amex.com</TT> and
   <TT>www.what.ever.amex.com</TT> but <U>not</U>
   <TT>.*[^.]amex.com</TT> (i.e.&nbsp;<TT>aamex.com</TT> etc.)).
  </P>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="URLlists">URLlists</A>
  </H3>

  <P>
   The urllist file format is simply URLs separated by newline but
   with the "<TT><I>proto</I>://((www|web|ftp)[0-9]*)?</TT>" and
   "<TT>(:<I>port</I>)?</TT>" parts and normally also the ending
   "<TT>(/|/[^/]+\.[^/]+)$</TT>" part (i.e. ending "<TT>/</TT>" or
   "<TT>/<EM>filename</EM></TT>") choped off. (i.e.&nbsp;"<TT><FONT
   COLOR="#808080"><S>http://www3.</S></FONT><B>foo.bar.com</B><FONT
   COLOR="#808080"><S>:8080</S></FONT><B>/what/ever</B><FONT
   COLOR="#808080"><S>/index.html</S></FONT></TT>" =>
   "<TT><B>foo.bar.com/what/ever</B></TT>")
  </P>

  <P>
   For instance a category for banned sites:
  </P>

  <TT>
   <PRE>
     foo.com/~badguy
     bar.com/whatever/suspect
   </PRE>
  </TT>

  <P>
   <B>Note:</B> The removed parts above are ignored by squidGuard in
   URL matching. Thus all these URLs will match the above urllist:
  </P>

  <TT>
   <PRE>
     http://foo.com/~badguy
     http://foo.com/~badguy/whatever
     ftp://foo.com/~badguy/whatever
     wais://foo.com/~badguy/whatever
     http://www2.foo.com/~badguy/whatever
     http://web56.foo.com/~badguy/whatever
   </PRE>
  </TT>

  <P>
   but <U>not</U>:
  </P>

  <TT>
   <PRE>
     http://barfoo.com/~badguy
     http://bar.foo.com/~badguy
     http://foo.com/~goodguy
   </PRE>
  </TT>

  <P>
   <A NAME="URL redirect"></A><B>New in 1.0.0</B> is the ability to do
   1-1 redirects on url basis with
   "<TT><EM>key<B>&nbsp;new_url</B></EM></TT>". Thus as an alternative
   to using rewrites to redirect to local distributions you can have a
   destination group with an urllist like:
  </P>

  <TT>
   <PRE>
     netscape.com/pub/communicator/4.51/english/windows/windows95_or_nt/complete_install/cc32e451.exe http://ftp.ost.eltele.no/pub/www/client/windows/cc32e451.exe
     netscape.com/pub/communicator/4.51/english/windows/windows95_or_nt/base_install/cb32e451.exe http://ftp.ost.eltele.no/pub/www/client/windows/cb32e451.exe
   </PRE>
  </TT>

  <P>
   and an <EM>acl</EM> with
   <TT>pass&nbsp;...&nbsp;!download&nbsp;...</TT>. This may be a
   faster alternative than using lots of <TT>s@from@to@</TT> rewrites
   for 1-1 mapping since it will be faster to search the B-tree than
   perform a bunch of string edits.
  </P>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Expressionlists">Expressionlists</A>
  </H3>

  <P>
   The expressionlist file format is lines with regular expressions as
   described in regex(5). Of most interrest is:
  </P>

  <TABLE CELLPADDING=1 CELLSPACING=0 BORDER=0>
   <TR>
    <TH VALIGN=TOP>
     <A NAME="Regular expressions"></A> <TT><B>.</B></TT>
    </TH>
    <TD VALIGN=TOP>
     Matches any single character (use "<TT>\.</TT>" to match a
     "<TT>.</TT>").
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>[abc]</B></TT>
    </TH>
    <TD VALIGN=TOP>
     Matches one of the characters ("<TT>[abc]</TT>" matches a
     single "<TT>a</TT>" <U>or</U> "<TT>b</TT>" <U>or</U>
     "<TT>c</TT>").
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>[c-g]</B></TT>
    </TH>
    <TD VALIGN=TOP>
     Matches one of the characters in the range ("<TT>[c-g]</TT>"
     matches a single "<TT>c</TT>" <U>or</U> "<TT>d</TT>" <U>or</U>
     "<TT>e</TT>" <U>or</U> "<TT>f</TT>" <U>or</U> "<TT>g</TT>".<BR>
     "<TT>[a-z0-9]</TT>" matches any single letter or digit.<BR>
     "<TT>[-/.:?]</TT>" matches any single "<TT>-</TT>" <U>or</U>
     "<TT>/</TT>" <U>or</U> "<TT>.</TT>" <U>or</U> "<TT>:</TT>"
     <U>or</U> "<TT>?</TT>".).
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>?</B></TT>
    </TH>
    <TD VALIGN=TOP>
     None or one of the preceding ("<TT>words?</TT>" will match
     "<TT>word</TT>" and "<TT>words</TT>".<BR> "<TT>[abc]?</TT>"
     matches a single "<TT>a</TT>" <U>or</U> "<TT>b</TT>" <U>or</U>
     "<TT>c</TT>" <U>or</U> nothing (i.e.&nbsp;"")).
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>*</B></TT>
    </TH>
    <TD VALIGN=TOP>
     None or more of the preceding ("<TT>words*</TT>" will match
     "<TT>word</TT>", "<TT>words</TT>" and
     "<TT>wordsssssss</TT>". "<TT>.*</TT>" will match anything
     including nothing).
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>+</B></TT>
    </TH>
    <TD VALIGN=TOP>
     One or more of the preceding ("<TT>xxx+</TT>" will match a
     sequence of 3 or more "<TT>x</TT>").
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>(expr1|expr2)</B></TT>
    </TH>
    <TD VALIGN=TOP>
     One of the expressions, which in turn may contain a similar
     construction ("<TT>(foo|bar)</TT>" will match "<TT>foo</TT>"
     <U>or</U> "<TT>bar</TT>".<BR> "<TT>(foo|bar)?</TT> will match
     "<TT>foo</TT>" <U>or</U> "<TT>bar</TT>" <U>or</U> nothing
     (i.e.&nbsp;"")).
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>$</B></TT>
    </TH>
    <TD VALIGN=TOP>
     The end of the line ("<TT>(foo|bar)$</TT>" will match
     "<TT>foo</TT>" <U>or</U> "<TT>bar</TT>"only at the end of a
     line).
    </TD>
   </TR>
   <TR>
    <TH VALIGN=TOP>
     <TT><B>\<I>x</I></B></TT>
    </TH>
    <TD VALIGN=TOP>
     Disable the special meaning of <TT><B><I>x</I></B></TT> where
     <TT><B><I>x</I></B></TT> is one of the special regex characters
     "<TT><B>.?*+()^$[]{}\</B></TT>"&nbsp; ("<TT>\.</TT>" will match a
     single "<TT>.</TT>", "<TT>\\</TT>" a single "<TT>\</TT>" etc.)
    </TD>
   </TR>
  </TABLE>

  <P>
   Thus a start to block possible sexual material by expression match
   could look like:
  </P>

  <DL>
   <DD>
    <TT>
     (^|[-\?+=/_])(bondage|boobs?|busty?|hardcore|porno?|sex|xxx+)([-\?+=/_]|$)
    </TT>
   </DD>
  </DL><BR>

 <B>Notes:</B>
  <UL>
   <LI>
    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 "Essex", "Sussex", "breastcancer",
    "www.x.org" 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.<BR><BR>
   </LI>
   <LI>
    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.<BR><BR>
   </LI>
   <LI>
    <A NAME="Sample adultdb"></A>There is a rich set of sample files
    for a group of supposedly pornographic sites under
    <TT>samples/dest/adult</TT> in the source tree that you can use as
    a start if porn blocking is one of your tasks. <B>Please note:</B>
    We recommend that you review these lists before using them. Those
    domains and urls have been collected <EM>automagically</EM> 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 <A
    HREF="mailto:squidguard@squidguard.org?subject=squidGuard%20blacklist%20error">report</A>
    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!)<BR><BR>
   </LI>
   <LI>
    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:
    <DL>
     <DD>
      <TT>
       chmod&nbsp;640&nbsp;/<I>wherever</I>/filter/db/dest/adult/*<BR>
       chown&nbsp;<I>cache_effective_user</I>&nbsp;/<I>wherever</I>/filter/db/dest/adult/*<BR>
       chgrp&nbsp;<I>cache_effective_group</I>&nbsp;/<I>wherever</I>/filter/db/dest/adult/*
      </TT>
     </DD>
    </DL>
    where <TT>cache_effective_user</TT> and
    <TT>cache_effective_group</TT> are the values for the
    corresponding tags as defined in <TT>squid.conf</TT>.<BR><BR>
   </LI>
  </UL>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Prebuilt">Prebuilt databases</A>
  </H3>

  <H4>
   <A NAME="Create">Creating a prebuilt database</A>
  </H4>

  <P>
   To convert a domainlist or urllist from plain text file to a
   prebuilt database use:
   <DL>
    <DD>
     <TT>
      squidGuard -C <I>listfile</I>
     </TT>
    </DD>
   </DL>
   and send Squid a <TT>HUP</TT> signal to respawn squidGuard.  Note:
   <TT><I>listfile</I></TT> is the absolute plain text filename or
   relative to <TT>dbhome</TT>.
  </P>

  <H4>
   <A NAME="Update">Updating a prebuilt database</A>
  </H4>

  <P>
   To add and remove entries from a prebuilt database in runtime put
   the changes in a diff file (<TT><I>file</I>.diff</TT> for
   <TT><I>file</I>.db</TT>) with the following simple format:
   <DL>
    <DD>
     <TT>
      +new
      <BR>
      -old
      <BR>
      ...
     </TT>
    </DD>
   </DL>
   Then use:
   <DL>
    <DD>
     <TT>
      squidGuard -u
     </TT>
    </DD>
   </DL>
   and remove the diff files. The changes should take effect
   immediately.
  </P>

  <H2>
   <IMG SRC="/images/arrow-red.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Tuning">Tuning hints</A>
  </H2>

  <P>
   For optimal performance try:
  </P>

  <UL>
   <LI>
    limiting both the number of regular expressions and their
    complexity. Use domainlists and/or urllists where possible.
   </LI>
   <LI>
    limiting the number of rewrite rules. Use redirectors where
    possible.
   </LI>
   <LI>
    limiting the number of useless url list entries. Move the
    domainnames to the domainlist and remove redundant urllist entries
    where aplicable.
   </LI>
   <LI>
    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).
   </LI>
  </UL>


  <H2>
   <IMG SRC="/images/arrow-red.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="Examples">Working configuration examples</A>
  </H2>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="example00" HREF="examples/00.conf">Example 0</A> - The
   absolutely minimal <EM>do nothing</EM> config:
  </H3>

  <P>
   The absolutely minimal config file is an emty but existing file
   (i.e. <B><TT>squidGuard -c /dev/null</TT></B>) which is equivalent
   to:
  </P>

  <TT>
   <PRE>
     acl {
	  default {
	       pass all
	  }
     }
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="example01" HREF="examples/01.conf">Example 1</A><A
   NAME="Minimal"></A> - The recommended minimal <EM>do nothing</EM>
   config:
  </H3>

  <P>
   We do recommend, for clarity, to say explicitly what squidGuard is
   expected to do (makes things less magic for a new operator):
  </P>

  <TT>
   <PRE>
     logdir /usr/local/squidGuard/log

     acl {
	 default {
	     pass all
	 }
     }
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="example02" HREF="examples/02.conf">Example 2</A> -
   Limiting the access to one destination group only:
  </H3>

  <TT>
   <PRE>
     logdir /usr/local/squidGuard/log
     dbhome /usr/local/squidGuard/db

     dest local {
	 domainlist local/domains
     }

     acl {
	 default {
	     pass local none
	     redirect http://localhost/cgi/blocked?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&url=%u
	 }
     }
   </PRE>
  </TT>

  <P>
   This implies there must be a domain list file "<A
   HREF="examples/02.domains"><TT>/usr/local/squidGuard/db/local/domains</TT></A>"
   that may simply look like:
  </P>

  <TT>
   <PRE>
     eltele.no
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="example03" HREF="examples/03.conf">Example 3</A> -
   Blocking the access for unknown or unprivileged clients:
  </H3>

  <TT>
   <PRE>
     logdir /usr/local/squidGuard/log
     dbhome /usr/local/squidGuard/db

     src privileged {
	 ip	10.0.0.1 10.0.0.73 10.0.0.233	# ONE OF single clients
	 ip	10.0.0.10-10.0.0.20		# OR WITHIN range 10.0.0.10 - 10.0.0.20
	 ip	10.0.1.32/27			# OR WITHIN range 10.0.1.32 - 10.0.1.63
	 ip	10.0.2.0/255.255.255.0		# OR WITHIN range 10.0.2.0  - 10.0.2.255
						# AND
	 domain foo.bar				# MATCH foo.bar. OR *.foo.bar.
     }

     acl {
	 privileged {
	     pass all
	 }

	 default {
	     pass none
	     redirect http://info.foo.bar/cgi/blocked?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&url=%u
	 }
     }
   </PRE>
  </TT>

  <P>
   Using client domainname match implies reverse lookup is enabled
   (<EM>log_fqdn on</EM>) in <TT>squid.conf</TT>.
  </P>

  <TT>
   <PRE>
     eltele.no
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="example04" HREF="examples/04.conf">Example 4</A> -
   Blocking inappropriate sites:
  </H3>

  <TT>
   <PRE>
     logdir /usr/local/squidGuard/log
     dbhome /usr/local/squidGuard/db

     dest porn {
	 domainlist porn/domains
	 urllist    porn/urls
     }

     acl {
	 default {
	     pass !porn all
	     redirect http://localhost/cgi/blocked?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&url=%u
	 }
     }
   </PRE>
  </TT>

  <P>
   This implies there must be a domain list file "<A
   HREF="examples/04.domains"><TT>/usr/local/squidGuard/db/porn/domains</TT></A>"
   and a domain list file "<A
   HREF="examples/04.urls"><TT>/usr/local/squidGuard/db/porn/urls</TT></A>". The
   <A HREF="examples/04.domains">domain list file</A> may have a
   zillion lines like:
  </P>

  <TT>
   <PRE>
     porn.com
     sex.com
   </PRE>
  </TT>

  <P>
   The "<A HREF="examples/04.urls">url list file</A> may have an other
   zillion lines like:
  </P>

  <TT>
   <PRE>
     foo.com/~porn
     bar.com/img/sex
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="example05" HREF="examples/05.conf">Example 5</A> -
   Blocking inappropriate sites for some users and blocking unknown
   clients:
  </H3>

  <TT>
   <PRE>
     logdir /usr/local/squidGuard/log
     dbhome /usr/local/squidGuard/db

     src grownups {
	 ip	   10.0.0.0/24	  # range 10.0.0.0  - 10.0.0.255
			       # AND
	 user   foo bar	  # ident foo or bar
     }

     src kids {
	 ip	   10.0.0.0/22	  # range 10.0.0.0 - 10.0.3.255
     }

     dest porn {
	 domainlist porn/domains
	 urllist    porn/urls
     }

     acl {
	 grownups {
	     pass all
	 }

	 kids {
	     pass !porn all
	 }

	 default {
	     pass none
	     redirect http://info.foo.bar/cgi/blocked?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&targetgroup=%t&url=%u
	 }
     }
   </PRE>
  </TT>

  <P>
   Using userident match implies RFC931/ident lookup is enabled in
   <TT>squid.conf</TT>, optionally only for the actual client groups,
   and that foo and bar's workstations must <A
   HREF="/links/#Identd">support RFC931</A>.
  </P>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="example06" HREF="examples/06.conf">Example 6</A> -
   Blocking inappropriate sites partially with regex:
  </H3>

  <P>
   &nbsp;<TT><B>+</B></TT> ensuring local and good sites are passed
   even if they would match a blocking regex:
   <BR>
   &nbsp;<TT><B>+</B></TT> limiting the usage of IP-address URLs:
  </P>

  <TT>
   <PRE>
     logdir /usr/local/squidGuard/log
     dbhome /usr/local/squidGuard/db

     dest local {
	 domainlist     local/domains
     }

     dest good {
	 domainlist     local/domains
     }

     dest porn {
	 domainlist     porn/domains
	 urllist        porn/urls
	 expressionlist porn/expressions
     }

     acl {
	 default {
	     pass local good !in-addr !porn all
	     redirect http://localhost/cgi/blocked?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&url=%u
	 }
     }
   </PRE>
  </TT>

  <H3>
   <IMG SRC="/images/arrow-green.gif" BORDER=0 VALIGN=BOTTOM>
   <A NAME="example07" HREF="examples/07.conf">Example 7</A> -
   Blocking inappropriate sites within business hours only:
  </H3>

  <UL>
    Lets extend <A HREF="#example05">example 5</A> with:
   <LI>
     a time constraint on censorship
   </LI>
   <LI>
    logging redirections of inappropriate sites anonymized
   </LI>
   <LI>
    redirecting inappropriate sites specially.
   </LI>
   <LI>
    and still protecting the kids 24h.
   </LI>
  </UL>

  <TT>
   <PRE>
     logdir /usr/local/squidGuard/log
     dbhome /usr/local/squidGuard/db

     time leisure-time {
	 weekly * 00:00-08:00 17:00-24:00	# night and evening
	 weekly fridays 16:00-17:00		# weekend
	 weekly saturdays sundays		# weekend
	 date	*.01.01				# New Year's Day
	 date	*.05.01				# Labour Day
	 date	*.05.17				# National Day
	 date	*.12.24 12:00-24:00		# Christmas Eve
	 date	*.12.25				# Christmas Day
	 date	*.12.26				# Boxing Day
	 date	1999.03.31 12:00.24:00		# Ash Wednesday
	 date	1999.04.01-1999.04.05		# Easter
	 date	1999.05.13 1999.05.24		# Ascension Day and Whitsun
	 date	2000.04.19 12:00.24:00		# Ash Wednesday y2000
	 date	2000.04.20-2000.04.24		# Easter y2000
	 date	2000.06.01 2000.06.12		# Ascension Day and Whitsun y2000
     }

     src grownups {
	 ip	10.0.0.0/24			# range 10.0.0.0  - 10.0.0.255
						# AND
	 user	foo bar				# ident foo or bar
     }

     src kids {
	 ip	10.0.0.0/22			# range 10.0.0.0 - 10.0.3.255
     }

     dest porn {
	 domainlist	porn/domains		# file listing domains	(clear text)
	 urllist	porn/urls		# file listing URLs	(clear text)
	 expressionlist porn/expressions	# file with expressions (clear text regex)
	 redirect       302:http://info.foo.bar/images/blocked.gif
						# redirect matches to this URL
	 log anonymous  porn.log		# log redirects anonymized to logdir/porn.log
     }

     acl {
	 grownups within leisure-time {
	     pass all				# don't censor peoples leisure-time
	 } else {
	     pass !in-addr !porn all		# restrict access during business hours
	 }

	 kids {
	     pass !porn all			# protect the kids 24h anyway
	 }

	 default {
	     pass none				# reject unknown clients
	     redirect http://info.foo.bar/cgi/blocked?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&targetgroup=%t&url=%u
	 }
     }
   </PRE>
  </TT>

  <BR>
  <HR WIDTH=40%>
  <BR>
  <TABLE ALIGN=CENTER CELLPADDING=3 CELLSPACING=0 BORDER=0>
   <TR>
    <TD ALIGN=CENTER>
     <A HREF="http://www.gnu.org/"><IMG
     SRC="http://info.ost.eltele.no/icons/gnu-logo.gif" BORDER=0
     VALIGN=TOP></A>
    </TD>
    <TD ALIGN=CENTER>
     <A HREF="http://www.perl.com/pub/"><IMG
     SRC="http://info.ost.eltele.no/icons/perl-logo.gif" BORDER=0
     VALIGN=TOP></A>
    </TD>
    <TD ALIGN=CENTER>
     <A HREF="http://www.sun.com/solaris/"><IMG
     SRC="http://info.ost.eltele.no/icons/solaris-logo.gif" BORDER=0
     VALIGN=BOTTOM></A>
    </TD>
    <TD ALIGN=CENTER>
     <A HREF="http://www.sun.com/servers/"><IMG
     SRC="http://info.ost.eltele.no/icons/sun-logo.gif" BORDER=0
     VALIGN=BOTTOM></A>
    </TD>
    <TD ALIGN=CENTER>
     <A HREF="http://www.ost.eltele.no/"><IMG
      SRC="http://info.ost.eltele.no/icons/eltele-logo.gif" BORDER=0
      VALIGN=BOTTOM></A>
    </TD>
   </TR>
  </TABLE>
  <TABLE ALIGN=CENTER CELLPADDING=3 CELLSPACING=0 BORDER=0>
   <TR>
    <TD ALIGN=CENTER>
     <A HREF="http://www.apache.org/httpd.html"><IMG
     SRC="http://info.ost.eltele.no/icons/apache-logo.gif" BORDER=0
     VALIGN=BOTTOM></A>
    </TD>
    <TD ALIGN=CENTER>
     <A HREF="http://www.squid-cache.org/"><IMG
     SRC="http://info.ost.eltele.no/icons/squid-logo.gif" BORDER=0
     VALIGN=BOTTOM></A>
    </TD>
    <TD ALIGN=CENTER>
     <A HREF="http://www.squidguard.org/"><IMG
     SRC="http://info.ost.eltele.no/freeware/squidGuard/squidGuard.gif"
     BORDER=0 VALIGN=BOTTOM></A>
    </TD>
   </TR>
  </TABLE>
  <TABLE ALIGN=CENTER CELLPADDING=3 CELLSPACING=0 BORDER=0>
   <TR>
    <TD ALIGN=CENTER>
     <A HREF="http://info.ost.eltele.no/freeware/identd/"><IMG
     SRC="http://info.ost.eltele.no/freeware/identd/identd.gif"
     BORDER=0 VALIGN=BOTTOM></A>
    </TD>
   </TR>
  </TABLE>


 </BODY>
</HTML>