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