procmail
[Top] [All Lists]

Re: Procmail+Spamassassin on global domain basis

2003-07-04 02:48:56
Hi Sean,

Thank you for your prompt reply.  The main problem I have here is not 
the theory (I know what should happen) but rather the syntax of my procmailrc
Is it possible for you to modify the below procmailrc for me to a working state
and I can change it thereafter.

It would be much appreciated.

Thanks
David Jacobson

On Wed, Jul 02, 2003 at 05:02:12AM -0700, Professional Software Engineering 
wrote:
At 12:05 2003-07-02 +0200, David Jacobson wrote:

Each users mail resides in /var/spool/mail/$LOGNAME

I have setup a .forward in each mail users home directory to 
|/usr/bin/procmail

Do these users have shell or ftp access to their home dirs?  Is the 
.forward necessary, or can you not configure Exim to use procmail as the 
LDA (I don't use Exim, so I don't know what configuration issues you may 
have with it).

The next step now is to implement SpamAssassin on a per Domain basis ie 
for domain xxx.net use spamassassin
and send the spam to spam(_at_)xxx(_dot_)net if domain is not xxx.net then 
don't use 
spamassassin and just act normally.

I've posted several times in past months about methods you can set per-user 
configs.  Assuming each domain is associated with a separate user account 
(or different domains are associated with different groups of users), you 
can use $LOGNAME, and do something like the following in /etc/procmailrc:

# file is formatted like so:
# logusername OPTION OPTION OPTION
#
# could have a forwarding email address as an option:
#* FILTER_OPTIONS ?? [  ]FORWARD=\/[^$  ]*
#{
#       FWD_ADDR=$MATCH
#}

FILTER_OPTIONS=|`grep "^$LOGNAME " central_userlist`

:0
* FILTER_OPTIONS ?? [   ]SPAMASSASSIN\>
{
        LOG="invoking SA for $LOGNAME$NL"
}

or:

GROUPS=`groups $LOGNAME`

# if user is a member of the MAIL_NOSPAM group, subject them to filtering
:0
* GROUPS ?? [   ]mail_nospam\>
{
        LOG="perform spam filtering$NL"
}

You should get the idea here.  The latter method is nice because you can 
utilize the existing user database functions, though the spam forward 
address isn't easily implemented that way, while the first method allows 
for all manner of extensions if you know how to wing it right.  You could 
use a DB query utility instead of grep as well - and the db could be 
manipulated by the users themselves.

LOGFILE=/var/log/procmailrc.log

You realize that write perms to that directory should generally be limited, 
and thus joe user shouldn't be running this procmailrc file?

:0
* ^From(_dot_)*(_at_)xxx(_dot_)net


You're missing the ACTION line for the above recipe.  Where'd it go?


# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.

I suspect that even 250KB is excessively large for a spam.

# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mbox. (This one is optional.)
:0:

The trailing colon (lockfile) is superfluous if you're _forwarding_ the 
message.

* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

This works fine, but the following method gives you a direct numeric 
specification of the threshold, and similar to the above filter_options 
code, you could define that threshold on a PER USER basis:

:0
* 1^0
* -15^0
* ^X-Spam-Level: \/.*
* 1^1 MATCH ?? (\*)
! spamreporaddr(_at_)domain(_dot_)tld

The (negative) number on the second line is the threshold - if 15 is the 
number of asterisks you want to trigger the action on, then punch in -15


---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail


-- 
Kind regards,

David Jacobson
System Architect
Imperial Online - The Imperial Connection

(+27) 11 723-8181 Helpdesk 
(+27) 11 454 1236 Fax

-------------------------------------------------
GnuPG key is available at www.leet.org/pubkey.gpg
-------------------------------------------------

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>