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