Below is a link to archive posts by myself explaining how we do this.
Basically forward as attachment feeds to a script that strips out the
attachment and stores it.  Separate cron job sa-learns the stored
messages.  The main script could probably be modified to feed sa-learn
directly, cutting out the need for the cron job.

http://www.nabble.com/sa-learn-and-POP3-accounts-tf2424315.html#a6783285

Also, here are some notes I had regarding this:

> 1) user forwards spam message AS ATTACHMENT to a pre-defined email 
> address
> 

I tell my users to forward as attachment to [EMAIL PROTECTED]

> 2) postfix pipes emails to this address to the modified script via 
> local alias
> 

I am using virtual users.  I had to make sure that postfix knows how to
handle local aliases.  From my main.cf:

alias_maps = hash:/etc/aliases

...pointing to the local aliases file.  Then within that file, I set up
a local alias to pipe all input to the script.  From my /etc/aliases:

spam-bayes:     "| /etc/scripts/strip_attached_messages.pl"

... Be sure to run the command 'newaliases' after updating the aliases
file.  Then you use virtual_alias_maps to set the
"[EMAIL PROTECTED]" address to forward to the alias you set up.  I
use MySQL for my virtual_alias_maps, but if you use a file it would have
something like:

[EMAIL PROTECTED]               spam-bayes

That will forward all emails sent to [EMAIL PROTECTED] to the
spam-bayes alias, which will in turn pipe them into your script.

> 3) the script strips out all attachments defined as content-type:
> message/*
> 
<...>
> 5) a separate cron script then runs on a schedule to pipe all messages

> in /tmp/spam into sa-learn and delete them afterwards
> 
> Need to setup the crontab to call this script

My cron script:
------------------------------------
#!/bin/sh

/usr/local/bin/sa-learn --spam --username=vscan /tmp/spam/ /bin/rm
/tmp/spam/*
------------------------------------

--Username=vscan because I am using a single bayes database for all
mail, rather than individual bayes db's for each user.  This method
wouldn't work for individual bayes setups.  My crontab line:

53      1       *       *       *       root
/etc/scripts/train-bayes.sh

... To run it once per day at 1:53 am.  I get a nice email every morning
to root which says:

Learned tokens from 102 message(s) (102 message(s) examined)

The only thing to configure in the script is the path where you want the
attached messages stored until your sa-learn script runs.  I save mine
to /tmp/spam/, and that's where the train-bayes.sh script looks for
them.

Hope this helps.  It has been working very well for me so far.

-DH
 

> -----Original Message-----
> From: Alexander Veit [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, January 03, 2007 3:33 PM
> To: users@spamassassin.apache.org
> Subject: Re: White Listing
> 
> Nigel Frankcom wrote:
> > Forwarding is not a good idea, it adds and or changes the 
> headers in 
> > the mail.
> 
> Forward as attachment(s) could be a solution since original 
> mail headers are kept intact. I've asked a similar question 
> on this list some days ago, but nobody could say if there's a 
> common practice how to feed such messages into spamassassin 
> on the server.
> 
> > There have been several systems discussed in the last few 
> months using 
> > IMAP, it may be worth digging through the archives for them.
> 
> Sounds like misusing IMAP ;-)
> 
> --
> Cheers,
> Alex
> 
> 

CONFIDENTIALITY NOTICE:
This email message, including any attachments, is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized review, use, disclosure or distribution is prohibited. If you 
are not the intended recipient, please contact the sender by reply email and 
destroy all copies of the original message.
 
SPAM-FREE 1.0(2476)


Reply via email to