7f809d3149af1af1560694a3d21e9ef4e71c8419
[privoxy.git] / doc / text / user-manual.txt
1 Junkbuster User Manual
2
3 By: Junkbuster Developers
4
5 $Id: user-manual.sgml,v 1.35 2002/03/05 00:17:27 hal9 Exp $
6
7 The user manual gives the users information on how to install and configure
8 Internet Junkbuster. Internet Junkbuster is an application that provides
9 privacy and security to users of the World Wide Web.
10
11 You can find the latest version of the user manual at http://
12 ijbswa.sourceforge.net/user-manual/.
13
14 Feel free to send a note to the developers at <
15 ijbswa-developers@lists.sourceforge.net>.
16
17 -------------------------------------------------------------------------------
18
19 Table of Contents
20 1. Introduction
21    
22     1.1. New Features
23    
24 2. Installation
25    
26     2.1. Source
27     2.2. Red Hat
28     2.3. SuSE
29     2.4. OS/2
30     2.5. Windows
31     2.6. Other
32    
33 3. Invoking and Configuring JunkBuster
34    
35     3.1. Command Line Options
36     3.2. The Main Configuration File
37        
38         3.2.1. Defining Other Configuration Files
39         3.2.2. Other Configuration Options
40         3.2.3. Access Control List (ACL)
41         3.2.4. Forwarding
42         3.2.5. Windows GUI Options
43        
44     3.3. The Actions File
45        
46         3.3.1. URL Domain and Path Syntax
47         3.3.2. Actions
48         3.3.3. Aliases
49        
50     3.4. The Filter File
51     3.5. Templates
52    
53 4. Quickstart to Using Junkbuster
54 5. Contacting the Developers, Bug Reporting and Feature Requests
55 6. Copyright and History
56    
57     6.1. License
58     6.2. History
59    
60 7. See also
61 8. Appendix
62    
63     8.1. Regular Expressions
64    
65 1. Introduction
66
67 Internet Junkbuster is a web proxy with advanced filtering capabilities for
68 protecting privacy, filtering and modifying web page content, managing cookies,
69 controlling access, and removing ads, banners, pop-ups and other obnoxious
70 Internet Junk. Junkbuster has a very flexible configuration and can be
71 customized to suit individual needs and tastes. Internet Junkbuster has
72 application for both stand-alone systems and multi-user networks.
73
74 This documentation is included with the current BETA version of Internet
75 Junkbuster and mostly complete at this point. The most up to date reference for
76 the time being is still the comments in the source files and in the individual
77 configuration files. Development of version 3.0 is currently nearing
78 completion, and includes many significant changes and enhancements over earlier
79 versions. The target release date for stable v3.0 is "soon" ;-)
80
81 Since this is a BETA version, not all new features are well tested. This
82 documentation may be slightly out of sync as a result. And there may be bugs,
83 though hopefully not many!
84
85 -------------------------------------------------------------------------------
86
87 1.1. New Features
88
89 In addition to Junkbuster's traditional features of ad and banner blocking and
90 cookie management, this is a list of new features currently under development:
91
92   * Integrated browser based configuration and control utility (http://i.j.b).
93     Browser-based tracing of rule and filter effects.
94    
95   * Modularized configuration that will allow for system wide settings, and
96     individual user settings. (not implemented yet, probably a 3.1 feature)
97    
98   * Blocking of annoying pop-up browser windows.
99    
100   * HTTP/1.1 compliant (most, but not all 1.1 features are supported).
101    
102   * Support for Perl Compatible Regular Expressions in the configuration files,
103     and generally a more sophisticated and flexible configuration syntax over
104     previous versions.
105    
106   * GIF de-animation.
107    
108   * Web page content filtering (removes banners based on size, invisible
109     "web-bugs", JavaScript, pop-ups, status bar abuse, etc.)
110    
111   * Bypass many click-tracking scripts (avoids script redirection).
112    
113   * Multi-threaded (POSIX and native threads).
114    
115   * Auto-detection and re-reading of config file changes.
116    
117   * User-customizable HTML templates (e.g. 404 error page).
118    
119   * Improved cookie management features (e.g. session based cookies).
120    
121   * Builds from source on most UNIX-like systems. Packages available for: Linux
122     (RedHat, SuSE, or Debian), Windows, Sun Solaris, Mac OSX, OS/2.
123    
124   * In addition, the configuration is much more powerful and versatile
125     over-all.
126    
127 -------------------------------------------------------------------------------
128
129 2. Installation
130
131 Junkbuster is available as raw source code, or pre-compiled binaries. See the 
132 Junkbuster Home Page for current release info. Junkbuster is also available via
133 CVS. This is the recommended approach at this time. But please be aware that
134 CVS is constantly changing, and it may break in mysterious ways.
135
136 -------------------------------------------------------------------------------
137
138 2.1. Source
139
140 For gzipped tar archives, unpack the source:
141
142  tar xzvf ijb_source_* [.tgz or .tar.gz]                                       
143  cd ijb_source_2.9.10_beta                                                     
144                                                                                
145
146 For retrieving the current CVS sources, you'll need the CVS package installed
147 first. To download CVS source:
148
149   cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login          
150   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current 
151   cd current                                                                         
152                                                                                      
153
154 This will create a directory named current/, which will contain the source
155 tree.
156
157 Then, in either case, to build from tarball/CVS source:
158
159  ./configure      (--help to see options)                                      
160  make             (the make from gnu, gmake for *BSD)                          
161  su                                                                            
162  make -n install  (to see where all the files will go)                         
163  make install     (to really install)                                          
164                                                                                
165
166 For Redhat and SuSE Linux RPM packages, see below.
167
168 -------------------------------------------------------------------------------
169
170 2.2. Red Hat
171
172 To build Redhat RPM packages, install source as above. Then:
173
174  autoheader   [suggested for CVS source]                                       
175  autoconf     [suggested for CVS source]                                       
176  ./configure                                                                   
177  make redhat-dist                                                              
178                                                                                
179
180 This will create both binary and src RPMs in the usual places. Example:
181
182    /usr/src/redhat/RPMS/i686/junkbuster-2.9.11-1.i686.rpm
183
184    /usr/src/redhat/SRPMS/junkbuster-2.9.11-1.src.rpm
185
186 To install, of course:
187
188  rpm -Uvv /usr/src/redhat/RPMS/i686/junkbuster-2.9.11-1.i686.rpm               
189                                                                                
190
191 This will place the Junkbuster configuration files in /etc/junkbuster/, and log
192 files in /var/log/junkbuster/.
193
194 -------------------------------------------------------------------------------
195
196 2.3. SuSE
197
198 To build SuSE RPM packages, install source as above. Then:
199
200  autoheader   [suggested for CVS source]                                       
201  autoconf     [suggested for CVS source]                                       
202  ./configure                                                                   
203  make suse-dist                                                                
204                                                                                
205
206 This will create both binary and src RPMs in the usual places. Example:
207
208    /usr/src/packages/RPMS/i686/junkbuster-2.9.11-1.i686.rpm
209
210    /usr/src/packages/SRPMS/junkbuster-2.9.11-1.src.rpm
211
212 To install, of course:
213
214  rpm -Uvv /usr/src/packages/RPMS/i686/junkbuster-2.9.11-1.i686.rpm             
215                                                                                
216
217 This will place the Junkbuster configuration files in /etc/junkbuster/, and log
218 files in /var/log/junkbuster/.
219
220 -------------------------------------------------------------------------------
221
222 2.4. OS/2
223
224 Junkbuster is packaged in a WarpIN self- installing archive. The
225 self-installing program will be named depending on the release version,
226 something like: ijbos2_setup_1.2.3.exe. In order to install it, simply run this
227 executable or double-click on its icon and follow the WarpIN installation
228 panels. A shadow of the Junkbuster executable will be placed in your startup
229 folder so it will start automatically whenever OS/2 starts.
230
231 The directory you choose to install Junkbuster into will contain all of the
232 configuration files.
233
234 If you would like to build binary images on OS/2 yourself, you will need a few
235 Unix-like tools: autoconf, autoheader and sh. These tools will be used to
236 create the required config.h file, which is not part of the source distribution
237 because it differs based on platform. You will also need a compiler. The
238 distribution has been created using IBM VisualAge compilers, but you can use
239 any compiler you like. GCC/EMX has the disadvantage of needing to be
240 single-threaded due to a limitation of EMX's implementation of the select()
241 socket call.
242
243 In addition to needing the source code distribution as outlined earlier, you
244 will want to extract the os2seutp directory from CVS:
245
246  cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login           
247  cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co os2setup 
248                                                                                      
249
250 This will create a directory named os2setup/, which will contain the
251 Makefile.vac makefile and os2build.cmd which is used to completely create the
252 binary distribution. The sequence of events for building the executable for
253 yourself goes something like this:
254
255  cd current                                                                    
256  autoheader                                                                    
257  autoconf                                                                      
258  sh configure                                                                  
259  cd ..\os2setup                                                                
260  nmake -f Makefile.vac                                                         
261                                                                                
262
263 You will see this sequence laid out in os2build.cmd.
264
265 -------------------------------------------------------------------------------
266
267 2.5. Windows
268
269 Click-click. (I need help on this. Not a clue here. Also for configuration
270 section below. HB.)
271
272 -------------------------------------------------------------------------------
273
274 2.6. Other
275
276 Some quick notes on other Operating Systems.
277
278 For FreeBSD (and other *BSDs?), the build will require gmake instead of the
279 included make. gmake is available from http://www.gnu.org. The rest should be
280 the same as above for Linux/Unix.
281
282 -------------------------------------------------------------------------------
283
284 3. Invoking and Configuring JunkBuster
285
286 For Unix, *BSD and Linux, all configuration files are located in /etc/
287 junkbuster/ by default. For MS Windows, OS/2, and AmigaOS these are all in the
288 same directory as the Junkbuster executable. The name and number of
289 configuration files has changed from previous versions, and is subject to
290 change as development progresses.
291
292 The installed defaults provide a reasonable starting point, though possibly
293 aggressive by some standards. For the time being, there are only three default
294 configuration files (this will change in time):
295
296   * The main configuration file is named config on Linux, Unix, BSD, OS/2, and
297     AmigaOS and config.txt on Windows.
298    
299   * The ijb.action file is used to define various "actions" relating to images,
300     banners, pop-ups, access restrictions, banners and cookies. There is a CGI
301     based editor for this file that can be accessed via http://i.j.b. This is
302     the easiest method of configuring actions. (Other actions files are
303     included as well with differing levels of filtering and blocking, e.g.
304     ijb-basic.action.)
305    
306   * The re_filterfile file can be used to rewrite the raw page content,
307     including text as well as embedded HTML and JavaScript.
308    
309 ijb.action and re_filterfile can use Perl style regular expressions for maximum
310 flexibility. All files use the "#" character to denote a comment. Such lines
311 are not processed by Junkbuster. After making any changes, there is no need to
312 restart Junkbuster in order for the changes to take effect. Junkbuster should
313 detect such changes automatically.
314
315 While under development, the configuration content is subject to change. The
316 below documentation may not be accurate by the time you read this. Also, what
317 constitutes a "default" setting, may change, so please check all your
318 configuration files on important issues.
319
320 -------------------------------------------------------------------------------
321
322 3.1. Command Line Options
323
324 JunkBuster may be invoked with the following command-line options:
325
326   * --version
327    
328     Print version info and exit, Unix only.
329    
330   * --help
331    
332     Print a short usage info and exit, Unix only.
333    
334   * --no-daemon
335    
336     Don't become a daemon, i.e. don't fork and become process group leader,
337     don't detach from controlling tty. Unix only.
338    
339   * --pidfile FILE
340    
341     On startup, write the process ID to FILE. Delete the FILE on exit. Failiure
342     to create or delete the FILE is non-fatal. If no FILE option is given, no
343     PID file will be used. Unix only.
344    
345   * configfile
346    
347     If no configfile is included on the command line, JunkBuster will look for
348     a file named "config" in the current directory (except on Win32 where it
349     will look for "config.txt" instead). Specify full path to avoid confusion.
350    
351 -------------------------------------------------------------------------------
352
353 3.2. The Main Configuration File
354
355 Again, the main configuration file is named config on Linux/Unix/BSD and OS/2,
356 and config.txt on Windows. Configuration lines consist of an initial keyword
357 followed by a list of values, all separated by whitespace (any number of spaces
358 or tabs). For example:
359
360   blockfile blocklist.ini
361    
362
363 Indicates that the blockfile is named "blocklist.ini".
364
365 A "#" indicates a comment. Any part of a line following a "#" is ignored,
366 except if the "#" is preceded by a "\".
367
368 Thus, by placing a "#" at the start of an existing configuration line, you can
369 make it a comment and it will be treated as if it weren't there. This is called
370 "commenting out" an option and can be useful to turn off features: If you
371 comment out the "logfile" line, junkbuster will not log to a file at all. Watch
372 for the "default:" section in each explanation to see what happens if the
373 option is left unset (or commented out).
374
375 Long lines can be continued on the next line by using a "\" as the very last
376 character.
377
378 There are various aspects of Junkbuster behavior that can be tuned.
379
380 -------------------------------------------------------------------------------
381
382 3.2.1. Defining Other Configuration Files
383
384 Junkbuster can use a number of other files to tell it what ads to block, what
385 cookies to accept, etc. This section of the configuration file tells Junkbuster
386 where to find all those other files.
387
388 On Windows and AmigaOS, Junkbuster looks for these files in the same directory
389 as the executable. On Unix and OS/2, Junkbuster looks for these files in the
390 current working directory. In either case, an absolute path name can be used to
391 avoid problems.
392
393 When development goes modular and multi-user, the blocker, filter, and per-user
394 config will be stored in subdirectories of "confdir". For now, only confdir/
395 templates is used for storing HTML templates for CGI results.
396
397 The location of the configuration files:
398
399   confdir /etc/junkbuster       # No trailing /, please.
400    
401
402 The directory where all logging (i.e. logfile and jarfile) takes place. No
403 trailing "/", please:
404
405   logdir /var/log/junkbuster
406    
407
408 Note that all file specifications below are relative to the above two
409 directories!
410
411 The "ijb.action" file contains patterns to specify the actions to apply to
412 requests for each site. Default: Cookies to and from all destinations are kept
413 only during the current browser session (i.e. they are not saved to disk).
414 Pop-ups are disabled for all sites. All sites are filtered if "re_filterfile"
415 specified. No sites are blocked. An empty image is displayed for filtered ads
416 and other images (formerly "tinygif"). The syntax of this file is explained in
417 detail below.
418
419   actionsfile ijb.action
420    
421
422 The "re_filterfile" file contains content modification rules. These rules
423 permit powerful changes on the content of Web pages, e.g., you could disable
424 your favorite JavaScript annoyances, rewrite the actual content, or just have
425 some fun replacing "Microsoft" with "MicroSuck" wherever it appears on a Web
426 page. Default: No content modification, or whatever the developers are playing
427 with :-/
428
429   re_filterfile re_filterfile
430    
431
432 The logfile is where all logging and error messages are written. The logfile
433 can be useful for tracking down a problem with Junkbuster (e.g., it's not
434 blocking an ad you think it should block) but in most cases you probably will
435 never look at it.
436
437 Your logfile will grow indefinitely, and you will probably want to periodically
438 remove it. On Unix systems, you can do this with a cron job (see "man cron").
439 For Redhat, a logrotate script has been included.
440
441 On SuSE Linux systems, you can place a line like "/var/log/junkbuster.* +1024k
442 644 nobody.nogroup" in /etc/logfiles, with the effect that cron.daily will
443 automatically archive, gzip, and empty the log, when it exceeds 1M size.
444
445 Default: Log to the a file named logfile. Comment out to disable logging.
446
447   logfile logfile
448    
449
450 The "jarfile" defines where Junkbuster stores the cookies it intercepts. Note
451 that if you use a "jarfile", it may grow quite large. Default: Don't store
452 intercepted cookies.
453
454   #jarfile jarfile
455    
456
457 If you specify a "trustfile", Junkbuster will only allow access to sites that
458 are named in the trustfile. You can also mark sites as trusted referrers, with
459 the effect that access to untrusted sites will be granted, if a link from a
460 trusted referrer was used. The link target will then be added to the
461 "trustfile". This is a very restrictive feature that typical users most
462 probably want to leave disabled. Default: Disabled, don't use the trust
463 mechanism.
464
465   #trustfile trust
466    
467
468 If you use the trust mechanism, it is a good idea to write up some on-line
469 documentation about your blocking policy and to specify the URL(s) here. They
470 will appear on the page that your users receive when they try to access
471 untrusted content. Use multiple times for multiple URLs. Default: Don't display
472 links on the "untrusted" info page.
473
474   trust-info-url http://www.your-site.com/why_we_block.html
475   trust-info-url http://www.your-site.com/what_we_allow.html
476    
477
478 -------------------------------------------------------------------------------
479
480 3.2.2. Other Configuration Options
481
482 This part of the configuration file contains options that control how
483 Junkbuster operates.
484
485 "Admin-address" should be set to the email address of the proxy administrator.
486 It is used in many of the proxy-generated pages. Default: fill@me.in.please.
487
488   #admin-address fill@me.in.please
489    
490
491 "Proxy-info-url" can be set to a URL that contains more info about this
492 Junkbuster installation, it's configuration and policies. It is used in many of
493 the proxy-generated pages and its use is highly recommended in multi-user
494 installations, since your users will want to know why certain content is
495 blocked or modified. Default: Don't show a link to on-line documentation.
496
497   proxy-info-url http://www.your-site.com/proxy.html
498    
499
500 "Listen-address" specifies the address and port where Junkbuster will listen
501 for connections from your Web browser. The default is to listen on the
502 localhost port 8118, and this is suitable for most users. (In your web browser,
503 under proxy configuration, list the proxy server as "localhost" and the port as
504 "8118").
505
506 If you already have another service running on port 8118, or if you want to
507 serve requests from other machines (e.g. on your local network) as well, you
508 will need to override the default. The syntax is "listen-address
509 [<ip-address>]:<port>". If you leave out the IP address, junkbuster will bind
510 to all interfaces (addresses) on your machine and may become reachable from the
511 Internet. In that case, consider using access control lists (acl's) (see
512 "aclfile" above), or a firewall.
513
514 For example, suppose you are running Junkbuster on a machine which has the
515 address 192.168.0.1 on your local private network (192.168.0.0) and has another
516 outside connection with a different address. You want it to serve requests from
517 inside only:
518
519   listen-address 192.168.0.1:8118
520    
521
522 If you want it to listen on all addresses (including the outside connection):
523
524   listen-address :8118
525    
526
527 If you do this, consider using ACLs (see "aclfile" above). Note: you will need
528 to point your browser(s) to the address and port that you have configured here.
529 Default: localhost:8118 (127.0.0.1:8118).
530
531 The debug option sets the level of debugging information to log in the logfile
532 (and to the console in the Windows version). A debug level of 1 is informative
533 because it will show you each request as it happens. Higher levels of debug are
534 probably only of interest to developers.
535
536   debug         1 # GPC   = show each GET/POST/CONNECT request
537   debug         2 # CONN  = show each connection status
538   debug         4 # IO    = show I/O status
539   debug         8 # HDR   = show header parsing
540   debug        16 # LOG   = log all data into the logfile
541   debug        32 # FRC   = debug force feature
542   debug        64 # REF   = debug regular expression filter 
543   debug       128 #       = debug fast redirects
544   debug       256 #       = debug GIF de-animation
545   debug       512 # CLF   = Common Log Format
546   debug      1024 #       = debug kill pop-ups
547   debug      4096 # INFO  = Startup banner and warnings.
548   debug      8192 # ERROR = Non-fatal errors
549     
550
551 It is highly recommended that you enable ERROR reporting (debug 8192), at least
552 until the next stable release.
553
554 The reporting of FATAL errors (i.e. ones which crash JunkBuster) is always on
555 and cannot be disabled.
556
557 If you want to use CLF (Common Log Format), you should set "debug 512" ONLY, do
558 not enable anything else.
559
560 Multiple "debug" directives, are OK - they're logical-OR'd together.
561
562   debug 15 # same as setting the first 4 listed above
563    
564
565 Default:
566
567   debug 1 # URLs
568   debug 4096 # Info
569   debug 8192 # Errors - *we highly recommended enabling this*
570    
571
572 Junkbuster normally uses "multi-threading", a software technique that permits
573 it to handle many different requests simultaneously. In some cases you may wish
574 to disable this -- particularly if you're trying to debug a problem. The
575 "single-threaded" option forces Junkbuster to handle requests sequentially.
576 Default: Multi-threaded mode.
577
578   #single-threaded
579    
580
581 "toggle" allows you to temporarily disable all Junkbuster's filtering. Just set
582 "toggle 0".
583
584 The Windows version of Junkbuster puts an icon in the system tray, which also
585 allows you to change this option. If you right-click on that icon (or select
586 the "Options" menu), one choice is "Enable". Clicking on enable toggles
587 Junkbuster on and off. This is useful if you want to temporarily disable
588 Junkbuster, e.g., to access a site that requires cookies which you would
589 otherwise have blocked. This can also be toggled via a web browser at the
590 Junkbuster internal address of http://i.j.b on any platform.
591
592 "toggle 1" means Junkbuster runs normally, "toggle 0" means that Junkbuster
593 becomes a non-anonymizing non-blocking proxy. Default: 1 (on).
594
595   toggle 1
596    
597
598 For content filtering, i.e. the "+filter" and "+deanimate-gif" actions, it is
599 necessary that Junkbuster buffers the entire document body. This can be
600 potentially dangerous, since a server could just keep sending data indefinitely
601 and wait for your RAM to exhaust. With nasty consequences.
602
603 The buffer-limit option lets you set the maximum size in Kbytes that each
604 buffer may use. When the documents buffer exceeds this size, it is flushed to
605 the client unfiltered and no further attempt to filter the rest of it is made.
606 Remember that there may multiple threads running, which might require
607 increasing the "buffer-limit" Kbytes each, unless you have enabled
608 "single-threaded" above.
609
610   buffer-limit 4069
611    
612
613 To enable the web-based ijb.action file editor set enable-edit-actions to 1, or
614 0 to disable. Note that you must have compiled JunkBuster with support for this
615 feature, otherwise this option has no effect. This internal page can be reached
616 at http://i.j.b.
617
618 Security note: If this is enabled, anyone who can use the proxy can edit the
619 actions file, and their changes will affect all users. For shared proxies, you
620 probably want to disable this. Default: enabled.
621
622   enable-edit-actions 1
623    
624
625 Allow JunkBuster to be toggled on and off remotely, using your web browser. Set
626 "enable-remote-toggle"to 1 to enable, and 0 to disable. Note that you must have
627 compiled JunkBuster with support for this feature, otherwise this option has no
628 effect.
629
630 Security note: If this is enabled, anyone who can use the proxy can toggle it
631 on or off (see http://i.j.b), and their changes will affect all users. For
632 shared proxies, you probably want to disable this. Default: enabled.
633
634   enable-remote-toggle 1
635    
636
637 -------------------------------------------------------------------------------
638
639 3.2.3. Access Control List (ACL)
640
641 Access controls are included at the request of some ISPs and systems
642 administrators, and are not usually needed by individual users. Please note the
643 warnings in the FAQ that this proxy is not intended to be a substitute for a
644 firewall or to encourage anyone to defer addressing basic security weaknesses.
645
646 If no access settings are specified, the proxy talks to anyone that connects.
647 If any access settings file are specified, then the proxy talks only to IP
648 addresses permitted somewhere in this file and not denied later in this file.
649
650 Summary -- if using an ACL:
651
652 Client must have permission to receive service.
653
654 LAST match in ACL wins.
655
656 Default behavior is to deny service.
657
658 The syntax for an entry in the Access Control List is:
659
660   ACTION    SRC_ADDR[/SRC_MASKLEN]    [ DST_ADDR[/DST_MASKLEN] ]
661    
662
663 Where the individual fields are:
664
665  ACTION      = "permit-access" or "deny-access"
666
667  SRC_ADDR    = client hostname or dotted IP address
668  SRC_MASKLEN = number of bits in the subnet mask for the source
669
670  DST_ADDR    = server or forwarder hostname or dotted IP address
671  DST_MASKLEN = number of bits in the subnet mask for the target
672    
673
674 The field separator (FS) is whitespace (space or tab).
675
676 IMPORTANT NOTE: If the junkbuster is using a forwarder (see below) or a gateway
677 for a particular destination URL, the DST_ADDR that is examined is the address
678 of the forwarder or the gateway and NOT the address of the ultimate target.
679 This is necessary because it may be impossible for the local Junkbuster to
680 determine the address of the ultimate target (that's often what gateways are
681 used for).
682
683 Here are a few examples to show how the ACL features work:
684
685 "localhost" is OK -- no DST_ADDR implies that ALL destination addresses are OK:
686
687   permit-access localhost
688    
689
690 A silly example to illustrate permitting any host on the class-C subnet with
691 Junkbuster to go anywhere:
692
693   permit-access www.junkbusters.com/24
694    
695
696 Except deny one particular IP address from using it at all:
697
698   deny-access ident.junkbusters.com
699    
700
701 You can also specify an explicit network address and subnet mask. Explicit
702 addresses do not have to be resolved to be used.
703
704   permit-access 207.153.200.0/24
705    
706
707 A subnet mask of 0 matches anything, so the next line permits everyone.
708
709   permit-access 0.0.0.0/0
710    
711
712 Note, you cannot say:
713
714   permit-access .org
715    
716
717 to allow all *.org domains. Every IP address listed must resolve fully.
718
719 An ISP may want to provide a Junkbuster that is accessible by "the world" and
720 yet restrict use of some of their private content to hosts on its internal
721 network (i.e. its own subscribers). Say, for instance the ISP owns the Class-B
722 IP address block 123.124.0.0 (a 16 bit netmask). This is how they could do it:
723
724  permit-access 0.0.0.0/0 0.0.0.0/0   # other clients can go anywhere 
725                                        # with the following exceptions:
726  
727  deny-access   0.0.0.0/0   123.124.0.0/16 # block all external requests for
728                                           # sites on the ISP's network
729
730  permit 0.0.0.0/0 www.my_isp.com        # except for the ISP's main 
731                                           # web site
732
733  permit 123.124.0.0/16 0.0.0.0/0          # the ISP's clients can go 
734                                           # anywhere
735    
736
737 Note that if some hostnames are listed with multiple IP addresses, the primary
738 value returned by DNS (via gethostbyname()) is used. Default: Anyone can access
739 the proxy.
740
741 -------------------------------------------------------------------------------
742
743 3.2.4. Forwarding
744
745 This feature allows chaining of HTTP requests via multiple proxies. It can be
746 used to better protect privacy and confidentiality when accessing specific
747 domains by routing requests to those domains to a special purpose filtering
748 proxy such as lpwa.com. Or to use a caching proxy to speed up browsing.
749
750 It can also be used in an environment with multiple networks to route requests
751 via multiple gateways allowing transparent access to multiple networks without
752 having to modify browser configurations.
753
754 Also specified here are SOCKS proxies. Junkbuster SOCKS 4 and SOCKS 4A. The
755 difference is that SOCKS 4A will resolve the target hostname using DNS on the
756 SOCKS server, not our local DNS client.
757
758 The syntax of each line is:
759
760  forward target_domain[:port] http_proxy_host[:port]
761  forward-socks4 target_domain[:port] socks_proxy_host[:port] http_proxy_host[:
762 port]
763  forward-socks4a target_domain[:port] socks_proxy_host[:port] http_proxy_host[:
764 port]
765    
766
767 If http_proxy_host is ".", then requests are not forwarded to a HTTP proxy but
768 are made directly to the web servers.
769
770 Lines are checked in sequence, and the last match wins.
771
772 There is an implicit line equivalent to the following, which specifies that
773 anything not finding a match on the list is to go out without forwarding or
774 gateway protocol, like so:
775
776   forward .* . # implicit
777    
778
779 In the following common configuration, everything goes to Lucent's LPWA, except
780 SSL on port 443 (which it doesn't handle):
781
782  forward .* lpwa.com:8000
783  forward :443 .
784    
785
786 See the FAQ for instructions on how to automate the login procedure for LPWA.
787 Some users have reported difficulties related to LPWA's use of "." as the last
788 element of the domain, and have said that this can be fixed with this:
789
790   forward lpwa. lpwa.com:8000
791    
792
793 (NOTE: the syntax for specifying target_domain has changed since the previous
794 paragraph was written -- it will not work now. More information is welcome.)
795
796 In this fictitious example, everything goes via an ISP's caching proxy, except
797 requests to that ISP:
798
799  forward .* caching.myisp.net:8000
800  forward myisp.net .
801    
802
803 For the @home network, we're told the forwarding configuration is this:
804
805   forward .* proxy:8080
806    
807
808 Also, we're told they insist on getting cookies and JavaScript, so you should
809 add home.com to the cookie file. We consider JavaScript a security risk. Java
810 need not be enabled.
811
812 In this example direct connections are made to all "internal" domains, but
813 everything else goes through Lucent's LPWA by way of the company's SOCKS
814 gateway to the Internet.
815
816  forward-socks4 .* lpwa.com:8000 firewall.my_company.com:1080
817  forward my_company.com .
818    
819
820 This is how you could set up a site that always uses SOCKS but no forwarders:
821
822   forward-socks4a .* . firewall.my_company.com:1080
823    
824
825 An advanced example for network administrators:
826
827 If you have links to multiple ISPs that provide various special content to
828 their subscribers, you can configure forwarding to pass requests to the
829 specific host that's connected to that ISP so that everybody can see all of the
830 content on all of the ISPs.
831
832 This is a bit tricky, but here's an example:
833
834 host-a has a PPP connection to isp-a.com. And host-b has a PPP connection to
835 isp-b.com. host-a can run a Junkbuster proxy with forwarding like this:
836
837  forward .* .
838  forward isp-b.com host-b:8118
839    
840
841 host-b can run a Junkbuster proxy with forwarding like this:
842
843  forward .* .
844  forward isp-a.com host-a:8118
845    
846
847 Now, anyone on the Internet (including users on host-a and host-b) can set
848 their browser's proxy to either host-a or host-b and be able to browse the
849 content on isp-a or isp-b.
850
851 Here's another practical example, for University of Kent at Canterbury students
852 with a network connection in their room, who need to use the University's Squid
853 web cache.
854
855  forward *. ssbcache.ukc.ac.uk:3128  # Use the proxy, except for:
856  forward .ukc.ac.uk .  # Anything on the same domain as us
857  forward * .  # Host with no domain specified
858  forward 129.12.*.* .  # A dotted IP on our /16 network.
859  forward 127.*.*.* .  # Loopback address
860  forward localhost.localdomain .  # Loopback address
861  forward www.ukc.mirror.ac.uk .  # Specific host
862    
863
864 If you intend to chain Junkbuster and squid locally, then chain as browser ->
865 squid -> junkbuster is the recommended way.
866
867 Your squid configuration could then look like this:
868
869   # Define junkbuster as parent cache 
870   
871   cache_peer 127.0.0.1 parent 8118 0 no-query
872   
873   # Define ACL for protocol FTP 
874   acl FTP proto FTP 
875
876   # Do not forward ACL FTP to junkbuster 
877   always_direct allow FTP 
878
879   # Do not forward ACL CONNECT (https) to junkbuster 
880   always_direct allow CONNECT 
881
882   # Forward the rest to junkbuster 
883   never_direct allow all 
884    
885
886 -------------------------------------------------------------------------------
887
888 3.2.5. Windows GUI Options
889
890 Junkbuster has a number of options specific to the Windows GUI interface:
891
892 If "activity-animation" is set to 1, the Junkbuster icon will animate when
893 "Junkbuster" is active. To turn off, set to 0.
894
895   activity-animation 1
896    
897
898 If "log-messages" is set to 1, Junkbuster will log messages to the console
899 window:
900
901   log-messages 1
902    
903
904 If "log-buffer-size" is set to 1, the size of the log buffer, i.e. the amount
905 of memory used for the log messages displayed in the console window, will be
906 limited to "log-max-lines" (see below).
907
908 Warning: Setting this to 0 will result in the buffer to grow infinitely and eat
909 up all your memory!
910
911   log-buffer-size 1
912    
913
914 log-max-lines is the maximum number of lines held in the log buffer. See above.
915
916   log-max-lines 200
917    
918
919 If "log-highlight-messages" is set to 1, Junkbuster will highlight portions of
920 the log messages with a bold-faced font:
921
922   log-highlight-messages 1
923    
924
925 The font used in the console window:
926
927   log-font-name Comic Sans MS
928    
929
930 Font size used in the console window:
931
932   log-font-size 8
933    
934
935 "show-on-task-bar" controls whether or not Junkbuster will appear as a button
936 on the Task bar when minimized:
937
938   show-on-task-bar 0
939    
940
941 If "close-button-minimizes" is set to 1, the Windows close button will minimize
942 Junkbuster instead of closing the program (close with the exit option on the
943 File menu).
944
945   close-button-minimizes 1
946    
947
948 The "hide-console" option is specific to the MS-Win console version of
949 JunkBuster. If this option is used, Junkbuster will disconnect from and hide
950 the command console.
951
952   #hide-console
953    
954
955 -------------------------------------------------------------------------------
956
957 3.3. The Actions File
958
959 The "ijb.action" file (formerly actionsfile) is used to define what actions
960 Junkbuster takes, and thus determines how images, cookies and various other
961 aspects of HTTP content and transactions are handled. Images can be anything
962 you want, including ads, banners, or just some obnoxious image that you would
963 rather not see. Cookies can be accepted or rejected, or accepted only during
964 the current browser session (i.e. not written to disk). Changes to ijb.action
965 should be immediately visible to Junkbuster without the need to restart.
966
967 To determine which actions apply to a request, the URL of the request is
968 compared to all patterns in this file. Every time it matches, the list of
969 applicable actions for the URL is incrementally updated. You can trace this
970 process by visiting http://i.j.b/show-url-info.
971
972 The actions file can be edited with a browser by loading http://i.j.b/, and
973 then select "Edit Actions".
974
975 There are four types of lines in this file: comments (begin with a "#"
976 character), actions, aliases and patterns, all of which are explained below, as
977 well as the configuration file syntax that Junkbuster understands. 
978
979 -------------------------------------------------------------------------------
980
981 3.3.1. URL Domain and Path Syntax
982
983 Generally, a pattern has the form <domain>/<path>, where both the <domain> and
984 <path> part are optional. If you only specify a domain part, the "/" can be
985 left out:
986
987 www.example.com - is a domain only pattern and will match any request to
988 "www.example.com".
989
990 www.example.com/ - means exactly the same.
991
992 www.example.com/index.html - matches only the single document "/index.html" on
993 "www.example.com".
994
995 /index.html - matches the document "/index.html", regardless of the domain.
996
997 index.html - matches nothing, since it would be interpreted as a domain name
998 and there is no top-level domain called ".html".
999
1000 The matching of the domain part offers some flexible options: if the domain
1001 starts or ends with a dot, it becomes unanchored at that end. For example:
1002
1003 .example.com - matches any domain that ENDS in ".example.com".
1004
1005 www. - matches any domain that STARTS with "www".
1006
1007 Additionally, there are wild-cards that you can use in the domain names
1008 themselves. They work pretty similar to shell wild-cards: "*" stands for zero
1009 or more arbitrary characters, "?" stands for any single character. And you can
1010 define character classes in square brackets and they can be freely mixed:
1011
1012 ad*.example.com - matches "adserver.example.com", "ads.example.com", etc but
1013 not "sfads.example.com".
1014
1015 *ad*.example.com - matches all of the above, and then some.
1016
1017 .?pix.com - matches "www.ipix.com", "pictures.epix.com", "a.b.c.d.e.upix.com",
1018 etc.
1019
1020 www[1-9a-ez].example.com - matches "www1.example.com", "www4.example.com",
1021 "wwwd.example.com", "wwwz.example.com", etc., but not "wwww.example.com".
1022
1023 If Junkbuster was compiled with "pcre" support (default), Perl compatible
1024 regular expressions can be used. See the pcre/docs/ directory or "man perlre"
1025 (also available on http://www.perldoc.com/perl5.6/pod/perlre.html) for details.
1026 A brief discussion of regular expressions is in the Appendix. For instance:
1027
1028 /.*/advert[0-9]+\.jpe?g - would match a URL from any domain, with any path that
1029 includes "advert" followed immediately by one or more digits, then a "." and
1030 ending in either "jpeg" or "jpg". So we match "example.com/ads/advert2.jpg",
1031 and "www.example.com/ads/banners/advert39.jpeg", but not "www.example.com/ads/
1032 banners/advert39.gif" (no gifs in the example pattern).
1033
1034 Please note that matching in the path is case INSENSITIVE by default, but you
1035 can switch to case sensitive at any point in the pattern by using the "(?-i)"
1036 switch:
1037
1038 www.example.com/(?-i)PaTtErN.* - will match only documents whose path starts
1039 with "PaTtErN" in exactly this capitalization.
1040
1041 -------------------------------------------------------------------------------
1042
1043 3.3.2. Actions
1044
1045 Actions are enabled if preceded with a "+", and disabled if preceded with a
1046 "-". Actions are invoked by enclosing the action name in curly braces (e.g.
1047 {+some_action}), followed by a list of URLs to which the action applies. There
1048 are three classes of actions:
1049
1050   * Boolean (e.g. "+/-block"):
1051    
1052       {+name}        # enable this action
1053       {-name}        # disable this action
1054          
1055    
1056   * parameterized (e.g. "+/-hide-user-agent"):
1057    
1058       {+name{param}}  # enable action and set parameter to "param"
1059       {-name}         # disable action
1060          
1061    
1062   * Multi-value (e.g. "{+/-add-header{Name: value}}", "{+/-wafer{name=value}}
1063     "):
1064    
1065       {+name{param}}   # enable action and add parameter "param"
1066       {-name{param}}   # remove the parameter "param"
1067       {-name}          # disable this action totally
1068          
1069    
1070 If nothing is specified in this file, no "actions" are taken. So in this case
1071 JunkBuster would just be a normal, non-blocking, non-anonymizing proxy. You
1072 must specifically enable the privacy and blocking features you need (although
1073 the provided default ijb.action file will give a good starting point).
1074
1075 Later defined actions always over-ride earlier ones. For multi-valued actions,
1076 the actions are applied in the order they are specified.
1077
1078 The list of valid Junkbuster "actions" are:
1079
1080   * Add the specified HTTP header, which is not checked for validity. You may
1081     specify this many times to specify many different headers:
1082    
1083       +add-header{Name: value}
1084          
1085    
1086   * Block this URL totally.
1087    
1088       +block
1089          
1090    
1091   * De-animate all animated GIF images, i.e. reduce them to their last frame.
1092     This will also shrink the images considerably (in bytes, not pixels!). If
1093     the option "first" is given, the first frame of the animation is used as
1094     the replacement. If "last" is given, the last frame of the animation is
1095     used instead, which probably makes more sense for most banner animations,
1096     but also has the risk of not showing the entire last frame (if it is only a
1097     delta to an earlier frame).
1098    
1099       +deanimate-gifs{last}
1100       +deanimate-gifs{first}
1101          
1102    
1103   * "+downgrade" will downgrade HTTP/1.1 client requests to HTTP/1.0 and
1104     downgrade the responses as well. Use this action for servers that use HTTP/
1105     1.1 protocol features that Junkbuster doesn't handle well yet. HTTP/1.1 is
1106     only partially implemented. Default is not to downgrade requests.
1107    
1108       +downgrade
1109          
1110    
1111   * Many sites, like yahoo.com, don't just link to other sites. Instead, they
1112     will link to some script on their own server, giving the destination as a
1113     parameter, which will then redirect you to the final target. URLs resulting
1114     from this scheme typically look like: http://some.place/some_script?http://
1115     some.where-else.
1116    
1117     Sometimes, there are even multiple consecutive redirects encoded in the
1118     URL. These redirections via scripts make your web browsing more traceable,
1119     since the server from which you follow such a link can see where you go to.
1120     Apart from that, valuable bandwidth and time is wasted, while your browser
1121     ask the server for one redirect after the other. Plus, it feeds the
1122     advertisers.
1123    
1124     The "+fast-redirects" option enables interception of these requests by
1125     Junkbuster, who will cut off all but the last valid URL in the request and
1126     send a local redirect back to your browser without contacting the remote
1127     site.
1128    
1129       +fast-redirects
1130          
1131    
1132   * Filter the website through the re_filterfile:
1133    
1134      +filter{filename}
1135          
1136    
1137   * Block any existing X-Forwarded-for header, and do not add a new one:
1138    
1139       +hide-forwarded
1140          
1141    
1142   * If the browser sends a "From:" header containing your e-mail address, this
1143     either completely removes the header ("block"), or changes it to the
1144     specified e-mail address.
1145    
1146       +hide-from{block}
1147       +hide-from{spam@sittingduck.xqq}
1148          
1149    
1150   * Don't send the "Referer:" (sic) header to the web site. You can block it,
1151     forge a URL to the same server as the request (which is preferred because
1152     some sites will not send images otherwise) or set it to a constant string
1153     of your choice.
1154    
1155       +hide-referer{block}
1156       +hide-referer{forge}
1157       +hide-referer{http://nowhere.com}
1158          
1159    
1160   * Alternative spelling of "+hide-referer". It has the same parameters, and
1161     can be freely mixed with, "+hide-referer". ("referrer" is the correct
1162     English spelling, however the HTTP specification has a bug - it requires it
1163     to be spelled "referer".)
1164    
1165       +hide-referrer{...}
1166          
1167    
1168   * Change the "User-Agent:" header so web servers can't tell your browser
1169     type. Warning! This breaks many web sites. Specify the user-agent value you
1170     want. Example, pretend to be using Netscape on Linux:
1171    
1172       +hide-user-agent{Mozilla (X11; I; Linux 2.0.32 i586)}
1173          
1174    
1175   * Treat this URL as an image. This only matters if it's also "+block"ed, in
1176     which case a "blocked" image can be sent rather than a HTML page. See
1177     "+image-blocker{}" below for the control over what is actually sent.
1178    
1179       +image
1180          
1181    
1182   * Decides what to do with URLs that end up tagged with "{+block +image}".
1183     There are 4 options. "-image-blocker" will send a HTML "blocked" page,
1184     usually resulting in a "broken image" icon. "+image-blocker{logo}" will
1185     send a "JunkBuster" image. "+image-blocker{blank}" will send a 1x1
1186     transparent GIF image. And finally, "+image-blocker{http://xyz.com}" will
1187     send a HTTP temporary redirect to the specified image. This has the
1188     advantage of the icon being being cached by the browser, which will speed
1189     up the display.
1190    
1191       +image-blocker{logo}
1192       +image-blocker{blank}
1193       +image-blocker{http://i.j.b/send-banner}
1194          
1195    
1196   * By default (i.e. in the absence of a "+limit-connect" action), Junkbuster
1197     will only allow CONNECT requests to port 443, which is the standard port
1198     for https as a precaution.
1199    
1200     The CONNECT methods exists in HTTP to allow access to secure websites
1201     (https:// URLs) through proxies. It works very simply: the proxy connects
1202     to the server on the specified port, and then short-circuits its
1203     connections to the client and to the remote proxy. This can be a big
1204     security hole, since CONNECT-enabled proxies can be abused as TCP relays
1205     very easily.
1206    
1207     If you want to allow CONNECT for more ports than this, or want to forbid
1208     CONNECT altogether, you can specify a comma separated list of ports and
1209     port ranges (the latter using dashes, with the minimum defaulting to 0 and
1210     max to 65K):
1211    
1212       +limit-connect{443} # This is the default and need no be specified.
1213       +limit-connect{80,443} # Ports 80 and 443 are OK.
1214       +limit-connect{-3, 7, 20-100, 500-} # Port less than 3, 7, 20 to 100
1215        #and above 500 are OK.
1216          
1217    
1218   * "+no-compression" prevents the website from compressing the data. Some
1219     websites do this, which can be a problem for Junkbuster, since "+filter",
1220     "+no-popup" and "+gif-deanimate" will not work on compressed data. This
1221     will slow down connections to those websites, though. Default is
1222     "nocompression" is turned on.
1223    
1224       +nocompression
1225          
1226    
1227   * If the website sets cookies, "no-cookies-keep" will make sure they are
1228     erased when you exit and restart your web browser. This makes profiling
1229     cookies useless, but won't break sites which require cookies so that you
1230     can log in for transactions. Default: on.
1231    
1232       +no-cookies-keep
1233          
1234    
1235   * Prevent the website from reading cookies:
1236    
1237       +no-cookies-read
1238          
1239    
1240   * Prevent the website from setting cookies:
1241    
1242       +no-cookies-set
1243          
1244    
1245   * Filter the website through a built-in filter to disable those obnoxious
1246     JavaScript pop-up windows via window.open(), etc. The two alternative
1247     spellings are equivalent.
1248    
1249       +no-popup
1250       +no-popups
1251          
1252    
1253   * This action only applies if you are using a jarfile for saving cookies. It
1254     sends a cookie to every site stating that you do not accept any copyright
1255     on cookies sent to you, and asking them not to track you. Of course, this
1256     is a (relatively) unique header they could use to track you.
1257    
1258       +vanilla-wafer
1259          
1260    
1261   * This allows you to add an arbitrary cookie. It can be specified multiple
1262     times in order to add as many cookies as you like.
1263    
1264       +wafer{name=value}
1265          
1266    
1267 The meaning of any of the above is reversed by preceding the action with a "-",
1268 in place of the "+".
1269
1270 Some examples:
1271
1272 Turn off cookies by default, then allow a few through for specified sites:
1273
1274  # Turn off all persistent cookies
1275  { +no-cookies-read }
1276  { +no-cookies-set }
1277  # Allow cookies for this browser session ONLY
1278  { +no-cookies-keep }
1279
1280  # Exceptions to the above, sites that benefit from persistent cookies
1281  { -no-cookies-read }
1282  { -no-cookies-set }
1283  { -no-cookies-keep }
1284  .javasoft.com
1285  .sun.com
1286  .yahoo.com
1287  .msdn.microsoft.com
1288  .redhat.com
1289
1290  # Alternative way of saying the same thing
1291  {-no-cookies-set -no-cookies-read -no-cookies-keep}
1292  .sourceforge.net
1293  .sf.net
1294    
1295
1296 Now turn off "fast redirects", and then we allow two exceptions:
1297
1298  # Turn them off!
1299  {+fast-redirects}
1300  
1301  # Reverse it for these two sites, which don't work right without it.
1302  {-fast-redirects}
1303  www.ukc.ac.uk/cgi-bin/wac\.cgi\?
1304  login.yahoo.com
1305    
1306
1307 Turn on page filtering, with one exception for sourceforge:
1308
1309  # Run everything through the default filter file (re_filterfile):
1310  {+filter}
1311  
1312  # But please don't re_filter code from sourceforge!
1313  {-filter}
1314  .cvs.sourceforge.net
1315    
1316
1317 Now some URLs that we want "blocked", ie we won't see them. Many of these use
1318 regular expressions that will expand to match multiple URLs:
1319
1320   # Blocklist:
1321   {+block}
1322   /.*/(.*[-_.])?ads?[0-9]?(/|[-_.].*|\.(gif|jpe?g))
1323   /.*/(.*[-_.])?count(er)?(\.cgi|\.dll|\.exe|[?/])
1324   /.*/(ng)?adclient\.cgi
1325   /.*/(plain|live|rotate)[-_.]?ads?/
1326   /.*/(sponsor)s?[0-9]?/
1327   /.*/_?(plain|live)?ads?(-banners)?/
1328   /.*/abanners/
1329   /.*/ad(sdna_image|gifs?)/
1330   /.*/ad(server|stream|juggler)\.(cgi|pl|dll|exe)
1331   /.*/adbanners/
1332   /.*/adserver
1333   /.*/adstream\.cgi
1334   /.*/adv((er)?ts?|ertis(ing|ements?))?/
1335   /.*/banner_?ads/
1336   /.*/banners?/
1337   /.*/banners?\.cgi/
1338   /.*/cgi-bin/centralad/getimage
1339   /.*/images/addver\.gif
1340   /.*/images/marketing/.*\.(gif|jpe?g)
1341   /.*/popupads/
1342   /.*/siteads/
1343   /.*/sponsor.*\.gif
1344   /.*/sponsors?[0-9]?/
1345   /.*/advert[0-9]+\.jpg
1346   /Media/Images/Adds/
1347   /ad_images/
1348   /adimages/
1349   /.*/ads/
1350   /bannerfarm/
1351   /grafikk/annonse/
1352   /graphics/defaultAd/
1353   /image\.ng/AdType
1354   /image\.ng/transactionID
1355   /images/.*/.*_anim\.gif # alvin brattli
1356   /ip_img/.*\.(gif|jpe?g)
1357   /rotateads/
1358   /rotations/ 
1359   /worldnet/ad\.cgi
1360   /cgi-bin/nph-adclick.exe/
1361   /.*/Image/BannerAdvertising/
1362   /.*/ad-bin/
1363   /.*/adlib/server\.cgi
1364   /autoads/
1365    
1366
1367 -------------------------------------------------------------------------------
1368
1369 3.3.3. Aliases
1370
1371 Custom "actions", known to Junkbuster as "aliases", can be defined by combining
1372 other "actions". These can in turn be invoked just like the built-in "actions".
1373 Currently, an alias can contain any character except space, tab, "=", "{" or "}
1374 ". But please use only "a"- "z", "0"-"9", "+", and "-". Alias names are not
1375 case sensitive, and must be defined before anything else in the ijb.actionfile
1376 ! And there can only be one set of "aliases" defined.
1377
1378 Now let's define a few aliases:
1379
1380  # Useful customer aliases we can use later. These must come first!
1381  {{alias}}
1382  +no-cookies = +no-cookies-set +no-cookies-read
1383  -no-cookies = -no-cookies-set -no-cookies-read
1384  fragile     =
1385  -block -no-cookies -filter -fast-redirects -hide-referer -no-popups
1386  shop        = -no-cookies -filter -fast-redirects
1387  +imageblock = +block +image
1388
1389  #For people who don't like to type too much:  ;-)
1390  c0 = +no-cookies
1391  c1 = -no-cookies
1392  c2 = -no-cookies-set +no-cookies-read
1393  c3 = +no-cookies-set -no-cookies-read
1394  #... etc.  Customize to your heart's content.
1395    
1396
1397 Some examples using our "shop" and "fragile" aliases from above:
1398
1399  # These sites are very complex and require
1400  # minimal interference.
1401  {fragile}
1402  .office.microsoft.com
1403  .windowsupdate.microsoft.com
1404  .nytimes.com
1405
1406  # Shopping sites - still want to block ads.
1407  {shop}
1408  .quietpc.com
1409  .worldpay.com   # for quietpc.com
1410  .jungle.com
1411  .scan.co.uk
1412
1413  # These shops require pop-ups
1414  {shop -no-popups}
1415  .dabs.com
1416  .overclockers.co.uk
1417    
1418
1419 -------------------------------------------------------------------------------
1420
1421 3.4. The Filter File
1422
1423 The filter file defines what filtering of web pages Junkbuster does. The
1424 default filter file is re_filterfile, located in the config directory. In this
1425 file, any document content, whether viewable text or embedded non-visible
1426 content, can be changed.
1427
1428 This file uses regular expressions to alter or remove any string in the target
1429 page. Some examples from the included default re_filterfile:
1430
1431 Stop web pages from displaying annoying messages in the status bar by deleting
1432 such references:
1433
1434  # The status bar is for displaying link targets, not pointless buzzwords.
1435  # Again, check it out on http://www.airport-cgn.de/.
1436  s/status='.*?';*//ig
1437    
1438
1439 Just for kicks, replace any occurrence of "Microsoft" with "MicroSuck":
1440
1441  s/microsoft(?!.com)/MicroSuck/ig
1442    
1443
1444 Kill those auto-refresh tags:
1445
1446  # Kill refresh tags. I like to refresh myself. Manually.
1447  # check it out on http://www.airport-cgn.de/ and go to the arrivals page.
1448  #
1449  s/<meta[^>]*http-equiv[^>]*refresh.*URL=([^>]*?)"?>/<link rev="x-refresh" href
1450 =$1>/i
1451  s/<meta[^>]*http-equiv="?page-enter"?[^>]*content=[^>]*>/<!
1452 --no page enter for me-->/i
1453    
1454
1455 -------------------------------------------------------------------------------
1456
1457 3.5. Templates
1458
1459 When Junkbuster displays one of its internal pages, such as a 404 Not Found
1460 error page, it uses the appropriate template. On Linux, BSD, and Unix, these
1461 are locate in /etc/junkbuster/templates by default. These may be customized, if
1462 desired. 
1463
1464 -------------------------------------------------------------------------------
1465
1466 4. Quickstart to Using Junkbuster
1467
1468 Install package, then run and enjoy! JunkBuster accepts only one command line
1469 option -- the configuration file to be used. Example Unix startup command:
1470
1471                                                                                
1472  # /usr/sbin/junkbuster /etc/junkbuster/config                                 
1473                                                                                
1474                                                                                
1475
1476 An init script is provided for SuSE and Redhat.
1477
1478 For for SuSE: /etc/rc.d/junkbuster start
1479
1480 For RedHat: /etc/rc.d/init.d/junkbuster start
1481
1482 If no configuration file is specified on the command line, Junkbuster will look
1483 for a file named config in the current directory. Except on Win32 where it will
1484 try config.txt. If no file is specified on the command line and no default
1485 configuration file can be found, Junkbuster will fail to start.
1486
1487 Be sure your browser is set to use the proxy which is by default at localhost,
1488 port 8118. With Netscape (and Mozilla), this can be set under Edit ->
1489 Preferences -> Advanced -> Proxies -> HTTP Proxy. For Internet Explorer: Tools
1490 > Internet Properties -> Connections -> LAN Setting. Then, check "Use Proxy"
1491 and fill in the appropriate info (Address: localhost, Port: 8118). Include if
1492 HTTPS proxy support too.
1493
1494 The included default configuration files should give a reasonable starting
1495 point, though may be somewhat aggressive in blocking junk. You will probably
1496 want to keep an eye out for sites that require persistent cookies, and add
1497 these to ijb.action as needed. By default, most of these will be accepted only
1498 during the current browser session, until you add them to the configuration. If
1499 you want the browser to handle this instead, you will need to edit ijb.action
1500 and disable this feature. If you use more than one browser, it would make more
1501 sense to let Junkbuster handle this. In which case, the browser(s) should be
1502 set to accept all cookies.
1503
1504 If a particular site shows problems loading properly, try adding it to the
1505 {fragile} section of ijb.action. This will turn off most actions for this site.
1506
1507 Junkbuster is HTTP/1.1 compliant, but not all 1.1 features are as yet
1508 implemented. If browsers that support HTTP/1.1 (like Mozilla or recent versions
1509 of I.E.) experience problems, you might try to force HTTP/1.0 compatibility.
1510 For Mozilla, look under Edit -> Preferences -> Debug -> Networking. Or set the
1511 "+downgrade" config option in ijb.action.
1512
1513 After running Junkbuster for a while, you can start to fine tune the
1514 configuration to suit your personal, or site, preferences and requirements.
1515 There are many, many aspects that can be customized. "Actions" (as specified in
1516 ijb.action) can be adjusted by pointing your browser to http://i.j.b/, and then
1517 follow the link to "edit the actions list". (This is an internal page and does
1518 not require Internet access.)
1519
1520 In fact, various aspects of Junkbuster configuration can be viewed from this
1521 page, including current configuration parameters, source code version numbers,
1522 the browser's request headers, and "actions" that apply to a given URL. In
1523 addition to the ijb.action file editor mentioned above, Junkbuster can also be
1524 turned "on" and "off" from this page.
1525
1526 If you encounter problems, please verify it is a Junkbuster bug, by disabling
1527 Junkbuster, and then trying the same page. Also, try another browser if
1528 possible to eliminate browser or site problems. Before reporting it as a bug,
1529 see if there is not a configuration option that is enabled that is causing the
1530 page not to load. You can then add an exception for that page or site. If a
1531 bug, please report it to the developers (see below).
1532
1533 -------------------------------------------------------------------------------
1534
1535 5. Contacting the Developers, Bug Reporting and Feature Requests
1536
1537 Please do not use the mailing lists for feature requests or bug reports. They
1538 are not as easily tracked this way! 
1539
1540 Feature requests and other questions should be posted to the Feature request
1541 page at SourceForge. There is also an archive there.
1542
1543 Anyone interested in actively participating in development and related
1544 discussions can join the appropriate mailing list here. Archives are available
1545 here too.
1546
1547 Please report bugs, using the form at Sourceforge. Please try to verify that it
1548 is a Junkbuster bug, and not a browser or site bug first. Also, check to make
1549 sure this is not already a known bug. If you are using your own custom
1550 configuration, please try the stock configs to see if the problem is a
1551 configuration related bug.
1552
1553 -------------------------------------------------------------------------------
1554
1555 6. Copyright and History
1556
1557 6.1. License
1558
1559 Internet Junkbuster is free software; you can redistribute it and/or modify it
1560 under the terms of the GNU General Public License as published by the Free
1561 Software Foundation; either version 2 of the License, or (at your option) any
1562 later version.
1563
1564 This program is distributed in the hope that it will be useful, but WITHOUT ANY
1565 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1566 PARTICULAR PURPOSE. See the GNU General Public License for more details, which
1567 is available from the Free Software Foundation, Inc, 59 Temple Place - Suite
1568 330, Boston, MA 02111-1307, USA.
1569
1570 -------------------------------------------------------------------------------
1571
1572 6.2. History
1573
1574 Junkbuster was originally written by Anonymous Coders and Junkbuster's
1575 Corporation, and was released as free open-source software under the GNU GPL. 
1576 Stefan Waldherr made many improvements, and started the SourceForge project to
1577 rekindle development. There are now several active developers contributing. The
1578 last stable release was v2.0.2, which has now grown whiskers ;-).
1579
1580 -------------------------------------------------------------------------------
1581
1582 7. See also
1583
1584   http://sourceforge.net/projects/ijbswa
1585
1586   http://ijbswa.sourceforge.net/
1587
1588   http://i.j.b/
1589
1590   http://www.junkbusters.com/ht/en/cookies.html
1591
1592   http://www.waldherr.org/junkbuster/
1593
1594   http://privacy.net/analyze/
1595
1596  http://www.squid-cache.org/
1597
1598  
1599
1600 -------------------------------------------------------------------------------
1601
1602 8. Appendix
1603
1604 8.1. Regular Expressions
1605
1606 Junkbuster can use "regular expressions" in various config files. Assuming
1607 support for "pcre" (Perl Compatible Regular Expressions) is compiled in, which
1608 is the default. Such configuration directives do not require regular
1609 expressions, but they can be used to increase flexibility by matching a pattern
1610 with wild-cards against URLs.
1611
1612 If you are reading this, you probably don't understand what "regular
1613 expressions" are, or what they can do. So this will be a very brief
1614 introduction only. A full explanation would require a book ;-)
1615
1616 "Regular expressions" is a way of matching one character expression against
1617 another to see if it matches or not. One of the "expressions" is a literal
1618 string of readable characters (letter, numbers, etc), and the other is a
1619 complex string of literal characters combined with wild-cards, and other
1620 special characters, called meta-characters. The "meta-characters" have special
1621 meanings and are used to build the complex pattern to be matched against. Perl
1622 Compatible Regular Expressions is an enhanced form of the regular expression
1623 language with backward compatibility.
1624
1625 To make a simple analogy, we do something similar when we use wild-card
1626 characters when listing files with the dir command in DOS. *.* matches all
1627 filenames. The "special" character here is the asterisk which matches any and
1628 all characters. We can be more specific and use ? to match just individual
1629 characters. So "dir file?.text" would match "file1.txt", "file2.txt", etc. We
1630 are pattern matching, using a similar technique to "regular expressions"!
1631
1632 Regular expressions do essentially the same thing, but are much, much more
1633 powerful. There are many more "special characters" and ways of building complex
1634 patterns however. Let's look at a few of the common ones, and then some
1635 examples:
1636
1637 . - Matches any single character, e.g. "a", "A", "4", ":", or "@".
1638
1639 ? - The preceding character or expression is matched ZERO or ONE times. Either/
1640 or.                                                                            
1641
1642 + - The preceding character or expression is matched ONE or MORE times.
1643
1644 * - The preceding character or expression is matched ZERO or MORE times.
1645
1646 \ - The "escape" character denotes that the following character should be taken
1647 literally. This is used where one of the special characters (e.g. ".") needs to
1648 be taken literally and not as a special meta-character.                        
1649
1650 [] - Characters enclosed in brackets will be matched if any of the enclosed    
1651 characters are encountered.                                                    
1652
1653 () - parentheses are used to group a sub-expression, or multiple               
1654 sub-expressions.                                                               
1655
1656 | - The "bar" character works like an "or" conditional statement. A match is   
1657 successful if the sub-expression on either side of "|" matches.                
1658
1659 s/string1/string2/g - This is used to rewrite strings of text. "string1" is    
1660 replaced by "string2" in this example.                                         
1661
1662 These are just some of the ones you are likely to use when matching URLs with
1663 Junkbuster, and is a long way from a definitive list. This is enough to get us
1664 started with a few simple examples which may be more illuminating:
1665
1666 /.*/banners/.* - A simple example that uses the common combination of "." and "
1667 *" to denote any character, zero or more times. In other words, any string at
1668 all. So we start with a literal forward slash, then our regular expression
1669 pattern (".*") another literal forward slash, the string "banners", another
1670 forward slash, and lastly another ".*". We are building a directory path here.
1671 This will match any file with the path that has a directory named "banners" in
1672 it. The ".*" matches any characters, and this could conceivably be more forward
1673 slashes, so it might expand into a much longer looking path. For example, this
1674 could match: "/eye/hate/spammers/banners/annoy_me_please.gif", or just "/
1675 banners/annoying.html", or almost an infinite number of other possible
1676 combinations, just so it has "banners" in the path somewhere.
1677
1678 A now something a little more complex:
1679
1680 /.*/adv((er)?ts?|ertis(ing|ements?))?/ - We have several literal forward
1681 slashes again ("/"), so we are building another expression that is a file path
1682 statement. We have another ".*", so we are matching against any conceivable
1683 sub-path, just so it matches our expression. The only true literal that must
1684 match our pattern is adv, together with the forward slashes. What comes after
1685 the "adv" string is the interesting part.
1686
1687 Remember the "?" means the preceding expression (either a literal character or
1688 anything grouped with "(...)" in this case) can exist or not, since this means
1689 either zero or one match. So "((er)?ts?|ertis(ing|ements?))" is optional, as
1690 are the individual sub-expressions: "(er)", "(ing|ements?)", and the "s". The "
1691 |" means "or". We have two of those. For instance, "(ing|ements?)", can expand
1692 to match either "ing" OR "ements?". What is being done here, is an attempt at
1693 matching as many variations of "advertisement", and similar, as possible. So
1694 this would expand to match just "adv", or "advert", or "adverts", or
1695 "advertising", or "advertisement", or "advertisements". You get the idea. But
1696 it would not match "advertizements" (with a "z"). We could fix that by changing
1697 our regular expression to: "/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/", which
1698 would then match either spelling.
1699
1700 /.*/advert[0-9]+\.(gif|jpe?g) - Again another path statement with forward
1701 slashes. Anything in the square brackets "[]" can be matched. This is using
1702 "0-9" as a shorthand expression to mean any digit one through nine. It is the
1703 same as saying "0123456789". So any digit matches. The "+" means one or more of
1704 the preceding expression must be included. The preceding expression here is
1705 what is in the square brackets -- in this case, any digit one through nine.
1706 Then, at the end, we have a grouping: "(gif|jpe?g)". This includes a "|", so
1707 this needs to match the expression on either side of that bar character also. A
1708 simple "gif" on one side, and the other side will in turn match either "jpeg"
1709 or "jpg", since the "?" means the letter "e" is optional and can be matched
1710 once or not at all. So we are building an expression here to match image GIF or
1711 JPEG type image file. It must include the literal string "advert", then one or
1712 more digits, and a "." (which is now a literal, and not a special character,
1713 since it is escaped with "\"), and lastly either "gif", or "jpeg", or "jpg".
1714 Some possible matches would include: "//advert1.jpg", "/nasty/ads/
1715 advert1234.gif", "/banners/from/hell/advert99.jpg". It would not match
1716 "advert1.gif" (no leading slash), or "/adverts232.jpg" (the expression does not
1717 include an "s"), or "/advert1.jsp" ("jsp" is not in the expression anywhere).
1718
1719 s/microsoft(?!.com)/MicroSuck/i - This is a substitution. "MicroSuck" will
1720 replace any occurrence of "microsoft". The "i" at the end of the expression
1721 means ignore case. The "(?!.com)" means the match should fail if "microsoft" is
1722 followed by ".com". In other words, this acts like a "NOT" modifier. In case
1723 this is a hyperlink, we don't want to break it ;-).
1724
1725 We are barely scratching the surface of regular expressions here so that you
1726 can understand the default Junkbuster configuration files, and maybe use this
1727 knowledge to customize your own installation. There is much, much more that can
1728 be done with regular expressions. Now that you know enough to get started, you
1729 can learn more on your own :/
1730
1731 More reading on Perl Compatible Regular expressions: http://www.perldoc.com/
1732 perl5.6/pod/perlre.html
1733