# pm-jaube-prg-runall.rc -- Interface to all Bayesian filter programs # $Id: pm-jaube-prg-runall.rc,v 1.15 2004/12/15 21:07:07 jaalto Exp $ # # File id # # .Copyright (C) Jari Aalto # .$Keywords: procmail, subroutine, UBE, spam, filter $ # # This code is free software in terms of GNU Gen. pub. Lic. v2 or later # Refer to http://www.gnu.org/copyleft/gpl.html # # Overview of features # # o To detect spam reliably, run all Bayesian programs one by one # to see if any of them classifies the message as spam. # o Programs supported: bogofilter, spamprobe, Bayesian Mail # Filter, Annoyance Filterm Bsfilter, Spamoracle and Spamassassin. # # Description # # There are several bayesian based statistical analysis programs that # study the message's tokens and then classify it into two categories: # good or bad, or if you like, ham and spam. This module is a # _meta_ _package_ which will call all other individual modules # that interface to these Bayesian programs. The use is simple: define # programs that are available in your system and which you have # trained (Bayesian programs need to be trained before use), and this # this module will query how those programs would classify the message. # # Required settings # # PMSRC must point to source directory of procmail code. This subroutine # will include # # o pm-javar.rc # o pm-jaube-prg-spamprobe.rc # o pm-jaube-prg-spamoracle.rc # o pm-jaube-prg-annoyance-filter.rc # o pm-jaube-prg-bsfilter.rc # o pm-jaube-prg-bmf.rc # # Call arguments (variables to set before calling) # # To activate Bayesian program(s), define path to them. Default # value for all these variables is "" i.e. is is supposed that # no programs have been installed or trained. # # o `JA_UBE_BOGOFILTER_PRG', path to *bogofilter* program. # o `JA_UBE_SPAMPROBE_PRG', Path to *spamprobe* program # o `JA_UBE_BMF_PRG', Path to Bayesian Mail Filter *bmf* program. # o `JA_UBE_SPAMASSASSIN_PRG', path to *spamassassin* program. # If daemon version is available, set this to *spamc* program. # o `JA_UBE_SPAMORACLE_PRG', path to *spamoracle* program. # o `JA_UBE_ANNOYANCE_PRG', path to *annoyance-filter* program. # You must also set `JA_UBE_ANNOYANCE_SPAM_DB' to fast # dictionary database location. # o `JA_UBE_BSFILTER_PRG', path to *bsfilter* program. # # Optional variables to set: # # o `JA_UBE_BOGOFILTER_OPT'. Default is "-p" passthrough. # Option "-e" will report exit code to procmail. # o `JA_UBE_SPAMASSASSIN_OPT'. Default is "". # o `JA_UBE_SPAMASSASSIN_MAX_SIZE'. Default is 256000 (256k). # Spamassassin is a Perl program, which is slow at startup, # so checking e.g. long attachements consumes lot of resources. # Keep this value relatively small. # # Important notes # # All headers are canonicalized to *X-Spam--* so e.g. # in bogofilter's case, the default *X-Bogocity* header is # changed to value *X-Spam-Bogofilter-Status* and so on. # Summaries like below can then be generated: # # $ egrep -i '(Subject|From|^X-Spam.*Status)' *.mbox # # Return values # # o `ERROR' variable's first word is set to program that classified # the spam: *bogofilter*, *bmf* (Bayesian Mail Filter), # *spamassassin* etc. It is followed by semicolon ";" and # detailed return status from the program. # o `ERROR_INFO' is set only in bogofilter's case if it thinks # the message is neither spam nor ham ("Unsure"). # # Usage example # # PMSRC = $HOME/procmail # procmail recipe dir # # # ... other checks, mailing lists, work mail etc. # # # bogofilter and spamprobe are available and trained. Use them. # # JA_UBE_BOGOFILTER_PRG = "/usr/bin/nice -n 5 /usr/bin/bogofilter" # JA_UBE_BMF_PRG = "/usr/bin/nice -n 5 /usr/bin/bmf" # # # Now call the "umbrella" module, which will take care of # # the details. # # INCLUDERC = $PMSRC/pm-jaube-prg-runall.rc # # # ERROR is set if message was spam. The "()\/" logs reason. # # :0 : # * ERROR ?? ^()\/.+ # junk.mbox # # File layout # # The layout of this file is managed by Emacs packages tinyprocmail.el # and tinytab.el for the 4 tab text placement. # See project http://tiny-tools.sourceforge.net/ # # Change Log # # None dummy = " ======================================================================== pm-jaube-prg-runall.rc: init:" # Kill variables ERROR ERROR_INFO dummy = "pm-jaube-prg-runall: Run Bogofilter" :0 * ERROR ?? ^^^^ * JA_UBE_BOGOFILTER_PRG ?? [a-z] { INCLUDERC = $RC_UBE_BOGOFILTER :0 * ERROR ?? ^()\/spam.* { ERROR = "bogofilter; $MATCH" } :0 E { ERROR = "" } } dummy = "pm-jaube-prg-runall: Run Spamprobe" :0 * ERROR ?? ^^^^ * JA_UBE_SPAMPROBE_PRG ?? [a-z] { INCLUDERC = $RC_UBE_SPAMPROBE :0 * ERROR ?? ^()\/spam.* { ERROR = "spamprobe; $MATCH" } :0 E { ERROR = "" } } dummy = "pm-jaube-prg-runall: Run Annoyance filter" :0 * ERROR ?? ^^^^ * JA_UBE_ANNOYANCE_PRG ?? [a-z] { INCLUDERC = $RC_UBE_ANNOYANCE :0 * ERROR ?? yes { ERROR = "annoyance-filter; $MATCH" } :0 E { ERROR = "" } } dummy = "pm-jaube-prg-runall: Run Bayesian Mail Filter" :0 * ERROR ?? ^^^^ * JA_UBE_BMF_PRG ?? [a-z] { INCLUDERC = $RC_UBE_BMF :0 * ERROR ?? ^()\/yes.* { ERROR = "bmf; $MATCH" } :0 E { ERROR = "" } } dummy = "pm-jaube-prg-runall: Run Spamassassin" :0 * ERROR ?? ^^^^ * JA_UBE_SPAMASSASSIN_PRG ?? [a-z] { INCLUDERC = $RC_UBE_SPAMASSASSIN :0 * ERROR ?? yes { ERROR = "spamassassin; $MATCH" } :0 E { ERROR = "" } } dummy = "pm-jaube-prg-runall: Run Bsfilter" :0 * ERROR ?? ^^^^ * JA_UBE_BSFILTER_PRG ?? [a-z] { INCLUDERC = $RC_UBE_BSFILTER :0 * ERROR ?? yes { ERROR = "bsfilter; $MATCH" } :0 E { ERROR = "" } } dummy = "pm-jaube-prg-runall: Run Spamoracle" :0 * ERROR ?? ^^^^ * JA_UBE_SPAMORACLE_PRG ?? [a-z] { # We must run spamoracle last, because it lacks the ability # to read message from stdin. Due to this many shell calls # are needed. See the RC file for more information. INCLUDERC = $RC_UBE_SPAMORACLE :0 * ERROR ?? yes { ERROR = "spamoracle; $MATCH" } :0 E { ERROR = "" } } dummy = "pm-jaube-prg-runall.rc: end: $ERROR" # pm-jaube-prg-bmf.rc ends here