[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Exim] Re: setting up spamassassin



On Wed 16 Jan 2002, martin f krafft wrote:
> 
> sounds like (a) exim does it just like postfix. maybe they document it
> more sophisticatedly, (b) you doubling the load unnecessarily, and (c)
> you are asking for trouble. why not let procmail be MDA?

procmail is in no way light-weight; I'd hesitate to claim that procmail
is less of a load than exim (especially since exim is already in memory,
shared pages and all that).

To keep it on topic: this is how I've configured exim to filter just
about everything through spamassassin before delivery. As a bonus also a
filter to automagically send marked messages to spamcop for reporting.


As a transport:

spam_scan:
  driver = pipe
  user = uucp
  restrict_to_path
  path = "/usr/local/sbin:/usr/bin:/bin"
  suffix = 
  command = "spamassassinpipe '${if eq {$sender_address}{}{mailer-daemon}{$sender_address}}' $pipe_addresses"

Don't ask about the uucp, I have uucp already as a trusted user because
of uucp email, and I couldn't be bothered to add another.
spamassassinpipe is a script in /usr/local/sbin which I'll show below.

As a director, before userforward:

spamcheck:
  driver = smartuser
  transport = spam_scan
  condition = "${if or {{eq {$received_protocol}{spamscanned}} \
			{eq {$sender_host_address}{127.0.0.1}}}\
			{0}{${if >{$message_size}{100K}{0}{1}}}}"


This is the spamassassinpipe:

#!/bin/sh
from="$1"; shift
/usr/bin/spamassassin -P | /usr/sbin/sendmail -oMr spamscanned -f "$from" -- "$@"


That's basically it. This is based on an installation of spamassassin
debian packages from before it was actually in the debian distribution;
so it uses system-wide preferences etc.


This is the relevant begin of my .forward:
# Exim filter

if $h_subject: begins "*****SPAM*****"
then
    pipe "/home/paul/bin/spamtospamcop $sender_address $h_from $h_subject "
    save Mail/SPAM
endif

spamtospamcop is a simple script to send the spam to spamcop with a
suitable subject line (so that I can see from spamcop's reply subject
whether it possibly may be non-spam):

#!/bin/sh
sender="$1"; shift
h_from="$1"; shift
subject="`expr \"$1\" : '...............\(.*\)'`"
exec spamassassin -d | mailx -s "SPAM [$sender: $h_from: $subject]" submit.youruniqueaddress@spam.spamcop.net



Paul Slootman



Reply to: