Updates for recent changes.
[privoxy.git] / doc / source / user-manual.sgml
1 <!DOCTYPE Article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
2 <!--
3 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
4  File        :  $Source: /cvsroot/ijbswa/current/doc/source/user-manual.sgml,v $
5
6  Purpose     :  user manual
7                 This file belongs into
8                 ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
9                 
10  $Id: user-manual.sgml,v 1.22 2001/11/05 23:57:51 hal9 Exp $
11
12  Written by and Copyright (C) 2001 the SourceForge
13  IJBSWA team.  http://ijbswa.sourceforge.net
14
15  Based on the Internet Junkbuster originally written
16  by and Copyright (C) 1997 Anonymous Coders and 
17  Junkbusters Corporation.  http://www.junkbusters.com
18 -->
19
20 <!--
21 Sun 09/23/01 08:53:31 PM 
22
23 This is an unfinished, rough draft. Anyone reading this, believe let me 
24 know errors!!!!! Stefan, especially you!
25
26 Hal Burgiss <hal@foobox.net>
27 -->
28
29 <article id="index">
30 <artheader>
31 <title>Junkbuster User Manual</title>
32
33 <pubdate>$Id: user-manual.sgml,v 1.22 2001/11/05 23:57:51 hal9 Exp $</pubdate>
34
35 <authorgroup>
36  <author>
37   <affiliation>
38    <orgname>By: Junkbuster Developers</orgname>
39    </affiliation>
40  </author>
41 </authorgroup>
42
43 <abstract>
44  <para>
45   The user manual gives the users information on how to install and configure
46   <application>Internet Junkbuster</application>. <application>Internet
47   Junkbuster</application> is an application that provides privacy and
48   security to users of the World Wide Web.
49  </para>
50  <para>
51 You can find the latest version of the user manual at  <ulink url="http://ijbswa.sourceforge.net/user-manual/">http://ijbswa.sourceforge.net/user-manual/</ulink>.
52  </para>
53
54  <para>
55   Feel free to send a note to the developers at <email>ijbswa-developers@lists.sourceforge.net</email>.
56  </para>
57 </abstract>
58
59 </artheader>
60
61
62 <!--   ~~~~~       New section      ~~~~~     -->
63
64 <sect1 id="introduction"><title>Introduction</title>
65 <para>
66  <application>Internet Junkbuster</application> is a web proxy with advanced
67  filtering capabilities for protecting privacy, filtering web page content,
68  managing cookies, controlling access, and removing ads, banners, pop-ups and
69  other obnoxious Internet Junk. <application>Junkbuster</application> has a
70  very flexible configuration and can be customized to suit individual needs
71  and tastes. <application>Internet Junkbuster</application> has application
72  for both stand-alone systems and multi-user networks.
73 </para>
74
75 <para>
76  This documentation is included with the current development version of
77  <application>Internet Junkbuster</application> and is incomplete at this
78  point. The most up to date reference for the time being is still the comments
79  in the source files and in the individual configuration files. Development
80  of version 3.0 is currently underway, and includes many significant changes and
81  enhancements over earlier verions. The target release date for stable v3.0 is 
82  December 2001.
83 </para>
84
85 <para>
86  Since this is a development version, some features are in the process of
87  being implemented. This documentation may be slightly out of sync as a 
88  result. And there <emphasis>are</emphasis> bugs, though hopefully not many! 
89 </para>
90
91
92 <!--   ~~~~~       New section      ~~~~~     -->
93 <sect2>
94 <title>New Features</title>
95 <para>
96  In addition to <application>Junkbuster's</application> traditional features
97  of ad and banner blocking and cookie management, this is a list of new
98  features currently under development:
99 </para>
100
101 <para>
102  <itemizedlist>
103
104  <listitem>
105   <para>
106    A browser based configuration utility (WIP at 
107    <ulink url="http://i.j.b">http://i.j.b</ulink>).
108   </para>
109  </listitem> 
110
111  <listitem>
112   <para>
113    Modularized configuration that will allow for system wide settings, and
114    individual user settings. (not implemented yet)
115   </para>
116  </listitem> 
117
118  <listitem>
119   <para>
120     Blocking of annoying pop-up browser windows (previously available as a
121     patch). 
122   </para>
123  </listitem> 
124
125  <listitem>
126   <para>
127    Support for HTTP/1.1 (partially implemented at this point).
128   </para>
129  </listitem> 
130
131  <listitem>
132   <para>
133    Support for Perl Compatible Regular Expressions in the configuration files, and 
134    generally a more sophisticated configuration syntax over previous versions.
135   </para>
136  </listitem> 
137
138  <listitem>
139   <para>
140    Web page content filtering.
141   </para>
142  </listitem> 
143  
144  <listitem>
145   <para>
146    Multi-threaded.
147   </para>
148  </listitem> 
149
150  </itemizedlist>
151 </para>
152
153 <para>
154  In addition, the configuration is more versatile overall.
155 </para>
156
157 </sect2>
158
159 </sect1>
160
161 <!--  ~  End section  ~  -->
162
163
164 <!--   ~~~~~       New section      ~~~~~     -->
165 <sect1 id="installation"><title>Installation</title>
166 <para>
167  <application>Junkbuster</application> is available as raw source code, or
168  pre-compiled binaries. See the <ulink
169  url="http://sourceforge.net/projects/ijbswa/">Junkbuster Home Page</ulink>
170  for current release info. <application>Junkbuster</application> is also available
171  via <ulink
172  url="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ijbswa/current/">CVS</ulink>.
173  This is the recommended approach at this time. But please be aware that CVS 
174  is constantly changing, and it may break in mysterious ways.
175 </para>
176
177 <!--   ~~~~~       New section      ~~~~~     -->
178 <sect2 id="installation-source"><title>Source</title>
179 <para>
180  For gzipped tar archives, unpack the source:
181 </para>
182
183 <para>
184  <screen>
185  tar xzvf ijb_source_* [.tgz or .tar.gz]
186  cd ijb_source_2.9.9_alpha
187  </screen>
188 </para>
189
190 <para>
191  For retrieving the current CVS sources, you'll need the CVS 
192  package installed first. To download CVS source:
193 </para>
194
195 <para>
196  <screen>
197   cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login
198   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current
199   cd current
200  </screen>
201 </para>
202
203 <para>
204  This will create a directory named <filename>current/</filename>, which will 
205  contain the source tree.
206 </para>
207
208 <para>
209  Then, in either case, to build from tarball/CVS source:
210 </para>
211
212 <para>
213  <screen>
214  ./configure    (--help to see options)
215  make           (the make from gnu, gmake for *BSD) 
216  su 
217  make -n install        (to see where all the files will go)
218  make install           (to really install)
219  </screen>
220 </para>
221
222 <para>
223  For Redhat and SuSE Linux RPM packages, see below.
224 </para>
225
226 </sect2>
227
228
229 <!--   ~~~~~       New section      ~~~~~     -->
230 <sect2 id="installation-rh"><title>Red Hat</title>
231 <para>
232  To build Redhat RPM packages, install source as above. Then:
233 </para>
234
235 <para>
236  <screen>
237  autoheader   [suggested for CVS source]
238  autoconf     [suggested for CVS source]
239  ./configure
240  make redhat-dist
241  </screen>
242 </para>
243
244 <para>
245  This will create both binary and src RPMs in the usual places. Example:
246 </para>
247
248 <para>
249  &nbsp;&nbsp;&nbsp;/usr/src/redhat/RPMS/i686/junkbuster-2.9.8-1.i686.rpm
250 </para>
251 <para>
252  &nbsp;&nbsp;&nbsp;/usr/src/redhat/SRPMS/junkbuster-2.9.9-1.src.rpm
253 </para>
254
255 <para>
256  To install, of course:
257 </para>
258
259 <para>
260  <screen>
261  rpm -Uvv /usr/src/redhat/RPMS/i686/junkbuster-2.9.9-1.i686.rpm
262  </screen>
263 </para>
264
265 <para>
266  This will place the <application>Junkbuster</application> configuration 
267  files in <filename>/etc/junkbuster/</filename>, and log files in 
268  <filename>/var/log/junkbuster/</filename>.
269 </para>
270
271 </sect2>
272
273 <!--   ~~~~~       New section      ~~~~~     -->
274 <sect2 id="installation-suse"><title>SuSE</title>
275 <para>
276  To build SuSE RPM packages, install source as above. Then:
277 </para>
278
279 <para>
280  <screen>
281  autoheader   [suggested for CVS source]
282  autoconf     [suggested for CVS source]
283  ./configure
284  make suse-dist
285  </screen>
286 </para>
287
288 <para>
289  This will create both binary and src RPMs in the usual places. Example:
290 </para>
291
292 <para>
293  &nbsp;&nbsp;&nbsp;/usr/src/packages/RPMS/i686/junkbuster-2.9.9-1.i686.rpm
294 </para>
295 <para>
296  &nbsp;&nbsp;&nbsp;/usr/src/packages/SRPMS/junkbuster-2.9.9-1.src.rpm
297 </para>
298
299 <para>
300  To install, of course:
301 </para>
302
303 <para>
304  <screen>
305  rpm -Uvv /usr/src/packages/RPMS/i686/junkbuster-2.9.9-1.i686.rpm
306  </screen>
307 </para>
308
309 <para>
310  This will place the <application>Junkbuster</application> configuration 
311  files in <filename>/etc/junkbuster/</filename>, and log files in 
312  <filename>/var/log/junkbuster/</filename>.
313 </para>
314
315 </sect2>
316
317
318 <!--   ~~~~~       New section      ~~~~~     -->
319 <sect2 id="installation-os2"><title>OS/2</title>
320
321 <!--
322 Thanx David Schmidt!
323 -->
324
325 <para>
326  The OS/2 version of <application>Junkbuster</application> requires the EMX
327  runtime library to be installed.  The EMX runtime library is available on
328  the hobbes OS/2 archive, among many other locations:
329  <ulink url="http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&amp;button=Search&amp;key=emxrt.zip&amp;stype=all&amp;sort=type&amp;dir=%2Fpub%2Fos2%2Fdev%2Femx%2Fv0.9d">http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&amp;button=Search&amp;key=emxrt.zip&amp;stype=all&amp;sort=type&amp;dir=%2Fpub%2Fos2%2Fdev%2Femx%2Fv0.9d</ulink>
330 </para>
331
332 <para>
333  <application>Junkbuster</application> is packaged in a WarpIN self-
334  installing archive.  The self-installing program will be named depending
335  on the release version, something like:
336  <filename>ijbos123.exe</filename>.  In order to install it, simply run
337  this executable or double-click on its icon and follow the WarpIN
338  installation panels.  A shadow of the <application>Junkbuster</application>
339  executable will be placed in your startup folder so it will start 
340  automatically whenever OS/2 starts.
341 </para>
342
343 <para>
344  The directory you choose to install <application>Junkbuster</application>
345  into will contain all of the configuration files.
346 </para>
347
348 <para>
349  If you would like to build binary images on OS/2 yourself, you will need
350  a working EMX/GCC environment, plus several Unix-like tools.  The Hobbes
351  OS/2 archive is a good place to start when building such an environment.
352  A set of Unix-like tools named gnupack is located here:
353  <ulink url="http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&amp;key=gnupack&amp;stype=all&amp;sort=type&amp;dir=%2Fpub%2Fos2%2Fapps">http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&amp;key=gnupack&amp;stype=all&amp;sort=type&amp;dir=%2Fpub%2Fos2%2Fapps</ulink>
354 </para>
355 <para>
356  Once you have the source code unpacked as above, you can build the binaries
357  from the <filename>current/</filename> directory:
358 </para>
359
360 <para>
361  <screen>
362  autoconf
363  sh configure
364  make
365  </screen>
366 </para>
367
368 </sect2>
369
370
371 <!--   ~~~~~       New section      ~~~~~     -->
372 <sect2 id="installation-win"><title>Windows</title>
373 <para>Click-click. (I need help on this. Not a clue here. Also for 
374 configuration section below. HB.)
375 </para>
376 </sect2>
377
378 <!--   ~~~~~       New section      ~~~~~     -->
379 <sect2 id="installation-other"><title>Other</title>
380 <para>
381  Some quick notes on other Operating Systems.
382 </para>
383
384 <para>
385  For FreeBSD (and other *BSDs?), the build will need <command>gmake</command> 
386  instead of the included <command>make</command>. <command>gmake</command> is
387  available from <ulink url="http://www.gnu.org">http://www.gnu.org</ulink>.
388  The rest should be the same as above for Linux/Unix.
389 </para>
390
391 </sect2>
392
393 </sect1>
394
395 <!--  ~  End section  ~  -->
396
397
398 <!--   ~~~~~       New section      ~~~~~     -->
399 <sect1 id="configuration"><title>Junkbuster Configuration</title>
400 <para>
401  For Unix, *BSD and Linux, all configuraton files are located in
402  <filename>/etc/junkbuster/</filename> by default. For MS Windows and OS/2,
403  these are all in the same directory as the
404  <application>Junkbuster</application> executable. The name and number of
405  configuration files has changed from previous versions, and is subject to
406  change as development progresses.
407 </para>
408
409 <para>
410  The installed defaults provide a reasonable starting point. For the
411  time being, there are only three default configuration files (this will
412  change in time):
413 </para>
414
415 <para>
416  <itemizedlist>
417
418   <listitem>
419    <para>
420      The main configuration file is named <filename>config</filename>
421      on Linux, Unix, BSD, and OS/2, and <filename>config.txt</filename> on
422      Windows. On Amiga, it is
423      <filename>AmiTCP:db/junkbuster/config</filename>.
424    </para>
425   </listitem> 
426
427   <listitem>
428    <para>
429     The <filename>ijb.action</filename> file is used  to define various 
430     <quote>actions</quote> relating to images, banners, pop-ups, access
431     restrictions, banners and cookies. There is a CGI based editor for this
432     file that can be accessed via <ulink
433     url="http://i.j.b./">http://i.j.b./</ulink>. This is the easiest method of
434     configuring actions. (Still under active development.)
435    </para>
436   </listitem> 
437
438   <listitem>
439    <para>
440     The <filename>re_filterfile</filename> file can be used to rewrite the raw
441     page content, including text as well as embedded HTML and JavaScript.
442    </para>
443   </listitem> 
444
445  </itemizedlist>
446 </para>
447
448 <para>
449  <filename>ijb.action</filename> and <filename>re_filterfile</filename> 
450  can use Perl style regular expressions for maximum flexibility. All files use
451  the <quote><literal>#</literal></quote> character to denote a comment. Such
452  lines are not processed by <application>Junkbuster</application>. After
453  making any changes, restart <application>Junkbuster</application> in order
454  for the changes to take effect.
455 </para>
456
457 <para>
458  While under development, the configuration content is subject to change. 
459  The below documentation may not be accurate by the time you read this. 
460  Also, what constitutes a <quote>default</quote> setting, may change, so 
461  please check all your configuration files on important issues.
462 </para>
463
464 <!--   ~~~~~       New section      ~~~~~     -->
465
466 <sect2>
467 <title>The Main Configuration File</title>
468 <para>
469  Again, the main configuration file is named <filename>config</filename> on
470  Linux/Unix/BSD and OS/2, and <filename>config.txt</filename> on Windows.
471  Configuration lines consist of an initial keyword followed by a list of
472  values, all separated by whitespace (any number of spaces or tabs). For
473  example:
474 </para>
475
476 <para>
477  <literal>
478   <MSGText> 
479    <literallayout>
480   <emphasis>blockfile blocklist.ini</emphasis>
481    </literallayout>
482   </MSGText> 
483  </literal>
484 </para>
485
486 <para>
487  Indicates that the blockfile is named <quote>blocklist.ini</quote>.
488 </para>
489
490 <para>
491  A <quote><literal>#</literal></quote> indicates a comment.  Any part of a
492  line following a <quote><literal>#</literal></quote> is ignored, except if
493  the <quote><literal>#</literal></quote> is preceded by a
494  <quote><literal>\</literal></quote>.
495 </para>
496
497 <para>
498  Thus, by placing a <quote><literal>#</literal></quote> at the start of an
499  existing configuration line, you can make it a comment and it will be treated
500  as if it weren't there. This is called <quote>commenting out</quote> an
501  option and can be useful to turn off features: If you comment out the
502  <quote>logfile</quote> line, <application>junkbuster</application> will not
503  log to a file at all. Watch for the <quote>default:</quote> section in each
504  explanation to see what happens if the option is left unset (or commented
505  out). 
506 </para>
507
508 <para>
509  Long lines can be continued on the next line by using a
510  <quote><literal>\</literal></quote> as the very last character.
511 </para>
512
513 <para>
514  There are various aspects of <application>Junkbuster</application> behavior 
515  that can be tuned.
516 </para>
517
518
519 <!--   ~~~~~       New section      ~~~~~     -->
520
521 <sect3>
522 <title>Defining Other Configuration Files</title>
523
524 <para>
525  <application>Junkbuster</application> can use a number of other files to tell it
526  what ads to block, what cookies to accept, etc.  This section of the
527  configuration file tells <application>Junkbuster</application> where to find
528  all those other files. 
529 </para>
530
531 <para>
532  On <application>Windows</application>, <application>Junkbuster</application>
533  looks for these files in the same directory as the executable.  On Unix and 
534  OS/2, <application>Junkbuster</application> looks for these files in the current
535  working directory.  In either case, an absolute path name can be used to
536  avoid problems.
537 </para>
538
539 <para>
540  When development goes modular and multiuser, the blocker, filter, and
541  per-user config will be stored in subdirectories of <quote>confdir</quote>.
542  For now, only <filename>confdir/templates</filename> is used for storing HTML
543  templates for CGI results. 
544 </para>
545
546 <para>
547  The location of the configuration files:
548 </para>
549
550 <para>
551  <literal>
552   <MSGText> 
553    <literallayout>
554   <emphasis>confdir  /etc/junkbuster</emphasis>       # No trailing /, please.
555    </literallayout>
556   </MSGText> 
557  </literal>
558 </para>
559
560 <para>
561  The directory where all logging (i.e. <filename>logfile</filename> and 
562  <filename>jarfile</filename>) takes place. No trailing
563  <quote><literal>/</literal></quote>, please: 
564 </para>
565
566 <para>
567  <literal>
568   <MSGText> 
569    <literallayout>
570   <emphasis>logdir  /var/log/junkbuster</emphasis>
571    </literallayout>
572   </MSGText> 
573  </literal>
574 </para>
575
576 <para>
577  Note that all file specifications below are relative to 
578  the above two directories!
579 </para>
580
581 <para>
582  The <quote>ijb.action</quote> file contains patterns to specify the actions to
583  apply to requests for each site. Default: Cookies to and from all
584  destinations are kept only during the current browser session (i.e. they 
585  are not saved to disk). Popups are disabled for all sites. All sites are
586  filtered if <quote>re_filterfile</quote> specified. No sites are blocked. An
587  empty image is displayed for filtered ads and other images (formerly
588  <quote>tinygif</quote>). The syntax of this file is explained in detail <link
589  linkend="actionsfile">below</link>.
590 </para>
591
592 <para>
593  <literal>
594   <MSGText> 
595    <literallayout>
596   <emphasis>actionsfile  ijb.action</emphasis>
597    </literallayout>
598   </MSGText> 
599  </literal>
600 </para>
601
602 <para>
603  The <quote>re_filterfile</quote> file contains content modification rules.
604  These rules permit powerful changes on the content of Web pages, e.g., you
605  could disable your favourite JavaScript annoyances, rewrite the actual
606  content, or just have some fun replacing <quote>Microsoft</quote> with
607  <quote>MicroSuck</quote> wherever it appears on a Web page. Default: No
608  content modification, or whatever the developers are playing with :-/
609 </para>
610
611 <para>
612  <literal>
613   <MSGText> 
614    <literallayout>
615   <emphasis>re_filterfile  re_filterfile</emphasis>
616    </literallayout>
617   </MSGText> 
618  </literal>
619 </para>
620
621 <para>
622  The logfile is where all logging and error messages are written. The logfile
623  can be useful for tracking down a problem with
624  <application>Junkbuster</application> (e.g., it's not blocking an ad you
625  think it should block) but in most cases you probably will never look at it.
626 </para>
627
628 <para>
629  Your logfile will grow indefinitely, and you will probably want to
630  periodically remove it.  On Unix systems, you can do this with a cron job
631  (see <quote>man cron</quote>). For Redhat, a <command>logrotate</command> 
632  script has been included.
633 </para>
634
635 <para>
636  On SuSE Linux systems, you can place a line like <quote>/var/log/junkbuster.*
637  +1024k 644 nobody.nogroup</quote> in <filename>/etc/logfiles</filename>, with
638  the effect that cron.daily will automatically archive, gzip, and empty the
639  log, when it exceeds 1M size.
640 </para>
641
642 <para>
643  Default: Log to the a file named <filename>logfile</filename>. 
644  Comment out to disable logging.
645 </para>
646
647 <para>
648  <literal>
649   <MSGText> 
650    <literallayout>
651   <emphasis>logfile  logfile</emphasis>
652    </literallayout>
653   </MSGText> 
654  </literal>
655 </para>
656
657 <para>
658  The <quote>jarfile</quote> defines where
659  <application>Junkbuster</application> stores the cookies it intercepts.  Note
660  that if you use a <quote>jarfile</quote>, it may grow quite large. Default:
661  Don't store intercepted cookies.
662 </para>
663
664 <para>
665  <literal>
666   <MSGText> 
667    <literallayout>
668   <emphasis>#jarfile  jarfile</emphasis>
669    </literallayout>
670   </MSGText> 
671  </literal>
672 </para>
673
674 <para>
675  If you specify a <quote>trustfile</quote>,
676  <application>Junkbuster</application> will only allow access to sites that
677  are named in the trustfile. You can also mark sites as trusted referrers,
678  with the effect that access to untrusted sites will be granted, if a link
679  from a trusted referrer was used. The link target will then be added to the
680  <quote>trustfile</quote>. This is a very restrictive feature that typical
681  users most propably want to leave disabled. Default: Disabled, don't use the
682  trust mechanism.
683 </para>
684
685 <para>
686  <literal>
687   <MSGText> 
688    <literallayout>
689   <emphasis>#trustfile  trust</emphasis>
690    </literallayout>
691   </MSGText> 
692  </literal>
693 </para>
694  
695 <para>
696  If you use the trust mechanism, it is a good idea to write up some online
697  documentation about your blocking policy and to specify the URL(s) here. They
698  will appear on the page that your users receive when they try to access
699  untrusted content. Use multiple times for multiple URLs. Default: Don't
700  display links on the <quote>untrusted</quote> info page.
701 </para>
702
703 <para>
704  <literal>
705   <MSGText> 
706    <literallayout>
707   <emphasis>trust-info-url http://www.your-site.com/why_we_block.html</emphasis>
708   <emphasis>trust-info-url http://www.your-site.com/what_we_allow.html</emphasis>
709    </literallayout>
710   </MSGText> 
711  </literal>
712 </para>
713
714 </sect3>
715
716 <!--  ~  End section  ~  -->
717
718
719
720 <!--   ~~~~~       New section      ~~~~~     -->
721
722 <sect3>
723 <title>Other Configuration Options</title>
724
725 <para>
726  This part of the configuration file contains options that control how
727  <application>Junkbuster</application> operates.
728 </para>
729
730 <para>
731  <quote>Admin-address</quote> should be set to the email address of the proxy
732  administrator. It is used in many of the proxy-generated pages. Default:
733  fill@me.in.please.
734 </para>
735
736 <para>
737  <literal>
738   <MSGText> 
739    <literallayout>
740   <emphasis>#admin-address  fill@me.in.please</emphasis>
741    </literallayout>
742   </MSGText> 
743  </literal>
744 </para>
745
746 <para>
747  <quote>Proxy-info-url</quote> can be set to a URL that contains more info
748  about this <application>Junkbuster</application> installation, it's
749  configuration and policies. It is used in many of the proxy-generated pages
750  and its use is highly recommended in multi-user installations, since your
751  users will want to know why certain content is blocked or modified. Default:
752  Don't show a link to online documentation.
753 </para>
754
755 <para>
756  <literal>
757   <MSGText> 
758    <literallayout>
759   <emphasis>proxy-info-url  http://www.your-site.com/proxy.html</emphasis>
760    </literallayout>
761   </MSGText> 
762  </literal>
763 </para>
764
765 <para>
766  <quote>Listen-address</quote> specifies the address and port where
767  <application>Junkbuster</application> will listen for connections from your
768  Web browser.  The default is to listen on the localhost port 8000, and
769  this is suitable for most users.  (In your web browser, under proxy
770  configuration, list the proxy server as <quote>localhost</quote> and the
771  port as <quote>8000</quote>).
772 </para>
773
774 <para>
775  If you already have another service running on port 8000, or if you want to
776  serve requests from other machines (e.g. on your local network) as well, you
777  will need to override the default. The syntax is 
778  <quote>listen-address [&lt;ip-address&gt;]:&lt;port&gt;</quote>. If you leave
779  out the IP address, <application>junkbuster</application> will bind to all
780  interfaces (addresses) on your machine and may become reachable from the
781  Internet. In that case, consider using access control lists (acl's) (see
782  <quote>aclfile</quote> above), or a firewall.
783 </para>
784
785 <para>
786  For example, suppose you are running <application>Junkbuster</application> on
787  a machine which has the address 192.168.0.1 on your local private network
788  (192.168.0.0) and has another outside connection with a different address.
789  You want it to serve requests from inside only:
790 </para>
791
792 <para>
793  <literal>
794   <MSGText> 
795    <literallayout>
796   <emphasis>listen-address  192.168.0.1:8000</emphasis>
797    </literallayout>
798   </MSGText> 
799  </literal>
800 </para>
801
802 <para>
803  If you want it to listen on all addresses (including the outside
804  connection):
805 </para>
806
807 <para>
808  <literal>
809   <MSGText> 
810    <literallayout>
811   <emphasis>listen-address  :8000</emphasis>
812    </literallayout>
813   </MSGText> 
814  </literal>
815 </para>
816
817 <para>
818  If you do this, consider using ACLs (see <quote>aclfile</quote> above). Note:
819  you will need to point your browser(s) to the address and port that you have
820  configured here. Default: localhost:8000 (127.0.0.1:8000).
821 </para>
822
823 <para>
824  The debug option sets the level of debugging information to log in the
825  logfile (and to the console in the Windows version).  A debug level of 1 is
826  informative because it will show you each request as it happens.  Higher
827  levels of debug are probably only of interest to developers.
828 </para>
829
830 <Para>
831  <Literal>
832   <MSGText> 
833    <LiteralLayout>
834   debug         1 # GPC   = show each GET/POST/CONNECT request
835   debug         2 # CONN  = show each connection status
836   debug         4 # IO    = show I/O status
837   debug         8 # HDR   = show header parsing
838   debug        16 # LOG   = log all data into the logfile
839   debug        32 # FRC   = debug force feature
840   debug        64 # REF   = debug regular expression filter 
841   debug       128 #       = debug fast redirects
842   debug       256 #       = debug GIF deanimation
843   debug       512 # CLF   = Common Log Format
844   debug      1024 #       = debug kill popups
845   debug      4096 # INFO  = Startup banner and warnings.
846   debug      8192 # ERROR = Non-fatal errors
847     </LiteralLayout>
848   </MSGText>
849  </Literal>
850 </Para>
851
852 <para>
853  It is <emphasis>highly recommended</emphasis> that you enable ERROR
854  reporting (debug 8192), at least until the next stable release.
855 </para>
856
857 <para>
858  The reporting of FATAL errors (i.e. ones which crash 
859  <application>JunkBuster</application>) is always on and cannot be disabled.
860 </para>
861
862 <para>
863  If you want to use CLF (Common Log Format), you should set <quote>debug
864  512</quote> ONLY, do not enable anything else.
865 </para>
866
867 <para>
868  Multiple <quote>debug</quote> directives, are OK - they're logical-OR'd
869  together. 
870 </para>
871
872 <para>
873  <literal>
874   <MSGText> 
875    <literallayout>
876   <emphasis>debug    15     # same as setting the first 4 listed above</emphasis>
877    </literallayout>
878   </MSGText> 
879  </literal>
880 </para>
881
882 <para>
883  Default:
884 </para>
885
886 <para>
887  <literal>
888   <MSGText> 
889    <literallayout>
890   <emphasis>debug   1     # URLs</emphasis>
891   <emphasis>debug   4096  # Info</emphasis>
892   <emphasis>debug   8192  # Errors - *we highly recommended enabling this*</emphasis>
893    </literallayout>
894   </MSGText> 
895  </literal>
896 </para>
897
898 <para>
899  <application>Junkbuster</application> normally uses
900  <quote>multi-threading</quote>, a software technique that permits it to
901  handle many different requests simultaneously. In some cases you may wish to
902  disable this -- particularly if you're trying to debug a problem.  The
903  <quote>single-threaded</quote> option forces
904  <application>Junkbuster</application> to handle requests sequentially.
905  Default: Multi-threaded mode.
906 </para>
907
908 <para>
909  <literal>
910   <MSGText> 
911    <literallayout>
912   <emphasis>#single-threaded</emphasis>
913    </literallayout>
914   </MSGText> 
915  </literal>
916 </para>
917
918 <para>
919  <quote>toggle</quote> allows you to temporarily disable all
920  <application>Junkbuster's</application>  filtering. Just set <quote>toggle
921  0</quote>.
922 </para>
923
924 <para>
925  The Windows version of <application>Junkbuster</application> puts an icon in
926  the system tray, which also allows you to change this option.  If you
927  right-click on that icon (or select the <quote>Options</quote> menu), one
928  choice is <quote>Enable</quote>. Clicking on enable toggles
929  <application>Junkbuster</application> on and off. This is useful if you want
930  to temporarily disable <application>Junkbuster</application>, e.g., to access
931  a site that requires cookies which you would otherwise have blocked. This can also
932  be toggled via a web browser at the <application>Junkbuster</application>
933  internal address of <ulink url="http://i.j.b./">http://i.j.b./</ulink> on 
934  any platform.
935 </para>
936
937 <para>
938  <quote>toggle 1</quote> means <application>Junkbuster</application> runs
939  normally, <quote>toggle 0</quote> means that
940  <application>Junkbuster</application> becomes a non-anonymizing non-blocking
941  proxy. Default: 1 (on). 
942 </para>
943
944 <para>
945  <literal>
946   <MSGText> 
947    <literallayout>
948   <emphasis>toggle    1</emphasis>
949    </literallayout>
950   </MSGText> 
951  </literal>
952 </para>
953
954 <para>
955  For content filtering, i.e. the <quote>+filter</quote> and
956  <quote>+deanimate-gif</quote> actions, it is neccessary that 
957  <application>Junkbuster</application> buffers the entire document body.
958  This can be potentially dangerous, since a server could just keep sending
959  data indefinitely and wait for your RAM to exhaust. With nasty consequences.
960 </para>
961
962 <para>
963  The <application>buffer-limit</application> option lets you set the maximum
964  size in Kbytes that each buffer may use. When the documents buffer exceeds
965  this size, it is flushed to the client unfiltered and no further attempt to
966  filter the rest of it is made. Remember that there may multiple threads
967  running, which might require increasing the <quote>buffer-limit</quote>
968  Kbytes <emphasis>each</emphasis>, unless you have enabled 
969  <quote>single-threaded</quote> above.
970 </para>
971
972 <para>
973  <literal>
974   <MSGText> 
975    <literallayout>
976   <emphasis>buffer-limit    4069</emphasis>
977    </literallayout>
978   </MSGText> 
979  </literal>
980 </para>
981
982 <para>
983  To enable the web-based <filename>ijb.action</filename> file editor set
984  <application>enable-edit-actions</application> to 1, or 0 to disable.  Note
985  that you must have compiled <application>JunkBuster</application> with
986  support for this feature, otherwise this option has no effect. This 
987  internal page can be reached at <ulink
988  url="http://i.j.b./">http://i.j.b./</ulink>.
989  </para>
990
991 <para>
992  Security note: If this is enabled, anyone who can use the proxy
993  can edit the actions file, and their changes will affect all users.
994  For shared proxies, you probably want to disable this. Default: enabled.
995 </para>
996
997 <para>
998  <literal>
999   <MSGText> 
1000    <literallayout>
1001   <emphasis>enable-edit-actions    1</emphasis>
1002    </literallayout>
1003   </MSGText> 
1004  </literal>
1005 </para>
1006
1007 <para>
1008  Allow <application>JunkBuster</application> to be toggled on and off
1009  remotely, using your web browser.  Set <quote>enable-remote-toggle</quote>to
1010  1 to enable, and 0 to disable.  Note that you must have compiled 
1011  <application>JunkBuster</application> with support for this feature,
1012  otherwise this option has no effect.
1013 </para>
1014
1015 <para>
1016  Security note:  If this is enabled, anyone who can use the proxy can toggle
1017  it on or off (see <ulink url="http://i.j.b./">http://i.j.b./</ulink>), and
1018  their changes will affect all users. For shared proxies, you probably want to
1019  disable this. Default: enabled.
1020 </para>
1021
1022 <para>
1023  <literal>
1024   <MSGText> 
1025    <literallayout>
1026   <emphasis>enable-remote-toggle    1</emphasis>
1027    </literallayout>
1028   </MSGText> 
1029  </literal>
1030 </para>
1031
1032 </sect3>
1033
1034 <!--  ~  End section  ~  -->
1035
1036
1037 <!--   ~~~~~       New section      ~~~~~     -->
1038
1039 <sect3>
1040 <title>Access Control List (ACL)</title>
1041 <para>
1042  Access controls are included at the request of some ISPs and systems
1043  administrators, and are not usually needed by individual users. Please note
1044  the warnings in the FAQ that this proxy is not intended to be a substitute
1045  for a firewall or to encourage anyone to defer addressing basic security
1046  weaknesses.
1047 </para>
1048
1049 <para>
1050  If no access settings are specified, the proxy talks to anyone that
1051  connects. If any access settings file are specified, then the proxy
1052  talks only to IP addresses permitted somewhere in this file and not
1053  denied later in this file.
1054 </para>
1055
1056 <para>
1057  Summary -- if using an ACL:
1058 </para>
1059
1060  <simplelist>
1061   <member>
1062    Client must have permission to receive service.
1063   </member>
1064  </simplelist>
1065  <simplelist>
1066   <member>
1067    LAST match in ACL wins.
1068   </member>
1069  </simplelist>
1070  <simplelist>
1071   <member>
1072    Default behavior is to deny service.
1073   </member>
1074  </simplelist>
1075
1076 <para>
1077  The syntax for an entry in the Access Control List is:
1078 </para>
1079
1080 <para>
1081  <literal>
1082   <MSGText> 
1083    <literallayout>
1084   ACTION    SRC_ADDR[/SRC_MASKLEN]    [ DST_ADDR[/DST_MASKLEN] ]
1085    </literallayout>
1086   </MSGText> 
1087  </literal>
1088 </para>
1089
1090 <para>
1091  Where the individual fields are:
1092 </para>
1093
1094 <para>
1095  <literal>
1096   <MSGText> 
1097    <literallayout>
1098  <emphasis>ACTION</emphasis>      = <quote>permit-access</quote> or <quote>deny-access</quote>
1099
1100  <emphasis>SRC_ADDR</emphasis>    = client hostname or dotted IP address
1101  <emphasis>SRC_MASKLEN</emphasis> = number of bits in the subnet mask for the source
1102
1103  <emphasis>DST_ADDR</emphasis>    = server or forwarder hostname or dotted IP address
1104  <emphasis>DST_MASKLEN</emphasis> = number of bits in the subnet mask for the target
1105    </literallayout>
1106   </MSGText> 
1107  </literal>
1108 </para>
1109
1110
1111 <para> 
1112  The field separator (FS) is whitespace (space or tab).
1113 </para>
1114
1115 <para>
1116  IMPORTANT NOTE: If the <application>junkbuster</application> is using a
1117  forwarder (see below) or a gateway for a particular destination URL, the
1118  <literal>DST_ADDR</literal> that is examined is the address of the forwarder
1119  or the gateway and <emphasis>NOT</emphasis> the address of the ultimate
1120  target. This is necessary because it may be impossible for the local
1121  <application>Junkbuster</application> to determine the address of the
1122  ultimate target (that's often what gateways are used for).
1123 </para>
1124
1125 <para>
1126  Here are a few examples to show how the ACL features work:
1127 </para>
1128
1129 <para>
1130  <quote>localhost</quote> is OK -- no DST_ADDR implies that
1131  <emphasis>ALL</emphasis> destination addresses are OK:
1132 </para>
1133
1134 <para>
1135  <literal>
1136   <MSGText> 
1137    <literallayout>
1138   <emphasis>permit-access  localhost</emphasis>
1139    </literallayout>
1140   </MSGText> 
1141  </literal>
1142 </para>
1143
1144 <para>
1145  A silly example to illustrate permitting any host on the class-C subnet with
1146  <application>Junkbuster</application> to go anywhere:
1147 </para>
1148
1149 <para>
1150  <literal>
1151   <MSGText> 
1152    <literallayout>
1153   <emphasis>permit-access    www.junkbusters.com/24</emphasis>
1154    </literallayout>
1155   </MSGText> 
1156  </literal>
1157 </para>
1158
1159 <para>
1160  Except deny one particular IP address from using it at all:
1161 </para>
1162
1163 <para>
1164  <literal>
1165   <MSGText> 
1166    <literallayout>
1167   <emphasis>deny-access      ident.junkbusters.com</emphasis>
1168    </literallayout>
1169   </MSGText> 
1170  </literal>
1171 </para>
1172
1173 <para>
1174  You can also specify an explicit network address and subnet mask.
1175  Explicit addresses do not have to be resolved to be used.
1176 </para>
1177
1178 <para>
1179  <literal>
1180   <MSGText> 
1181    <literallayout>
1182   <emphasis>permit-access    207.153.200.0/24</emphasis>
1183    </literallayout>
1184   </MSGText> 
1185  </literal>
1186 </para>
1187
1188 <para>
1189  A subnet mask of 0 matches anything, so the next line permits everyone.
1190 </para>
1191
1192 <para>
1193  <literal>
1194   <MSGText> 
1195    <literallayout>
1196   <emphasis>permit-access    0.0.0.0/0</emphasis>
1197    </literallayout>
1198   </MSGText> 
1199  </literal>
1200 </para>
1201
1202 <para>
1203  Note, you <emphasis>cannot</emphasis> say:
1204 </para>
1205
1206 <para>
1207  <literal>
1208   <MSGText> 
1209    <literallayout>
1210   <emphasis>permit-access    .org</emphasis>
1211    </literallayout>
1212   </MSGText> 
1213  </literal>
1214 </para>
1215
1216 <para>
1217  to allow all *.org domains. Every IP address listed must resolve fully.
1218 </para>
1219
1220 <para>
1221  An ISP may want to provide a <application>Junkbuster</application> that is
1222  accessible by <quote>the world</quote> and yet restrict use of some of their
1223  private content to hosts on its internal network (i.e. its own subscribers).
1224  Say, for instance the ISP owns the Class-B IP address block 123.124.0.0 (a 16
1225  bit netmask). This is how they could do it:
1226 </para>
1227
1228 <para>
1229  <literal>
1230   <MSGText> 
1231    <literallayout>
1232  <emphasis>permit-access 0.0.0.0/0   0.0.0.0/0</emphasis>   # other clients can go anywhere 
1233                                        # with the following exceptions:
1234  
1235  <emphasis>deny-access</emphasis>   0.0.0.0/0   123.124.0.0/16 # block all external requests for
1236                                           # sites on the ISP's network
1237
1238  <emphasis>permit 0.0.0.0/0   www.my_isp.com</emphasis>        # except for the ISP's main 
1239                                           # web site
1240
1241  <emphasis>permit 123.124.0.0/16 0.0.0.0/0</emphasis>          # the ISP's clients can go 
1242                                           # anywhere
1243    </literallayout>
1244   </MSGText> 
1245  </literal>
1246 </para>
1247
1248 <para>
1249  Note that if some hostnames are listed with multiple IP addresses, 
1250  the primary value returned by DNS (via gethostbyname()) is used. Default:
1251  Anyone can access the proxy.
1252 </para>
1253
1254 </sect3>
1255
1256 <!--  ~  End section  ~  -->
1257
1258
1259 <!--   ~~~~~       New section      ~~~~~     -->
1260
1261 <sect3>
1262 <title>Forwarding</title>
1263
1264 <para>
1265  This feature allows chaining of HTTP requests via multiple proxies.
1266  It can be used to better protect privacy and confidentiality when
1267  accessing specific domains by routing requests to those domains
1268  to a special purpose filtering proxy such as lpwa.com. Or to use 
1269  a caching proxy to speed up browsing.
1270 </para>
1271
1272 <para>
1273  It can also be used in an environment with multiple networks to route
1274  requests via multiple gateways allowing transparent access to multiple
1275  networks without having to modify browser configurations.
1276 </para>
1277
1278 <para>
1279  Also specified here are SOCKS proxies. <application>Junkbuster</application>
1280  SOCKS 4 and SOCKS 4A. The difference is that SOCKS 4A will resolve the target
1281  hostname using DNS on the SOCKS server, not our local DNS client.
1282 </para>
1283
1284 <para>
1285  The syntax of each line is:
1286 </para>
1287
1288 <para>
1289  <literal>
1290   <MSGText> 
1291    <literallayout>
1292  <emphasis>forward target_domain[:port] http_proxy_host[:port]</emphasis>
1293  <emphasis>forward-socks4  target_domain[:port] socks_proxy_host[:port] http_proxy_host[:port]</emphasis>
1294  <emphasis>forward-socks4a target_domain[:port] socks_proxy_host[:port] http_proxy_host[:port]</emphasis>
1295    </literallayout>
1296   </MSGText> 
1297  </literal>
1298 </para>
1299
1300 <para>
1301  If http_proxy_host is <quote>.</quote>, then requests are not forwarded to a
1302  HTTP proxy but are made directly to the web servers.
1303 </para>
1304
1305 <para>
1306  Lines are checked in sequence, and the last match wins.
1307 </para>
1308
1309 <para>
1310  There is an implicit line equivalent to the following, which specifies that
1311  anything not finding a match on the list is to go out without forwarding
1312  or gateway protocol, like so:
1313 </para>
1314
1315 <para>
1316  <literal>
1317   <MSGText> 
1318    <literallayout>
1319   <emphasis>forward   .*   .       </emphasis># implicit
1320    </literallayout>
1321   </MSGText> 
1322  </literal>
1323 </para>
1324
1325 <para>
1326  In the following common configuration, everything goes to Lucent's LPWA,
1327  except SSL on port 443 (which it doesn't handle):
1328 </para>
1329
1330 <para>
1331  <literal>
1332   <MSGText> 
1333    <literallayout>
1334  <emphasis>forward   .*     lpwa.com:8000</emphasis>
1335  <emphasis>forward   :443   .</emphasis>
1336    </literallayout>
1337   </MSGText> 
1338  </literal>
1339 </para>
1340
1341 <para>
1342  See the FAQ for instructions on how to automate the login procedure for LPWA.
1343  Some users have reported difficulties related to LPWA's use of
1344  <quote>.</quote> as the last element of the domain, and have said that this
1345  can be fixed with this:
1346 </para>
1347    
1348 <para>
1349  <literal>
1350   <MSGText> 
1351    <literallayout>
1352   <emphasis>forward   lpwa.  lpwa.com:8000</emphasis>
1353    </literallayout>
1354   </MSGText> 
1355  </literal>
1356 </para>
1357  
1358 <para>
1359  (NOTE: the syntax for specifiying target_domain has changed since the
1360  previous paragraph was written -- it will not work now.  More information
1361  is welcome.)
1362 </para>
1363
1364 <para>
1365  In this fictitious example, everything goes via an ISP's caching proxy,
1366  except requests to that ISP:
1367 </para>
1368
1369 <para>
1370  <literal>
1371   <MSGText> 
1372    <literallayout>
1373  <emphasis>forward    .*         caching.myisp.net:8000</emphasis>
1374  <emphasis>forward    myisp.net  .</emphasis>
1375    </literallayout>
1376   </MSGText> 
1377  </literal>
1378 </para>
1379
1380 <para>
1381  For the @home network, we're told the forwarding configuration is this:
1382 </para>
1383
1384
1385 <para>
1386  <literal>
1387   <MSGText> 
1388    <literallayout>
1389   <emphasis>forward    .*    proxy:8080</emphasis>
1390    </literallayout>
1391   </MSGText> 
1392  </literal>
1393 </para>
1394
1395 <para>
1396  Also, we're told they insist on getting cookies and JavaScript, so you should 
1397  add home.com to the cookie file. We consider JavaScript a security risk.
1398  Java need not be enabled.
1399 </para>
1400
1401 <para>
1402  In this example direct connections are made to all <quote>internal</quote>
1403  domains, but everything else goes through Lucent's LPWA by way of the
1404  company's SOCKS gateway to the Internet.
1405 </para>
1406
1407 <para>
1408  <literal>
1409   <MSGText> 
1410    <literallayout>
1411  <emphasis>forward-socks4  .*  lpwa.com:8000  firewall.my_company.com:1080</emphasis>
1412  <emphasis>forward    my_company.com  .</emphasis>
1413    </literallayout>
1414   </MSGText> 
1415  </literal>
1416 </para>
1417
1418 <para>
1419  This is how you could set up a site that always uses SOCKS but no forwarders:
1420 </para>
1421
1422 <para>
1423  <literal>
1424   <MSGText> 
1425    <literallayout>
1426   <emphasis>forward-socks4a   .*  .  firewall.my_company.com:1080</emphasis>
1427    </literallayout>
1428   </MSGText> 
1429  </literal>
1430 </para>
1431
1432 <para>
1433  An advanced example for network administrators:
1434 </para>
1435
1436 <para>
1437  If you have links to multiple ISPs that provide various special content to
1438  their subscribers, you can configure forwarding to pass requests to the
1439  specific host that's connected to that ISP so that everybody can see all
1440  of the content on all of the ISPs.
1441 </para>
1442
1443 <para>
1444  This is a bit tricky, but here's an example:
1445 </para>
1446
1447
1448 <para>
1449  host-a has a PPP connection to isp-a.com. And host-b has a PPP connection to
1450  isp-b.com. host-a can run a <application>Junkbuster</application> proxy with
1451  forwarding like this: 
1452 </para>
1453
1454 <para>
1455  <literal>
1456   <MSGText> 
1457    <literallayout>
1458  <emphasis>forward    .*         .</emphasis>
1459  <emphasis>forward    isp-b.com  host-b:8000</emphasis>
1460    </literallayout>
1461   </MSGText> 
1462  </literal>
1463 </para>
1464
1465 <para>
1466  host-b can run a <application>Junkbuster</application> proxy with forwarding
1467  like this: 
1468 </para>
1469
1470 <para>
1471  <literal>
1472   <MSGText> 
1473    <literallayout>
1474  <emphasis>forward    .*          .</emphasis>
1475  <emphasis>forward    isp-a.com   host-a:8000</emphasis>
1476    </literallayout>
1477   </MSGText> 
1478  </literal>
1479 </para>
1480
1481 <para>
1482  Now, <emphasis>anyone</emphasis> on the Internet (including users on host-a
1483  and host-b) can set their browser's proxy to <emphasis>either</emphasis>
1484  host-a or host-b and be able to browse the content on isp-a or isp-b.
1485 </para>
1486
1487 <para>
1488  Here's another practical example, for University of Kent at
1489  Canterbury students with a network connection in their room, who
1490  need to use the University's Squid web cache.
1491 </para>
1492
1493 <para>
1494  <literal>
1495   <MSGText> 
1496    <literallayout>
1497  <emphasis>forward  *. ssbcache.ukc.ac.uk:3128</emphasis>  # Use the proxy, except for:
1498  <emphasis>forward  .ukc.ac.uk            .    </emphasis> # Anything on the same domain as us
1499  <emphasis>forward  *                     .    </emphasis> # Host with no domain specified
1500  <emphasis>forward  129.12.*.*            .    </emphasis> # A dotted IP on our /16 network.
1501  <emphasis>forward  127.*.*.*             .    </emphasis> # Loopback address
1502  <emphasis>forward  localhost.localdomain .    </emphasis> # Loopback address
1503  <emphasis>forward  www.ukc.mirror.ac.uk  .    </emphasis> # Specific host
1504    </literallayout>
1505   </MSGText> 
1506  </literal>
1507 </para>
1508
1509 <para>
1510  If you intend to chain <application>Junkbuster</application> and 
1511  <application>squid</application> locally, then chain as 
1512  <literal>browser -> squid -> junkbuster</literal> is the recommended way. 
1513 </para>
1514
1515 <para>
1516  Your squid configuration could then look like this:
1517 </para>
1518
1519 <para>
1520  <literal>
1521   <MSGText> 
1522    <literallayout>
1523   # Define junkbuster as parent cache 
1524  <!-- per feedback from user...
1525   cache_peer 127.0.0.1 8000 parent 0 no-query 
1526  --> 
1527   cache_peer 127.0.0.1 parent 8000 0 no-query
1528   
1529   # Define ACL for protocol FTP 
1530   acl FTP proto FTP 
1531
1532   # Do not forward ACL FTP to junkbuster 
1533   always_direct allow FTP 
1534
1535   # Do not forward ACL CONNECT (https) to junkbuster 
1536   always_direct allow CONNECT 
1537
1538   # Forward the rest to junkbuster 
1539   never_direct allow all 
1540    </literallayout>
1541   </MSGText> 
1542  </literal>
1543 </para>
1544
1545 </sect3>
1546
1547 <!--  ~  End section  ~  -->
1548
1549
1550 <!--   ~~~~~       New section      ~~~~~     -->
1551
1552 <sect3>
1553 <title>Windows GUI Options</title>
1554 <!--
1555 Removed references to Win32. HB 09/23/01
1556 -->
1557 <para>
1558  <application>Junkbuster</application> has a number of options specific to the
1559  Windows GUI interface:
1560 </para>
1561
1562 <para>
1563  If <quote>activity-animation</quote> is set to 1, the
1564  <application>Junkbuster</application> icon will animate when
1565  <quote>Junkbuster</quote> is active. To turn off, set to 0.
1566 </para>
1567
1568 <para>
1569  <literal>
1570   <MSGText> 
1571    <literallayout>
1572   <emphasis>activity-animation   1</emphasis>
1573    </literallayout>
1574   </MSGText> 
1575  </literal>
1576 </para>
1577
1578 <para>
1579  If <quote>log-messages</quote> is set to 1,
1580  <application>Junkbuster</application> will log messages to the console
1581  window:
1582 </para>
1583
1584 <para>
1585  <literal>
1586   <MSGText> 
1587    <literallayout>
1588   <emphasis>log-messages       1</emphasis>
1589    </literallayout>
1590   </MSGText> 
1591  </literal>
1592 </para>
1593
1594 <para> 
1595  If <quote>log-buffer-size</quote> is set to 1, the size of the log buffer,
1596  i.e. the amount of memory used for the log messages displayed in the
1597  console window, will be limited to <quote>log-max-lines</quote> (see below).
1598 </para>
1599
1600 <para>
1601  Warning: Setting this to 0 will result in the buffer to grow infinitely and
1602  eat up all your memory!
1603 </para>
1604
1605 <para>
1606  <literal>
1607   <MSGText> 
1608    <literallayout>
1609   <emphasis>log-buffer-size      1</emphasis>
1610    </literallayout>
1611   </MSGText> 
1612  </literal>
1613 </para>
1614
1615 <para>
1616  <application>log-max-lines</application> is the maximum number of lines held
1617  in the log buffer. See above.
1618 </para>
1619
1620 <para>
1621  <literal>
1622   <MSGText> 
1623    <literallayout>
1624   <emphasis>log-max-lines      200</emphasis>
1625    </literallayout>
1626   </MSGText> 
1627  </literal>
1628 </para>
1629
1630 <para>
1631  If <quote>log-highlight-messages</quote> is set to 1,
1632  <application>Junkbuster</application> will highlight portions of the log
1633  messages with a bold-faced font:
1634 </para>
1635
1636 <para>
1637  <literal>
1638   <MSGText> 
1639    <literallayout>
1640   <emphasis>log-highlight-messages   1</emphasis>
1641    </literallayout>
1642   </MSGText> 
1643  </literal>
1644 </para>
1645
1646 <para>
1647  The font used in the console window:
1648 </para>
1649
1650 <para>
1651  <literal>
1652   <MSGText> 
1653    <literallayout>
1654   <emphasis>log-font-name        Comic Sans MS</emphasis>
1655    </literallayout>
1656   </MSGText> 
1657  </literal>
1658 </para>
1659
1660 <para>
1661  Font size used in the console window:
1662 </para>
1663
1664 <para>
1665  <literal>
1666   <MSGText> 
1667    <literallayout>
1668   <emphasis>log-font-size        8</emphasis>
1669    </literallayout>
1670   </MSGText> 
1671  </literal>
1672 </para>
1673
1674 <para>  
1675  <quote>show-on-task-bar</quote> controls whether or not
1676  <application>Junkbuster</application> will appear as a button on the Task bar
1677  when minimized:
1678 </para>
1679
1680 <para>
1681  <literal>
1682   <MSGText> 
1683    <literallayout>
1684   <emphasis>show-on-task-bar     0</emphasis>
1685    </literallayout>
1686   </MSGText> 
1687  </literal>
1688 </para>
1689
1690 <para>
1691  If <quote>close-button-minimizes</quote> is set to 1, the Windows close
1692  button will minimize <application>Junkbuster</application> instead of closing
1693  the program (close with the exit option on the File menu).
1694 </para>
1695
1696 <para>
1697  <literal>
1698   <MSGText> 
1699    <literallayout>
1700   <emphasis>close-button-minimizes  1</emphasis>
1701    </literallayout>
1702   </MSGText> 
1703  </literal>
1704 </para>
1705
1706 <para>
1707  The <quote>hide-console</quote> option is specific to the MS-Win console
1708  version of <application>JunkBuster</application>. If this option is used,
1709  <application>Junkbuster</application> will disconnect from and hide  the
1710  command console.
1711 </para>
1712
1713 <para>
1714  <literal>
1715   <MSGText> 
1716    <literallayout>
1717   #hide-console
1718    </literallayout>
1719   </MSGText> 
1720  </literal>
1721 </para>
1722
1723 </sect3>
1724 </sect2>
1725
1726 <!--  ~  End section  ~  -->
1727
1728
1729 <!--   ~~~~~       New section      ~~~~~     -->
1730 <sect2 id="actionsfile">
1731 <title>The Actions File</title>
1732
1733 <para>
1734  The <quote>ijb.action</quote> file (formerly
1735  <filename>actionsfile</filename>) is used to define what actions
1736  <application>Junkbuster</application> takes, and thus determines how images,
1737  cookies and various other aspects of HTTP content and transactions are
1738  handled. Images can be anything you want, including ads, banners, or just
1739  some obnoxious image that you would rather not see. Cookies can be accepted
1740  or rejected, or accepted only during the current browser session (i.e. 
1741  not written to disk). 
1742 </para>
1743
1744 <para>
1745  To determine which actions apply to a request, the URL of the request is
1746  compared to all patterns in this file. Every time it matches, the list of
1747  applicable actions for the URL is incrementally updated. You can trace
1748  this process by visiting <ulink
1749  url="http://i.j.b/show-url-info">http://i.j.b/show-url-info</ulink>. 
1750 </para>
1751
1752 <para>
1753  The actions file can be edited with a browser by loading 
1754  <ulink url="http://i.j.b">http://i.j.b</ulink>, and then select 
1755  <quote>Edit Actions</quote>.
1756 </para>
1757
1758 <para>
1759  There are four types of lines in this file: comments (begin with a 
1760  <quote>#</quote> character), actions, aliases and patterns, all of which are
1761  explained below, as well as the configuration file syntax that 
1762  <application>Junkbuster</application> understands.
1763
1764 </para>
1765
1766
1767 <!--   ~~~~~       New section      ~~~~~     -->
1768 <sect3>
1769 <title>URL Domain and Path Syntax</title>
1770 <para>
1771  Generally, a pattern has the form &lt;domain&gt;/&lt;path&gt;, where both the
1772  &lt;domain&gt; and &lt;path&gt; part are optional. If you only specify a
1773  domain part, the <quote>/</quote> can be left out:
1774 </para>
1775
1776 <para>
1777  <emphasis>www.example.com</emphasis> - is a domain only pattern and will match any request to
1778  <quote>www.example.com</quote>.
1779 </para>
1780
1781 <para>
1782  <emphasis>www.example.com/</emphasis> - means exactly the same.
1783 </para>
1784
1785 <para>
1786  <emphasis>www.example.com/index.html</emphasis> - matches only the single
1787  document <quote>/index.html</quote> on <quote>www.example.com</quote>.
1788 </para>
1789
1790 <para>
1791  <emphasis>/index.html</emphasis> - matches the document <quote>/index.html</quote>, regardless of
1792  the domain.
1793 </para>
1794
1795 <para>
1796  <emphasis>index.html</emphasis> - matches nothing, since it would be
1797  interpreted as a domain name and there is no top-level domain called
1798  <quote>.html</quote>.
1799 </para>
1800
1801 <para>
1802  The matching of the domain part offers some flexible options: if the
1803  domain starts or ends with a dot, it becomes unanchored at that end. 
1804  For example:
1805 </para>
1806
1807 <para>
1808  <emphasis>.example.com</emphasis> - matches any domain that <emphasis>ENDS</emphasis> in 
1809  <quote>.example.com</quote>.
1810 </para>
1811
1812 <para>
1813  <emphasis>www.</emphasis> - matches any domain that <emphasis>STARTS</emphasis> with
1814  <quote>www</quote>.
1815 </para>
1816
1817 <para>
1818  Additionally, there are wildcards that you can use in the domain names
1819  themselves. They work pretty similar to shell wildcards: <quote>*</quote>
1820  stands for zero or more arbitrary characters, <quote>?</quote> stands for
1821  any single character. And you can define charachter classes in square
1822  brackets and they can be freely mixed:
1823 </para>
1824
1825 <para>
1826  <emphasis>ad*.example.com</emphasis> - matches <quote>adserver.example.com</quote>, 
1827  <quote>ads.example.com</quote>, etc but not <quote>sfads.example.com</quote>.
1828 </para>
1829
1830 <para>
1831  <emphasis>*ad*.example.com</emphasis> - matches all of the above, and then some.
1832 </para>
1833
1834 <para>
1835  <emphasis>.?pix.com</emphasis> - matches <quote>www.ipix.com</quote>,
1836  <quote>pictures.epix.com</quote>, <quote>a.b.c.d.e.upix.com</quote>, etc. 
1837 </para>
1838
1839 <para>
1840  <emphasis>www[1-9a-ez].example.com</emphasis> - matches <quote>www1.example.com</quote>, 
1841  <quote>www4.example.com</quote>, <quote>wwwd.example.com</quote>, 
1842  <quote>wwwz.example.com</quote>, etc., but <emphasis>not</emphasis> 
1843  <quote>wwww.example.com</quote>.
1844 </para>
1845
1846 <para>
1847  If <application>Junkbuster</application> was compiled with
1848  <quote>pcre</quote> support (default), Perl compatible regular expressions
1849  can be used. See the <filename>pcre/docs/</filename> direcory or <quote>man
1850  perlre</quote> (also available on  <ulink
1851  url="http://www.perldoc.com/perl5.6/pod/perlre.html">http://www.perldoc.com/perl5.6/pod/perlre.html</ulink>)
1852  for details. A brief discussion of regular expressions is in the 
1853  <link linkend="regex">Appendix</link>. For instance:
1854 </para>
1855
1856 <para>
1857  <emphasis>/.*/advert[0-9]+\.jpe?g</emphasis>  - would match a URL from any
1858  domain, with any path that includes <quote>advert</quote> followed
1859  immediately by one or more digits, then a <quote>.</quote> and ending in
1860  either <quote>jpeg</quote> or <quote>jpg</quote>. So we match
1861  <quote>example.com/ads/advert2.jpg</quote>, and
1862  <quote>www.example.com/ads/banners/advert39.jpeg</quote>, but not
1863  <quote>www.example.com/ads/banners/advert39.gif</quote> (no gifs in the
1864  example pattern).
1865 </para>
1866
1867 <para>
1868  Please note that matching in the path is case
1869  <emphasis>INSENSITIVE</emphasis> by default, but you can switch to case
1870  sensitive at any point in the pattern by using the 
1871  <quote>(?-i)</quote> switch:
1872 </para>
1873
1874 <para>
1875  <emphasis>www.example.com/(?-i)PaTtErN.*</emphasis> - will match only
1876  documents whose path starts with <quote>PaTtErN</quote> in
1877  <emphasis>exactly</emphasis> this capitalization.
1878 </para>
1879
1880 </sect3>
1881
1882 <!--  ~  End section  ~  -->
1883
1884
1885
1886 <!--   ~~~~~       New section      ~~~~~     -->
1887
1888 <sect3>
1889 <title>Actions</title>
1890 <para>
1891  Actions are enabled if preceded with a <quote>+</quote>, and disabled if 
1892  preceded with a <quote>-</quote>. Actions are invoked by enclosing the 
1893  action name in curly braces (e.g. {+some_action}), followed by a list of 
1894  URLs to which the action applies. There are three classes of actions:
1895 </para>
1896
1897 <para>
1898  <itemizedlist>
1899
1900  <listitem>
1901   <para>  
1902    Boolean (e.g. <quote>+/-block</quote>):
1903   </para>
1904   <para>
1905    <literal>
1906     <MSGText> 
1907      <literallayout>
1908   <emphasis>{+name}</emphasis>        # enable this action
1909   <emphasis>{-name}</emphasis>        # disable this action
1910      </literallayout>
1911     </MSGText> 
1912    </literal>
1913   </para>
1914  </listitem>
1915
1916
1917  <listitem>
1918   <para>  
1919    Parameterized (e.g. <quote>+/-hide-user-agent</quote>):
1920   </para>
1921   <para>
1922    <literal>
1923     <MSGText> 
1924      <literallayout>
1925   <emphasis>{+name{param}}</emphasis>  # enable action and set parameter to <quote>param</quote>
1926   <emphasis>{-name}</emphasis>         # disable action
1927      </literallayout>
1928     </MSGText> 
1929    </literal>
1930   </para>
1931  </listitem>
1932  
1933  <listitem>
1934   <para>  
1935    Multi-value (e.g. <quote>{+/-add-header{Name: value}}</quote>, <quote>{+/-wafer{name=value}}</quote>):
1936   </para>
1937   <para>
1938    <literal>
1939     <MSGText> 
1940      <literallayout>
1941   <emphasis>{+name{param}}</emphasis>   # enable action and add parameter <quote>param</quote>
1942   <emphasis>{-name{param}}</emphasis>   # remove the parameter <quote>param</quote>
1943   <emphasis>{-name}</emphasis>          # disable this action totally
1944      </literallayout>
1945     </MSGText> 
1946    </literal>
1947   </para>
1948  </listitem>
1949
1950  </itemizedlist>
1951 </para>
1952
1953 <para>
1954  If nothing is specified in this file, no <quote>actions</quote> are taken.
1955  So in this case <application>JunkBuster</application> would just be a
1956  normal, non-blocking, non-anonymizing proxy. You must specifically
1957  enable the privacy and blocking features you need (although the 
1958  provided default <filename>ijb.action</filename> file will 
1959  give a good starting point).
1960 </para>
1961
1962 <para>
1963  Later defined actions always over-ride earlier ones.  For multi-valued
1964  actions, the actions are applied in the order they are specified.
1965 </para>
1966
1967 <para>
1968  The list of valid <application>Junkbuster</application> <quote>actions</quote> are:
1969 </para>
1970
1971 <para>
1972  <itemizedlist>
1973  
1974  <listitem>
1975   <para>  
1976    Add the specified HTTP header, which is not checked for validity.
1977    You may specify this many times to specify many different headers:
1978   </para>
1979   <para>
1980    <literal>
1981     <MSGText> 
1982      <literallayout>
1983   <emphasis>+add-header{Name: value}</emphasis>
1984      </literallayout>
1985     </MSGText> 
1986    </literal>
1987   </para>
1988  </listitem>
1989  
1990  
1991  <listitem>
1992   <para>  
1993    Block this URL totally.
1994   </para>
1995   <para>
1996    <literal>
1997     <MSGText> 
1998      <literallayout>
1999   <emphasis>+block</emphasis>
2000      </literallayout>
2001     </MSGText> 
2002    </literal>
2003   </para>
2004  </listitem>
2005  
2006  
2007  <listitem>
2008   <para>  
2009    De-animate all animated GIF images, i.e. reduce them to their last frame.
2010    This will also shrink the images considerably (in bytes, not pixels!). If
2011    the option <quote>first</quote> is given, the first frame of the animation
2012    is used as the replacement. If <quote>last</quote> is given, the last frame
2013    of the animation is used instead, which propably makes more sense for most
2014    banner animations, but also has the risk of not showing the entire last
2015    frame (if it is only a delta to an earlier frame).
2016   </para>
2017   <para>
2018    <literal>
2019     <MSGText> 
2020      <literallayout>
2021   <emphasis>+deanimate-gifs{last}</emphasis>
2022   <emphasis>+deanimate-gifs{first}</emphasis>
2023      </literallayout>
2024     </MSGText> 
2025    </literal>
2026   </para>
2027  </listitem>
2028  
2029  <listitem>
2030   <para>
2031    <quote>+downgrade</quote> will downgrade HTTP/1.1 client requests to
2032    HTTP/1.0 and downgrade the responses as well. Use this action for servers
2033    that use HTTP/1.1 protocol features that
2034    <application>Junkbuster</application> doesn't handle well yet. HTTP/1.1 
2035    is only partially implemented. Default is not to downgrade requests.
2036   </para>
2037   <para>
2038    <literal>
2039     <MSGText> 
2040      <literallayout>
2041   <emphasis>+downgrade</emphasis>
2042      </literallayout>
2043     </MSGText> 
2044    </literal>
2045   </para>
2046  </listitem> 
2047  
2048  <listitem>
2049   <para>  
2050    Many sites, like yahoo.com, don't just link to other sites. Instead, they
2051    will link to some script on their own server, giving the destination as a
2052    parameter, which will then redirect you to the final target. URLs resulting
2053    from this scheme typically look like:
2054    http://some.place/some_script?http://some.where-else.
2055   </para>
2056   <para>
2057    Sometimes, there are even multiple consecutive redirects encoded in the
2058    URL. These redirections via scripts make your web browing more traceable,
2059    since the server from which you follow such a link can see where you go to.
2060    Apart from that, valuable bandwidth and time is wasted, while your browser
2061    ask the server for one redirect after the other. Plus, it feeds the
2062    advertisers.
2063   </para>
2064   <para>
2065    The <quote>+fast-redirects</quote> option enables interception of these
2066    requests by <application>Junkbuster</application>, who will cut off all but
2067    the last valid URL in the request and send a local redirect back to your
2068    browser without contacting the remote site.
2069   </para>
2070   <para>
2071    <literal>
2072     <MSGText> 
2073      <literallayout>
2074   <emphasis>+fast-redirects</emphasis>
2075      </literallayout>
2076     </MSGText> 
2077    </literal>
2078   </para>
2079  </listitem>
2080
2081  <listitem>
2082   <para>  
2083    Filter the website through the re_filterfile:
2084   </para>
2085   <para>
2086    <literal>
2087     <MSGText> 
2088      <literallayout>
2089  <emphasis>+filter{filename}</emphasis>
2090      </literallayout>
2091     </MSGText> 
2092    </literal>
2093   </para>
2094  </listitem>
2095
2096  <listitem>
2097   <para>  
2098    Block any existing X-Forwarded-for header, and do not add a new one:
2099   </para>
2100   <para>
2101    <literal>
2102     <MSGText> 
2103      <literallayout>
2104   <emphasis>+hide-forwarded</emphasis>
2105      </literallayout>
2106     </MSGText> 
2107    </literal>
2108   </para>
2109  </listitem>
2110
2111  <listitem>
2112   <para>  
2113    If the browser sends a <quote>From:</quote> header containing your e-mail
2114    address, this either completely removes the header (<quote>block</quote>), or
2115    changes it to the specified e-mail address.
2116   </para>
2117   <para>
2118    <literal>
2119     <MSGText> 
2120      <literallayout>
2121   <emphasis>+hide-from{block}</emphasis>
2122   <emphasis>+hide-from{spam@sittingduck.xqq}</emphasis>
2123      </literallayout>
2124     </MSGText> 
2125    </literal>
2126   </para>
2127  </listitem>
2128  
2129  <listitem>
2130   <para>  
2131    Don't send the <quote>Referer:</quote> (sic) header to the web site.  You
2132    can block it, forge a URL to the same server as the request (which is
2133    preferred because some sites will not send images otherwise) or set it to a
2134    constant string of your choice.
2135   </para>
2136   <para>
2137    <literal>
2138     <MSGText> 
2139      <literallayout>
2140   <emphasis>+hide-referer{block}</emphasis>
2141   <emphasis>+hide-referer{forge}</emphasis>
2142   <emphasis>+hide-referer{http://nowhere.com}</emphasis>
2143      </literallayout>
2144     </MSGText> 
2145    </literal>
2146   </para>
2147  </listitem>
2148  
2149  <listitem>
2150   <para>  
2151    Alternative spelling of <quote>+hide-referer</quote>.  It has the same
2152    parameters, and can be freely mixed with, <quote>+hide-referer</quote>.
2153    (<quote>referrer</quote> is the correct English spelling, however the HTTP
2154    specification has a bug - it requires it to be spelled <quote>referer</quote>.) 
2155   </para>
2156   <para>
2157    <literal>
2158     <MSGText> 
2159      <literallayout>
2160   <emphasis>+hide-referrer{...}</emphasis>
2161      </literallayout>
2162     </MSGText> 
2163    </literal>
2164   </para>
2165  </listitem>
2166
2167  <listitem>
2168   <para>  
2169    Change the <quote>User-Agent:</quote> header so web servers can't tell your
2170    browser type.  Warning! This breaks many web sites.  Specify the
2171    user-agent value you want. Example, pretend to be using Netscape on
2172    Linux:
2173   </para>
2174   <para>
2175    <literal>
2176     <MSGText> 
2177      <literallayout>
2178   <emphasis>+hide-user-agent{Mozilla (X11; I; Linux 2.0.32 i586)}</emphasis>
2179      </literallayout>
2180     </MSGText> 
2181    </literal>
2182   </para>
2183  <!-- 
2184   <para>
2185    Or to identify yourself explicitly as a <quote>Junkbuster</quote> user:
2186   </para>
2187   <para>
2188    <literal>
2189     <MSGText> 
2190      <literallayout>
2191   <emphasis>+hide-user-agent{JunkBuster/1.0}</emphasis>
2192      </literallayout>
2193     </MSGText> 
2194    </literal>
2195   </para>
2196    (Don't change the version number from 1.0 - after all, why tell them?)
2197   <para>
2198   </para>
2199   <para>
2200    <literal>
2201     <MSGText> 
2202      <literallayout>
2203   <emphasis>+hide-user-agent{browser-type}</emphasis>
2204      </literallayout>
2205     </MSGText> 
2206    </literal>
2207   </para>
2208 -->
2209  </listitem>
2210
2211  <listitem>
2212   <para>  
2213    Treat this URL as an image.  This only matters if it's also <quote>+block</quote>ed,
2214     in which case a <quote>blocked</quote> image can be sent rather than a HTML page.
2215     See <quote>+image-blocker{}</quote> below for the control over what is actually sent.
2216   </para>
2217   <para>
2218    <literal>
2219     <MSGText> 
2220      <literallayout>
2221   <emphasis>+image</emphasis>
2222      </literallayout>
2223     </MSGText> 
2224    </literal>
2225   </para>
2226  </listitem>
2227  
2228  <listitem>
2229   <para>  
2230    Decides what to do with URLs that end up tagged with <quote>{+block
2231    +image}</quote>. There are 4 options.  <quote>-image-blocker</quote> will
2232    send a HTML <quote>blocked</quote> page, usually resulting in a
2233    <quote>broken image</quote> icon.  <quote>+image-blocker{logo}</quote> will
2234    send a <quote>JunkBuster</quote> image.
2235    <quote>+image-blocker{blank}</quote> will send a 1x1 transparent GIF image.
2236    And finally, <quote>+image-blocker{http://xyz.com}</quote> will send a HTTP
2237    temporary redirect to the specified image. This has the advantage of the
2238    icon being being cached by the browser, which will speed up the display.  
2239   </para>
2240   <para>
2241    <literal>
2242     <MSGText> 
2243      <literallayout>
2244   <emphasis>+image-blocker{logo}</emphasis>
2245   <emphasis>+image-blocker{blank}</emphasis>
2246   <emphasis>+image-blocker{http://i.j.b/send-banner}</emphasis>
2247      </literallayout>
2248     </MSGText> 
2249    </literal>
2250   </para>
2251  </listitem>
2252  
2253  <listitem>
2254    <para> 
2255    By default (i.e. in the absence of a <quote>+limit-connect</quote>
2256    action), <application>Junkbuster</application> will only allow CONNECT
2257    requests to port 443, which is the standard port for https as a 
2258    precaution.
2259   </para>
2260  
2261   <para>
2262    The CONNECT methods exists in HTTP to allow access to secure websites
2263    (https:// URLs) through proxies. It works very simply: the proxy
2264    connects to the server on the specified port, and then short-circuits
2265    its connections to the client <emphasis>and</emphasis> to the remote proxy.
2266    This can be a big security hole, since CONNECT-enabled proxies can
2267    be abused as TCP relays very easily.
2268   </para>
2269   
2270   <para> 
2271    If you want to allow CONNECT for more ports than this, or want to forbid
2272    CONNECT altogether, you can specify a comma separated list of ports and
2273    port ranges (the latter using dashes, with the minimum defaulting to 0 and
2274    max to 65K):
2275   </para>
2276
2277   <para>
2278    <literal>
2279     <MSGText> 
2280      <literallayout>
2281   <emphasis>+limit-connect{443}                 # This is the default and need no be specified.</emphasis>
2282   <emphasis>+limit-connect{80,443}              # Ports 80 and 443 are OK.</emphasis>
2283   <emphasis>+limit-connect{-3, 7, 20-100, 500-} # Port less than 3, 7, 20 to 100</emphasis>
2284   <emphasis>                                    #and above 500 are OK.</emphasis>
2285      </literallayout>
2286     </MSGText> 
2287    </literal>
2288   </para>
2289
2290  </listitem> 
2291  
2292  <listitem>
2293   <para>
2294    <quote>+no-compression</quote> prevents the website from compressing the
2295    data. Some websites do this, which can be a problem for
2296    <application>Junkbuster</application>, since <quote>+filter</quote>,
2297    <quote>+no-popup</quote> and <quote>+gif-deanimate</quote> will not work on
2298    compressed data. This will slow down connections to those websites,
2299    though. Default is <quote>nocompression</quote> is turned on.
2300   </para>
2301
2302   <para>
2303    <literal>
2304     <MSGText> 
2305      <literallayout>
2306   <emphasis>+nocompression</emphasis>
2307      </literallayout>
2308     </MSGText> 
2309    </literal>
2310   </para>
2311  </listitem> 
2312  
2313  <listitem>
2314   <para>  
2315    If the website sets cookies, <quote>no-cookies-keep</quote> will make sure
2316    they are erased when you exit and restart your web browser. This makes
2317    profiling cookies useless, but won't break sites which require cookies so
2318    that you can log in for transactions. Default: on.
2319   </para>
2320   <para>
2321    <literal>
2322     <MSGText> 
2323      <literallayout>
2324   <emphasis>+no-cookies-keep</emphasis>
2325      </literallayout>
2326     </MSGText> 
2327    </literal>
2328   </para>
2329  </listitem>
2330  
2331  <listitem>
2332   <para>  
2333    Prevent the website from reading cookies:
2334   </para>
2335   <para>
2336    <literal>
2337     <MSGText> 
2338      <literallayout>
2339   <emphasis>+no-cookies-read</emphasis>
2340      </literallayout>
2341     </MSGText> 
2342    </literal>
2343   </para>
2344  </listitem>
2345  
2346  <listitem>
2347   <para>  
2348    Prevent the website from setting cookies:
2349   </para>
2350   <para>
2351    <literal>
2352     <MSGText> 
2353      <literallayout>
2354   <emphasis>+no-cookies-set</emphasis>
2355      </literallayout>
2356     </MSGText> 
2357    </literal>
2358   </para>
2359  </listitem>
2360  
2361  <listitem>
2362   <para>  
2363    Filter the website through a built-in filter to disable those obnoxious 
2364    JavaScript pop-up windows via window.open(), etc. The two alternative
2365    spellings are equivalent.
2366   </para>
2367   <para>
2368    <literal>
2369     <MSGText> 
2370      <literallayout>
2371   <emphasis>+no-popup</emphasis>
2372   <emphasis>+no-popups</emphasis>
2373      </literallayout>
2374     </MSGText> 
2375    </literal>
2376   </para>
2377  </listitem>
2378  
2379  <listitem>
2380   <para>  
2381    This action only applies if you are using a <filename>jarfile</filename>
2382    for saving cookies. It sends a cookie to every site stating that you do not
2383    accept any copyright on cookies sent to you, and asking them not to track
2384    you.  Of course, this is a (relatively) unique header they could use to
2385    track you.
2386   </para>
2387   <para>
2388    <literal>
2389     <MSGText> 
2390      <literallayout>
2391   <emphasis>+vanilla-wafer</emphasis>
2392      </literallayout>
2393     </MSGText> 
2394    </literal>
2395   </para>
2396  </listitem>
2397  
2398  <listitem>
2399   <para>  
2400    This allows you to add an arbitrary cookie. It can be specified multiple
2401    times in order to add as many cookies as you like.
2402   </para>
2403   <para>
2404    <literal>
2405     <MSGText> 
2406      <literallayout>
2407   <emphasis>+wafer{name=value}</emphasis>
2408      </literallayout>
2409     </MSGText> 
2410    </literal>
2411   </para>
2412  </listitem>
2413
2414  </itemizedlist>
2415 </para>
2416
2417 <para>
2418  The meaning of any of the above is reversed by preceding the action with a 
2419  <quote>-</quote>, in place of the <quote>+</quote>.
2420 </para>
2421
2422 <para>
2423  Some examples:
2424 </para>
2425
2426 <para>
2427  Turn off cookies by default, then allow a few through for specified sites:
2428 </para>
2429   
2430 <para>
2431  <literal>
2432   <MSGText> 
2433    <literallayout>
2434  # Turn off all persistant cookies
2435  { +no-cookies-read }
2436  { +no-cookies-set }
2437  # Allow cookies for this browser session ONLY
2438  { +no-cookies-keep }
2439
2440  # Execeptions to the above, sites that benefit from persistant cookies
2441  { -no-cookies-read }
2442  { -no-cookies-set }
2443  { -no-cookies-keep }
2444  .javasoft.com
2445  .sun.com
2446  .yahoo.com
2447  .msdn.microsoft.com
2448  .redhat.com
2449
2450  # Alternative way of saying the same thing
2451  {-no-cookies-set -no-cookies-read -no-cookies-keep}
2452  .sourceforge.net
2453  .sf.net
2454    </literallayout>
2455   </MSGText> 
2456  </literal>
2457 </para>
2458
2459 <para>
2460  Now turn off <quote>fast redirects</quote>, and then we allow two exceptions:
2461 </para>
2462
2463 <para>
2464  <literal>
2465   <MSGText> 
2466    <literallayout>
2467  # Turn them off!
2468  {+fast-redirects}
2469  
2470  # Reverse it for these two sites, which don't work right without it.
2471  {-fast-redirects}
2472  www.ukc.ac.uk/cgi-bin/wac\.cgi\?
2473  login.yahoo.com
2474    </literallayout>
2475   </MSGText> 
2476  </literal>
2477 </para>
2478
2479 <para>
2480  Turn on page filtering, with one exception for sourceforge:
2481 </para>
2482
2483 <para>
2484  <literal>
2485   <MSGText> 
2486    <literallayout>
2487  # Run everything through the default filter file (<filename>re_filterfile</filename>):
2488  {+filter}
2489  
2490  # But please don't re_filter code from sourceforge!
2491  {-filter}
2492  .cvs.sourceforge.net
2493    </literallayout>
2494   </MSGText> 
2495  </literal>
2496 </para>
2497
2498 <para>
2499  Now some URLs that we want <quote>blocked</quote>, ie we won't see them.
2500  Many of these use regular expressions that will expand to match multiple 
2501  URLs:
2502 </para>
2503
2504 <para>
2505  <literal>
2506   <MSGText> 
2507    <literallayout>
2508   # Blocklist:
2509   {+block}
2510   /.*/(.*[-_.])?ads?[0-9]?(/|[-_.].*|\.(gif|jpe?g))
2511   /.*/(.*[-_.])?count(er)?(\.cgi|\.dll|\.exe|[?/])
2512   /.*/(ng)?adclient\.cgi
2513   /.*/(plain|live|rotate)[-_.]?ads?/
2514   /.*/(sponsor)s?[0-9]?/
2515   /.*/_?(plain|live)?ads?(-banners)?/
2516   /.*/abanners/
2517   /.*/ad(sdna_image|gifs?)/
2518   /.*/ad(server|stream|juggler)\.(cgi|pl|dll|exe)
2519   /.*/adbanners/
2520   /.*/adserver
2521   /.*/adstream\.cgi
2522   /.*/adv((er)?ts?|ertis(ing|ements?))?/
2523   /.*/banner_?ads/
2524   /.*/banners?/
2525   /.*/banners?\.cgi/
2526   /.*/cgi-bin/centralad/getimage
2527   /.*/images/addver\.gif
2528   /.*/images/marketing/.*\.(gif|jpe?g)
2529   /.*/popupads/
2530   /.*/siteads/
2531   /.*/sponsor.*\.gif
2532   /.*/sponsors?[0-9]?/
2533   /.*/advert[0-9]+\.jpg
2534   /Media/Images/Adds/
2535   /ad_images/
2536   /adimages/
2537   /.*/ads/
2538   /bannerfarm/
2539   /grafikk/annonse/
2540   /graphics/defaultAd/
2541   /image\.ng/AdType
2542   /image\.ng/transactionID
2543   /images/.*/.*_anim\.gif # alvin brattli
2544   /ip_img/.*\.(gif|jpe?g)
2545   /rotateads/
2546   /rotations/ 
2547   /worldnet/ad\.cgi
2548   /cgi-bin/nph-adclick.exe/
2549   /.*/Image/BannerAdvertising/
2550   /.*/ad-bin/
2551   /.*/adlib/server\.cgi
2552   /autoads/
2553    </literallayout>
2554   </MSGText> 
2555  </literal>
2556 </para>
2557
2558 </sect3>
2559
2560 <!--  ~  End section  ~  -->
2561
2562
2563 <!--   ~~~~~       New section      ~~~~~     -->
2564 <sect3>
2565 <title>Aliases</title>
2566 <para>
2567  Custom <quote>actions</quote>, known to <application>Junkbuster</application>
2568  as <quote>aliases</quote>, can be defined by combining other <quote>actions</quote>.
2569  These can in turn be invoked just like the built-in <quote>actions</quote>.
2570  Currently, an alias can contain any character except space, tab, <quote>=</quote>,
2571  <quote>{</quote> or <quote>}</quote>. But please use only <quote>a</quote>-
2572  <quote>z</quote>, <quote>0</quote>-<quote>9</quote>, <quote>+</quote>, and
2573  <quote>-</quote>. Alias names are not case sensitive, and 
2574  <emphasis>must be defined  before anything</emphasis> else in the
2575  <filename>ijb.action</filename>file ! And there can only be one set of
2576  <quote>aliases</quote> defined.
2577 </para>
2578
2579 <para>
2580  Now let's define a few aliases:
2581 </para>
2582
2583 <para>
2584  <literal>
2585   <MSGText> 
2586    <literallayout>
2587  # Useful customer aliases we can use later. These must come first!
2588  {{alias}}
2589  +no-cookies = +no-cookies-set +no-cookies-read
2590  -no-cookies = -no-cookies-set -no-cookies-read
2591  fragile     = -block -no-cookies -filter -fast-redirects -hide-referer -no-popups
2592  shop        = -no-cookies -filter -fast-redirects
2593  +imageblock = +block +image
2594
2595  #For people who don't like to type too much:  ;-)
2596  c0 = +no-cookies
2597  c1 = -no-cookies
2598  c2 = -no-cookies-set +no-cookies-read
2599  c3 = +no-cookies-set -no-cookies-read
2600  #... etc.  Customize to your heart's content.
2601    </literallayout>
2602   </MSGText> 
2603  </literal>
2604 </para>
2605
2606 <para>
2607  Some examples using our <quote>shop</quote> and <quote>fragile</quote>
2608  aliases from above:
2609 </para>
2610
2611 <para>
2612  <literal>
2613   <MSGText> 
2614    <literallayout>
2615  # These sites are very complex and require
2616  # minimal interference.
2617  {fragile}
2618  .office.microsoft.com
2619  .windowsupdate.microsoft.com
2620  .nytimes.com
2621
2622  # Shopping sites - still want to block ads.
2623  {shop}
2624  .quietpc.com
2625  .worldpay.com   # for quietpc.com
2626  .jungle.com
2627  .scan.co.uk
2628
2629  # These shops require pop-ups
2630  {shop -no-popups}
2631  .dabs.com
2632  .overclockers.co.uk
2633    </literallayout>
2634   </MSGText> 
2635  </literal>
2636 </para>
2637
2638 </sect3>
2639 </sect2>
2640
2641 <!--  ~  End section  ~  -->
2642
2643
2644 <!--   ~~~~~       New section      ~~~~~     -->
2645 <sect2 id="filterfile">
2646 <title>The Filter File</title>
2647 <para>
2648  The filter file defines what filtering of web pages
2649  <application>Junkbuster</application> does. The default filter file is 
2650  <filename>re_filterfile</filename>, located in the config directory. In this 
2651  file, <emphasis>any document content</emphasis>, whether viewable text or
2652  embedded non-visible content, can be changed. 
2653 </para>
2654
2655 <para>
2656  This file uses regular expressions to alter or remove any string in the
2657  target page. Some examples from the included default <filename>re_filterfile</filename>:
2658 </para>
2659
2660 <para>
2661  Stop web pages from displaying annoying messages in the status bar by
2662  deleting such references:
2663 </para>
2664
2665 <para>
2666  <literal>
2667   <MSGText> 
2668    <literallayout>
2669  # The status bar is for displaying link targets, not pointless buzzwords.
2670  # Again, check it out on http://www.airport-cgn.de/.
2671  s/status='.*?';*//ig
2672    </literallayout>
2673   </MSGText> 
2674  </literal>
2675 </para>
2676
2677 <para>
2678  Just for kicks, replace any occurrence of <quote>Microsoft</quote> with
2679  <quote>MicroSuck</quote>: 
2680 </para>
2681
2682 <para>
2683  <literal>
2684   <MSGText> 
2685    <literallayout>
2686  s/microsoft(?!.com)/MicroSuck/ig
2687    </literallayout>
2688   </MSGText> 
2689  </literal>
2690 </para>
2691
2692 <para>
2693  Kill those auto-refresh tags:
2694 </para>
2695
2696 <para>
2697  <literal>
2698   <MSGText> 
2699    <literallayout>
2700  # Kill refresh tags. I like to refresh myself. Manually.
2701  # check it out on http://www.airport-cgn.de/ and go to the arrivals page.
2702  #
2703  s/&lt;meta[^&gt;]*http-equiv[^&gt;]*refresh.*URL=([^&gt;]*?)"?&gt;/&lt;link rev="x-refresh" href=$1&gt;/i
2704  s/&lt;meta[^&gt;]*http-equiv="?page-enter"?[^&gt;]*content=[^&gt;]*&gt;/&lt;!--no page enter for me--&gt;/i
2705    </literallayout>
2706   </MSGText> 
2707  </literal>
2708 </para>
2709
2710 </sect2>
2711
2712 </sect1>
2713
2714 <!--   ~~~~~       New section      ~~~~~     -->
2715 <sect1 id="quickstart"><title>Quickstart to Using Junkbuster</title>
2716 <para>
2717  Install package, then run and enjoy! <application>Junbuster</application> 
2718  accepts only one command line option -- the configuration file to be 
2719  used. Example Unix startup command:
2720 </para>
2721
2722 <para>
2723  <screen>
2724  
2725  # /usr/sbin/junkbuster /etc/junkbuster/config
2726  
2727  </screen>
2728 </para>
2729
2730 <para>
2731  An init script is provided for SuSE and Redhat.
2732 </para>
2733
2734 <para>
2735 For for SuSE: /etc/rc.d/junkbuster start
2736 </para>
2737
2738 <para>
2739 For RedHat: /etc/rc.d/init.d/junkbuster start
2740 </para>
2741
2742
2743 <para>
2744  If no configuration file is specified on the command line,
2745  <application>Junkbuster</application> will look for a file named
2746  <filename>config</filename> in the current directory. Except on Amiga where
2747  it will look for <filename>AmiTCP:db/junkbuster/config</filename> and Win32
2748  where it will try <filename>config.txt</filename>. If no file is specified 
2749  on the command line and no default configuration file can be found, 
2750  <application>Junkbuster</application> will fail to start.
2751 </para>
2752
2753 <para>
2754  Be sure your browser is set to use the proxy which is by default at
2755  localhost, port 8000. With <application>Netscape</application> (and
2756  <application>Mozilla</application>), this can be set under <literal>Edit
2757  -&gt; Preferences -&gt; Advanced -&gt; Proxies -&gt; HTTP Proxy</literal>.
2758  For <application>Internet Explorer</application>: <literal>Tools &gt;
2759  Internet Properties -&gt; Connections -&gt; LAN Setting</literal>. Then,
2760  check <quote>Use Proxy</quote> and fill in the appropriate info (Address:
2761  localhost, Port: 8000). Include if HTTPS proxy support too.
2762 </para>
2763
2764 <para>
2765  The included default configuration files should give a reasonable starting
2766  point, though may be somewhat aggressive in blocking junk. You will probably
2767  want to keep an eye out for sites that require persistant cookies, and add these to
2768  <filename>ijb.action</filename> as needed. By default, most of these will
2769  be accepted only during the current browser session, until you add them to
2770  the configuration. If you want the browser to handle this instead, you will
2771  need to edit <filename>ijb.action</filename> and disable this feature. If you
2772  use more than one browser, it would make more sense to let
2773  <application>Junkbuster</application> handle this. In which case, the
2774  browser(s) should be set to accept all cookies.
2775 </para>
2776
2777 <para>
2778  If a particular site shows problems loading properly, try adding it 
2779  to the <literal>{fragile}</literal> section of
2780  <filename>ijb.action</filename>. This will turn off most actions for 
2781  this site.
2782 </para>
2783
2784 <para>
2785  HTTP/1.1 support is not fully implemented. If browsers that
2786  support HTTP/1.1 (like <application>Mozilla</application> or recent versions
2787  of I.E.) experience problems, you might try to force HTTP/1.0 compatiblity.
2788  For Mozilla, look under <literal>Edit -&gt; Preferences -&gt; Debug -&gt;
2789  Networking</literal>. Or set the <quote>+downgrade</quote> config option in
2790  <filename>ijb.action</filename>.
2791 </para>
2792
2793 <para>
2794  After running <application>Junkbuster</application> for a while, you can 
2795  start to fine tune the configuration to suit your personal, or site, 
2796  preferences and requirements. There are many, many aspects that can 
2797  be customized. <quote>Actions</quote> (as specified in <filename>ijb.action</filename>) 
2798  can be adjusted by pointing your browser to 
2799  <ulink url="http://i.j.b./">http://i.j.b./</ulink>, 
2800  and then follow the link to <quote>edit the actions list</quote>. 
2801  (This is an internal page and does not require Internet access.)
2802 </para>
2803
2804 <para>
2805  In fact, various aspects of <application>Junkbuster</application>
2806  configuration can be viewed from this page, including 
2807  current configuration parameters, source code version numbers, 
2808  the browser's request headers, and <quote>actions</quote> that apply 
2809  to a given URL. In addition to the <filename>ijb.action</filename> file 
2810  editor mentioned above, <application>Junkbuster</application> can also 
2811  be turned <quote>on</quote> and <quote>off</quote> from this page.
2812 </para>
2813
2814 <para>
2815  If you encounter problems, please verify it is a
2816  <application>Junkbuster</application> bug, by disabling
2817  <application>Junkbuster</application>, and then trying the same page. 
2818  Also, try another browser if possible to eliminate browser or site 
2819  problems. Before reporting it as a bug, see if there is not a configuration 
2820  option that is enabled that is causing the page not to load. You can 
2821  then add an exception for that page or site. If a bug, please report it to
2822  the developers (see below). 
2823 </para>
2824
2825 </sect1>
2826
2827
2828 <!--   ~~~~~       New section      ~~~~~     -->
2829 <sect1 id="contact"><title>Contact the Developers</title>
2830 <para>
2831 <!--
2832 To be filled. mention the support forums as the primary channel of
2833 communication (bugs, feature requests, etc.)
2834 -->
2835  Feature requests and other questions should be posted to the <ulink
2836  url="http://sourceforge.net/tracker/?atid=361118&amp;group_id=11118&amp;func=browse">Feature
2837  request page</ulink> at SourceForge. There is also an archive there.
2838 </para>
2839
2840 <para>
2841  Anyone interested in actively participating in development and related 
2842  discussions can join the appropriate mailing list  
2843  <ulink url="http://sourceforge.net/mail/?group_id=11118">here</ulink>.
2844  Archives are available here too.
2845 </para>
2846
2847 <para>
2848  Please report bugs, using the form at 
2849  <ulink url="http://sourceforge.net/tracker/?group_id=11118&amp;atid=111118">Sourceforge</ulink>.
2850  Please try to verify that it is a <application>Junkbuster</application> bug,
2851  and not a browser or site bug first. Also, check to make sure this is not
2852  already a known bug.
2853 </para>
2854
2855 </sect1>
2856
2857
2858 <!--   ~~~~~       New section      ~~~~~     -->
2859 <sect1 id="copyright"><title>Copyright and History</title>
2860
2861 <sect2>
2862 <title>License</title>
2863 <para>
2864  <application>Internet Junkbuster</application> is free software; you can
2865  redistribute it and/or modify it under the terms of the GNU General Public
2866  License as published by the Free Software Foundation; either version 2 of the
2867  License, or (at your option) any later version.
2868 </para>
2869
2870 <para>
2871  This program is distributed in the hope that it will be useful, but WITHOUT
2872  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
2873  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
2874  details, which is available from <ulink
2875  url="http://www.gnu.org/copyleft/gpl.html">the Free Software Foundation,
2876  Inc</ulink>, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
2877 </para>
2878
2879 </sect2>
2880
2881 <!--  ~  End section  ~  -->
2882
2883
2884 <!--   ~~~~~       New section      ~~~~~     -->
2885
2886 <sect2>
2887 <title>History</title>
2888 <para>
2889  <application>Junkbuster</application> was originally written by Anonymous 
2890  Coders and <ulink
2891  url="http://www.junkbusters.com/ht/en/ijbfaq.html">JunkBusters
2892  Corporation</ulink>, and was released as free open-source software under the
2893  GNU GPL. <ulink url="http://www.waldherr.org/junkbuster/">Stefan
2894  Waldherr</ulink> made many improvements, and started the <ulink
2895  url="http://sourceforge.net/projects/ijbswa/">SourceForge project</ulink> to
2896  rekindle development. The last stable release was v2.0.2, which has now 
2897  grown whiskers ;-).
2898 </para>
2899
2900 </sect2>
2901
2902 </sect1>
2903
2904 <!--   ~~~~~       New section      ~~~~~     -->
2905 <sect1 id="seealso"><title>See also</title>
2906 <para>
2907  
2908  <simplelist>
2909   <member>
2910    &nbsp; <ulink url="http://sourceforge.net/projects/ijbswa">http://sourceforge.net/projects/ijbswa</ulink>
2911   </member>
2912  </simplelist>
2913  <simplelist>
2914   <member>
2915    &nbsp; <ulink url="http://ijbswa.sourceforge.net/">http://ijbswa.sourceforge.net/</ulink>
2916   </member>
2917  </simplelist>
2918  <simplelist>
2919   <member>
2920    &nbsp; <ulink url="http://i.j.b./">http://i.j.b./</ulink>
2921   </member>
2922  </simplelist>
2923  <simplelist>
2924   <member>
2925    &nbsp; <ulink url="http://www.junkbusters.com/ht/en/cookies.html">http://www.junkbusters.com/ht/en/cookies.html</ulink>
2926   </member>
2927  </simplelist>
2928  <simplelist>
2929   <member>
2930    &nbsp; <ulink url="http://www.waldherr.org/junkbuster/">http://www.waldherr.org/junkbuster/</ulink>
2931   </member>
2932  </simplelist>
2933  <simplelist>
2934   <member>
2935    &nbsp; <ulink url="http://privacy.net/analyze/">http://privacy.net/analyze/</ulink>
2936   </member>
2937  </simplelist>
2938  <simplelist>
2939   <member>
2940    &nbsp;<ulink url="http://www.squid-cache.org/">http://www.squid-cache.org/</ulink>
2941   </member>
2942  </simplelist>
2943
2944 </para>
2945 </sect1>
2946
2947
2948
2949 <!--   ~~~~~       New section      ~~~~~     -->
2950 <sect1 id="appendix"><title>Appendix</title>
2951
2952
2953 <!--   ~~~~~       New section      ~~~~~     -->
2954 <sect2 id="regex">
2955 <title>Regular Expressions</title>
2956 <para>
2957  <application>Junkbuster</application> can use <quote>regular expressions</quote> 
2958  in various config files. Assuming support for <quote>pcre</quote> (Perl
2959  Compatible Regular Expressions) is compiled in, which is the default. Such
2960  configuration directives do not require regular expressions, but they can be
2961  used to increase flexibility by matching a pattern with wildcards against
2962  URLs.
2963 </para>
2964
2965 <para>
2966  If you are reading this, you probably don't understand what <quote>regular
2967  expressions</quote> are, or what they can do. So this will be a very brief
2968  introduction only. A full explanation would require a book ;-)
2969 </para>
2970
2971 <para>
2972  <quote>Regular expressions</quote> is a way of matching one character
2973  expression against another to see if it matches or not. One of the
2974  <quote>expressions</quote> is a literal string of readable characters
2975  (letter, numbers, etc), and the other is a complex string of literal
2976  characters combined with wildcards, and other special characters, called
2977  metacharacters. The <quote>metacharacters</quote> have special meanings and
2978  are used to build the complex pattern to be matched against. Perl Compatible
2979  Regular Expressions is an enhanced form of the regular expression language
2980  with backward compatibility.
2981 </para>
2982
2983 <para>
2984  To make a simple analogy, we do something similar when we use wildcard
2985  characters when listing files with the <command>dir</command> command in DOS. 
2986  <literal>*.*</literal> matches all filenames. The <quote>special</quote>
2987  character here is the asterik which matches any and all characters. We can be
2988  more specific and use <literal>?</literal> to match just individual
2989  characters. So <quote>dir file?.text</quote> would match
2990  <quote>file1.txt</quote>, <quote>file2.txt</quote>, etc. We are pattern
2991  matching, using a similar technique to <quote>regular expressions</quote>!
2992 </para>
2993
2994 <para>
2995  Regular expressions do essentially the same thing, but are much, much more
2996  powerful. There are many more <quote>special characters</quote> and ways of 
2997  building complex patterns however. Let's look at a few of the common ones,
2998  and then some examples:
2999 </para>
3000
3001 <simplelist>
3002  <member>
3003   <emphasis>.</emphasis> - Matches any single character, e.g. <quote>a</quote>,
3004   <quote>A</quote>, <quote>4</quote>, <quote>:</quote>, or <quote>@</quote>.
3005  </member>
3006 </simplelist>
3007
3008 <simplelist>
3009  <member>
3010   <emphasis>?</emphasis> - The preceding character or expression is matched ZERO or ONE
3011   times. Either/or.
3012  </member>
3013 </simplelist>
3014
3015 <simplelist>
3016  <member>
3017   <emphasis>+</emphasis> - The preceding character or expression is matched ONE or MORE
3018   times.
3019  </member>
3020 </simplelist>
3021
3022 <simplelist>
3023  <member>
3024   <emphasis>*</emphasis> - The preceding character or expression is matched ZERO or MORE
3025   times.
3026  </member>
3027 </simplelist>
3028
3029 <simplelist>
3030  <member>
3031   <emphasis>\</emphasis> - The <quote>escape</quote> character denotes that
3032   the following character should be taken literally. This is used where one of the 
3033   special characters (e.g. <quote>.</quote>) needs to be taken literally and
3034   not as a special metacharacter.
3035  </member>
3036 </simplelist>
3037
3038 <simplelist>
3039  <member>
3040   <emphasis>[]</emphasis> - Characters enclosed in brackets will be matched if
3041   any of the enclosed characters are encountered.
3042  </member>
3043 </simplelist>
3044
3045 <simplelist>
3046  <member>
3047   <emphasis>()</emphasis> - Pararentheses are used to group a sub-expression,
3048   or multiple sub-expressions.
3049  </member>
3050 </simplelist>
3051
3052 <simplelist>
3053  <member>
3054   <emphasis>|</emphasis> - The <quote>bar</quote> character works like an
3055   <quote>or</quote> conditional statement. A match is successful if the
3056   sub-expression on either side of <quote>|</quote> matches.
3057  </member>
3058 </simplelist>
3059
3060 <simplelist>
3061  <member>
3062   <emphasis>s/string1/string2/g</emphasis> - This is used to rewrite strings of text. 
3063   <quote>string1</quote> is replaced by <quote>string2</quote> in this
3064   example.
3065  </member>
3066 </simplelist>
3067
3068 <para>
3069  These are just some of the ones you are likely to use when matching URLs with 
3070  <application>Junkbuster</application>, and is a long way from a definitive
3071  list. This is enough to get us started with a few simple examples which may
3072  be more illuminating:
3073 </para>
3074
3075 <para>
3076  <emphasis><literal>/.*/banners/.*</literal></emphasis> - A  simple example
3077  that uses the common combination of <quote>.</quote> and <quote>*</quote> to 
3078  denote any character, zero or more times. In other words, any string at all.
3079  So we start with a literal forward slash, then our regular expression pattern 
3080  (<quote>.*</quote>) another literal forward slash, the string
3081  <quote>banners</quote>, another forward slash, and lastly another
3082  <quote>.*</quote>. We are building 
3083  a directory path here. This will match any file with the path that has a
3084  directory named <quote>banners</quote> in it. The <quote>.*</quote> matches
3085  any characters, and this could conceivably be more forward slashes, so it
3086  might expand into a much longer looking path. For example, this could match:
3087  <quote>/eye/hate/spammers/banners/annoy_me_please.gif</quote>, or just
3088  <quote>/banners/annoying.html</quote>, or almost an infinite number of other
3089  possible combinations, just so it has <quote>banners</quote> in the path
3090  somewhere.
3091 </para>
3092
3093 <para>
3094  A now something a little more complex:
3095 </para>
3096
3097 <para>
3098  <emphasis><literal>/.*/adv((er)?ts?|ertis(ing|ements?))?/</literal></emphasis> - 
3099  We have several literal forward slashes again (<quote>/</quote>), so we are
3100  building another expression that is a file path statement. We have another 
3101  <quote>.*</quote>, so we are matching against any conceivable sub-path, just so
3102  it matches our expression. The only true literal that <emphasis>must
3103  match</emphasis> our pattern is <application>adv</application>, together with
3104  the forward slashes. What comes after the <quote>adv</quote> string is the
3105  interesting part. 
3106 </para>
3107
3108 <para>
3109  Remember the <quote>?</quote> means the preceding expression (either a
3110  literal character or anything grouped with <quote>(...)</quote> in this case)
3111  can exist or not, since this means either zero or one match. So
3112  <quote>((er)?ts?|ertis(ing|ements?))</quote> is optional, as are the
3113  individual sub-expressions: <quote>(er)</quote>,
3114  <quote>(ing|ements?)</quote>, and the <quote>s</quote>. The <quote>|</quote>
3115  means <quote>or</quote>. We have two of those. For instance, 
3116  <quote>(ing|ements?)</quote>, can expand to match either <quote>ing</quote> 
3117  <emphasis>OR</emphasis> <quote>ements?</quote>. What is being done here, is an
3118  attempt at matching as many variations of <quote>advertisement</quote>, and 
3119  similar, as possible. So this would expand to match just <quote>adv</quote>,
3120  or <quote>advert</quote>, or <quote>adverts</quote>, or
3121  <quote>advertising</quote>, or <quote>advertisement</quote>, or
3122  <quote>advertisements</quote>. You get the idea. But it would not match 
3123  <quote>advertizements</quote> (with a <quote>z</quote>). We could fix that by
3124  changing our regular expression to: 
3125  <quote>/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/</quote>, which would then match
3126  either spelling.
3127 </para>
3128
3129 <para>
3130  <emphasis><literal>/.*/advert[0-9]+\.(gif|jpe?g)</literal></emphasis> - Again 
3131  another path statement with forward slashes. Anything in the square brackets 
3132  <quote>[]</quote> can be matched. This is using <quote>0-9</quote> as a
3133  shorthand expression to mean any digit one through nine. It is the same as
3134  saying <quote>0123456789</quote>. So any digit matches. The <quote>+</quote>
3135  means one or more of the preceding expression must be included. The preceding 
3136  expression here is what is in the square brackets -- in this case, any digit 
3137  one through nine. Then, at the end, we have a grouping: <quote>(gif|jpe?g)</quote>. 
3138  This includes a <quote>|</quote>, so this needs to match the expression on
3139  either side of that bar character also. A simple <quote>gif</quote> on one side, and the other
3140  side will in turn match either <quote>jpeg</quote> or <quote>jpg</quote>,
3141  since the <quote>?</quote> means the letter <quote>e</quote> is optional and
3142  can be matched once or not at all. So we are building an expression here to
3143  match image GIF or JPEG type image file. It must include the literal
3144  string <quote>advert</quote>, then one or more digits, and a <quote>.</quote>
3145  (which is now a literal, and not a special character, since it is escaped
3146  with <quote>\</quote>), and lastly either <quote>gif</quote>, or
3147  <quote>jpeg</quote>, or <quote>jpg</quote>. Some possible matches would
3148  include: <quote>//advert1.jpg</quote>,
3149  <quote>/nasty/ads/advert1234.gif</quote>,
3150  <quote>/banners/from/hell/advert99.jpg</quote>. It would not match
3151  <quote>advert1.gif</quote> (no leading slash), or
3152  <quote>/adverts232.jpg</quote> (the expression does not include an
3153  <quote>s</quote>), or <quote>/advert1.jsp</quote> (<quote>jsp</quote> is not
3154  in the expression anywhere).
3155 </para>
3156
3157 <para>
3158  <emphasis><literal>s/microsoft(?!.com)/MicroSuck/i</literal></emphasis> - This is 
3159  a substitution. <quote>MicroSuck</quote> will replace any occurence of 
3160  <quote>microsoft</quote>.  The <quote>i</quote> at the end of the expression
3161  means ignore case. The <quote>(?!.com)</quote> means 
3162  the match should fail if <quote>microsoft</quote> is followed by
3163  <quote>.com</quote>. In other words, this acts like a <quote>NOT</quote>
3164  modifier. In case this is a hyperlink, we don't want to break it ;-).
3165 </para>
3166
3167 <para>
3168  We are barely scratching the surface of regular expressions here so that you
3169  can understand the default <application>Junkbuster</application>
3170  configuration files, and maybe use this knowledge to customize your own
3171  installation. There is much, much more that can be done with regular
3172  expressions. Now that you know enough to get started, you can learn more on
3173  your own :/
3174 </para>
3175
3176 <para>
3177  More reading on Perl Compatible Regular expressions: 
3178  <ulink url="http://www.perldoc.com/perl5.6/pod/perlre.html">http://www.perldoc.com/perl5.6/pod/perlre.html</ulink>
3179 </para>
3180
3181 </sect2>
3182
3183 </sect1>
3184
3185  <!--
3186
3187  This program is free software; you can redistribute it 
3188  and/or modify it under the terms of the GNU General
3189  Public License as published by the Free Software
3190  Foundation; either version 2 of the License, or (at
3191  your option) any later version.
3192
3193  This program is distributed in the hope that it will
3194  be useful, but WITHOUT ANY WARRANTY; without even the
3195  implied warranty of MERCHANTABILITY or FITNESS FOR A
3196  PARTICULAR PURPOSE.  See the GNU General Public
3197  License for more details.
3198
3199  The GNU General Public License should be included with
3200  this file.  If not, you can view it at
3201  http://www.gnu.org/copyleft/gpl.html
3202  or write to the Free Software Foundation, Inc., 59
3203  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
3204
3205  $Log: user-manual.sgml,v $
3206  Revision 1.22  2001/11/05 23:57:51  hal9
3207  Minor update for startup now daemon mode.
3208
3209  Revision 1.21  2001/10/31 21:11:03  hal9
3210  Correct 2 minor errors
3211
3212  Revision 1.18  2001/10/24 18:45:26  hal9
3213  *** empty log message ***
3214
3215  Revision 1.17  2001/10/24 17:10:55  hal9
3216  Catching up with Jon's recent work, and a few other things.
3217
3218  Revision 1.16  2001/10/21 17:19:21  swa
3219  wrong url in documentation
3220
3221  Revision 1.15  2001/10/14 23:46:24  hal9
3222  Various minor changes. Fleshed out SEE ALSO section.
3223
3224  Revision 1.13  2001/10/10 17:28:33  hal9
3225  Very minor changes.
3226
3227  Revision 1.12  2001/09/28 02:57:04  hal9
3228  Ditto :/
3229
3230  Revision 1.11  2001/09/28 02:25:20  hal9
3231  Ditto.
3232
3233  Revision 1.9  2001/09/27 23:50:29  hal9
3234  A few changes. A short section on regular expression in appendix.
3235
3236  Revision 1.8  2001/09/25 00:34:59  hal9
3237  Some additions, and re-arranging.
3238
3239  Revision 1.7  2001/09/24 14:31:36  hal9
3240  Diddling.
3241
3242  Revision 1.6  2001/09/24 14:10:32  hal9
3243  Including David's OS/2 installation instructions.
3244
3245  Revision 1.2  2001/09/13 15:27:40  swa
3246  cosmetics
3247
3248  Revision 1.1  2001/09/12 15:36:41  swa
3249  source files for junkbuster documentation
3250
3251  Revision 1.3  2001/09/10 17:43:59  swa
3252  first proposal of a structure.
3253
3254  Revision 1.2  2001/06/13 14:28:31  swa
3255  docs should have an author.
3256
3257  Revision 1.1  2001/06/13 14:20:37  swa
3258  first import of project's documentation for the webserver.
3259
3260  -->
3261
3262 </article>