Re: [Exim] Using SA (Spam Assassin) selectively with Exim

Góra strony
Delete this message
Reply to this message
Autor: Matt McLeod
Data:  
Dla: exim-users
Temat: Re: [Exim] Using SA (Spam Assassin) selectively with Exim
Odhiambo G. Washington wrote:
> May I pose this to those already using SA with Exim.
> Is it possible to use SA with Exim but not globally?


I'm using a slightly different setup to the one already posted
here. I have the following router:

spamcheck_router:
no_verify
check_local_user
condition = "${if and {{eq {${lookup mysql{select toggle from spamscans where user='$local_part' and toggle=1}{$value}}}{1}} { and { {!def:h_X-Spam-Flag:} {!eq {$received_protocol}{spam-scanned}}}}} {1}{0}}"
driver = accept
transport = spamcheck

with this transport:

spamcheck:
    driver = pipe
    command = /usr/local/exim/bin/exim -oMr spam-scanned -bS
    use_bsmtp = true
    transport_filter = /usr/local/bin/spamc -u $local_part
    home_directory = "/tmp"
    current_directory = "/tmp"
    user = exim
    group = mail
    log_output = true
    return_fail_output = true
    return_path_add = false
    message_prefix =
    message_suffix =


spamd is configured to get per-user configuration data from mysql,
as there are no user home directories on the machine.

So, spam scanning is only done if the user has the correct flag
set in the mail configuration database.

I did it with mysql rather than plain text files to make it easier
to write a web-based front-end to mail configuration options for users
(e.g., vacation autoreplies, mail forwarding, spam scanning, filtering,
and so on). Changing the lookup to suit should not be too difficult.

I'm sure that the condition in the router above is more complicated
than it needs to be, but it's what I've got for the moment and it
does appear to work.

Matt