[Exim] Re: setting up spamassassin (alternative)

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Alan Chandler
Ημερομηνία:  
Προς: dman, debian-user, exim-users
Παλιά Θέματα: [Exim] setting up spamassassin
Αντικείμενο: [Exim] Re: setting up spamassassin (alternative)
On Wednesday 16 January 2002 2:33 am, dman wrote:
> I'm now trying to set up spamassassin on my system, but am running
> into some hurdles.  I use exim as my MTA, so I'm following the guides
> at
>     http://bogmog.sourceforge.net/document_show.php3?doc_id=28


I have had a look at some of those (including briefly at that one) and they
seemed a bit complicated to me. I "think" I have succeeded in making it work
reasonably well in the last day or so using my own method which is documented
below. Since this is debian, spamassassin is also bundled with spamc/spamd
pair which is infact what I use. The only area I am a little unsure on is
the check_spam: transports use of $LOCAL_PART - in that will that work for
multiple recipients? Steps to follow are

1) edit /etc/default/spamassassin and set ENABLED=1
2) edit /etc/spamassassin.prefs to set rewrite_subject to 0 (see why later)
and anything else you want
3) start spamd /etc/init.d/spamassassin start
4) create a file /etc/exim/filter
============
# Exim Filter

if first_delivery and
   $h_X-Spam-Flag: contains "YES"
then
   logfile /var/log/exim/spamlog
   logwrite "$tod_log From: $h_From: Subject: $h_Subject: Sender:
$sender_address"
   if $h_From: is not ""
   then
      mail to $h_From: subject "Re: Your last message to me"
           expand file /etc/exim/spam-reply.txt
           once /var/log/exim/spamcount
           once_repeat 5d
   endif
   seen finish
endif
============
5) create the spam-reply.txt (here is mine as an example)
============
Your mail with Subject: $h_Subject:
to domain chandlerfamily.org.uk appears to be unsolicited spam.


If you intended to contact a person at that email domain for
legitimate reasons then our apologies. Please would you resend to the
same address but add the prefix "real-" (without the quotes) to the
e-mail address and it will bypass the spam filter.

Thank you

postmaster@???
============
6) edit /etc/exim/exim.conf with the following fragments (separated with
============)

============ main configuration
message_filter = /etc/exim/filter
message_filter_reply_transport = spam_reply_transport
============ transports
spam_reply_transport:
driver = autoreply
user = mail

# This transport does a spam check to look for spam and then re-injects
# the message into exim

check_spam:
driver = pipe
user = mail
group = mail
prefix =
suffix =
command = spamc | exim -oMr spam_checked -f $sender_address \$LOCAL_PART
ignore_status = true
use_shell = true
path = /usr/bin:/usr/sbin
============ directors (my local users bit is a bit weird in real_local:)
# This allows local delivery to be forced, avoiding spam filter, alias
# files and forwarding.

real_local:
prefix = real-
driver = smartuser
local_parts = /etc/exim/local-users
user = $local_part
transport = local_delivery

# All remaining mail is checked for spam

spam_to_check:
driver = smartuser
transport = check_spam
condition = ${if eq {$received_protocol} {spam_checked} {no} {yes} }
==============

And thats it - it uses the same principals as the other schemes - but these
seem to have long complicated perl scripts to do what I complete entirely
within exim. I had some problems initially because I was bouncing spam from
mailing lists back to mailing lists. I "hope" that using the from: header in
the mail filter command will avoid that somewhat. However to check what
happens over the next few days/weeks I am writing both the From: header and
the envolope sender to the log file to check


- --

Alan - alan@???
http://www.chandlerfamily.org.uk