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