If you only want to use webfilt for keeping copies of last mail received 
(depending on spam classification) then follow steps 1 and 2.

Additionally complete steps 3 through 6 if you want to enable the web
interface for interacting with the user filter (mail status inquiries and
reclassifications).

------------------------------
1) Customize user installation
------------------------------
Copy all the scripts (.sh) somewhere under your home directory, for 
instance '/home/username/webfilt'

You must modify 'defines.sh' and change MYCODE and all other variables 
that are different on your system.


------------------------------------------------------------
2) Configure ~/.procmailrc so it calls 'storelast.sh'
   storelast.sh's parameter must be the spam state or score.
   Among the configurations in defines.sh is a decision on
   how this parameter will indicate positive spam (grep)
------------------------------------------------------------
:0
SCORE=| /usr/bin/spamprobe receive

:0 c:
| /home/username/webfilt/storelast.sh "$SCORE"


-----------------------------------------
3) Make directory for users' public FIFOs
   You will need to do this as root.
-----------------------------------------
mkdir /var/webfilt
chgrp users /var/webfilt
chmod 1775 /var/webfilt


-----------------------------------
4) Install CGI script on web server
-----------------------------------
Copy webfilt.cgi to your web server's cgi-bin directory.

webfilt.cgi must be executable by the web server user (nobody). Note that
the script is designed to run "globally" for a site, and there is no
user-specific configuration. The only script content you may need to
modify is FIFODIR, which is by default /var/webfilt


---------------------------------
5) Configure web server for users
---------------------------------
This is where security becomes a concern. lastmail.sh (which is invoked by
procmail) will store copies of incoming mail to some directory. You may
choose to have this directory completely private (not accessible by the 
web server) in which case you can still use a web browser to read the 
local index.html file. This is safe, and works fine for local access.

Or, you may choose to have SPAMDIR and GOODDIR (from defines.sh)  
accessible by your web server. If you go that route you must configure
your web server to restrict access to the generated indexes.

Anyone who can read SPAMDIR and GOODDIR can read copies of your mail
stored in those directories! So you will obviously want to employ
passwords or host-based restrictions to make sure that your private mail 
doesn't get onto the Internet. If you are using Apache, look into: 
'.htaccess', and 'Allow', 'Deny', 'AuthUser' directives.


--------------------------------
6) Have users launch userfilt.sh
--------------------------------
Provided procmailrc is configured correctly, incoming mail will be copied 
to the "last mail" directories indicated. However in order to allow the 
generated web pages in those directories to INTERACT with the user filter, 
you have to run a user-side script. This script communicates with the web 
CGI process via two named pipes (FIFOs) to accomplish privilege isolation.

# User can start userfilt interactively (good for debugging)
./userfilt.sh start

# The best is to run the userfilt in the background
./userfilt.sh daemon

# Stop and cleanup, or recover from premature termination
./userfilt.sh stop
