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