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