Re: [exim] Per-User SpamAssassin config

Top Page
Delete this message
Reply to this message
Author: Jakob Hirsch
Date:  
To: 'Exim-users'
Subject: Re: [exim] Per-User SpamAssassin config
Richard Hobbs wrote:

> 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.


Exim's spec.txt, 40.2 is quite verbose on this.
spamd listens by default on 127.0.0.1:783, and Exim uses this if you
have a spam condition in your ACLs.

The exact setup depends on you requirements and can be arbitrarily
complex. Mine is:


> ### check SMTP DATA
> acl_check_data:
>
> # Do not scan messages submitted from our own hosts
> # and locally submitted messages.
> accept hosts = 127.0.0.1 : +relay_from_hosts
>
> # accept if authenticated
> accept authenticated = *
>
>   # Reject high scored spam messages
>   deny  message = This message scored $spam_score spam points. Congratulations!
>         condition = ${if <{$message_size}{200k}{1}{0}}
>         spam = nobody:true
>         condition = ${if >{$spam_score_int}{100}{1}{0}}
>         delay = 30s

>
>   # put spam header into message
>   warn  log_message = Classified as spam (score $spam_score)
>         condition = ${if <{$message_size}{200k}{1}{0}}
>         spam = nobody
>         delay = 10s
>         control = fakereject/This message scored $spam_score spam points. Congratulations!

>
>   warn  condition = ${if <{$message_size}{200k}{1}{0}}
>         spam = nobody:true
>         message = X-Spam-Status: ${if >{$spam_score_int}{50} {Yes}{No}}, $spam_score\n\
>                   X-Spam-Report: $spam_report


(Don't forget "acl_smtp_data = acl_check_data" in the main config!)

Scores above 10 rejects the message, scores between 5 and 10 accept it
(but still reject it in SMTP) and allow the users to filter in their MUA.

> 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?


Depends on how your users are set up on your machine. If they are all
system users, you might e.g. check for $HOME/.spamcheck in ACL conditions:

condition = ${if {exists {/home/$local_part/.spamcheck})}

(note that Exim needs rx rights to the users' home directories then)

or put all spamassassin-users in a file /etc/exim/spam_free_users:

local_parts = /etc/exim/spam_free_users

just make sure the additional condition is put _before_ the spam condition.