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