Richard Hobbs wrote:
> Hello,
>
> We have a mail server on which I would like to enable spamassassin, but only
> for individual users. We're running Exim 4.50 and SpamAssassin 3.0.3 on a
> Debian 3.0 box. Mailman 2.1.5 is also running on the machine if it makes a
> difference.
>
> Some users do not want spam checking to be done at all, but other users
> would like it to be done. The part I'm having trouble with is understanding
> how to get exim to use spamassassin at all, let alone for some accounts and
> not others.
>
> Also, i have already spent hours on Google trying to find a guide or a
> how-to somewhere, and I can't find anything.
>
> I have already got spamassassin working in daemon mode (by running spamd).
> All I have done so far is change 'ENABLED' to '1' in
> "/etc/default/spamassassin". All other spamassassin config is default apart
> from the following line in "/etc/mail/spamassassin/local.cf":
>
> rewrite_header Subject ****SPAM****
>
> SpamAssassin detects spam successfully if I type:
>
> spamassassin -t < sample-spam.txt
>
> But I don't think this is using the spamd daemon, is it? How can I test
> using 'spamc'?
No, that's not using spamd. Try 'man spamc', that will tell you how to use it.
>
> Once we know spamc can successfully talk to spamd which successfully detects
> spam, how can I let individual users enable or disable spam checking on
> their account as they please? I have not changed the exim configuration at
> all yet because I can't quite figure out what needs to be done.
You need a router which checks for each local recipient whether they want to
have their messages spam scanned. This routes messages to be scanned to a
transport which will scan the message and then re-inject it into the queue
for delivery. The normal test for a user who wants to have their messages
scanned is the existence of the user_prefs file in their directory
$HOME/.spamassassin.
This is the router I use:
HOME_DIR=/var/mail/home
spamtest:
driver = accept
no_verify
check_local_user
require_files = HOME_DIR/$local_part/.spamassassin/user_prefs
condition = ${if eq {$received_protocol}{spam-scanned}{no}{yes}}
transport = spamcheck_transport
and this is my transport:
spamcheck_transport:
driver = pipe
home_directory = /var/spool/mail
batch_max = 1000
use_bsmtp
headers_remove =
X-Spam-Score:X-Spam-Status:X-Spam-Flag:X-Spam-Checker-Version:X-Spam-Report:X-Spam-Level:
command = /usr/sbin/exim -oMr spam-scanned -bS
transport_filter = /usr/bin/spamc -f -s 5000000 -u $local_part
user = mail
log_output = true
return_fail_output = true
return_path_add = false
message_prefix =
message_suffix =
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@???
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555