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