Re: [Exim] problems setting up exim+spamassassin+cyrus imap

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Kirill Miazine
Ημερομηνία:  
Προς: Derek Stevenson
Υ/ο: exim-users
Αντικείμενο: Re: [Exim] problems setting up exim+spamassassin+cyrus imap
Derek Stevenson wrote:
> I'm trying to configure exim to work properly with spamassassin and cyrus
> imap. I first set up exim and cyrus, and made the necessary changes to get
> exim to deliver mail using the cyrus deliver command. That worked just fine.
>
> After that, I tried following the instructions at
>
> http://dman.ddts.net/~dman/config_docs/exim4_spamassassin.html
>
> to get SA to run in the exim router chain, before it gets passed to cyrus
> for final delivery to the user's mailbox. I added the router
> (spamcheck_router) and transport (spamcheck) to exim.conf (I've attached
> the relevant parts of my exim.conf below). However, now it looks like
> inbound email to my main domain name gets stuck in some sort of infinite
> routing loop (I killed the mailserver, restarted exim without the SA
> router, and got an email that had about 40 'Received-by' headers), drives
> load on the server way up, and never delivers to the cyrus email box
> properly. Strangely enough, email addressed to aliases on the server is
> properly processed by SA, which writes in the X-Spam-Flag and X-Spam-Status
> etc headers, and is delivered to the user's inbox.
>
> I've only been working on this for a week, so I'm pretty new to it and feel
> like I'm in over my head. My questions are: 1) What am I doing wrong with
> the SA router/transport that keeps the email in some sort of routing loop
> -- I just want to see that the headers are written and then passed on to
> cyrus for inbox delivery; and


Can you post sample headers of:

1) Message that was processed by SA and delivered to user's mailbox and
2) Message that was looping.

> 2) once that's functional, how do I configure which mailbox to deliver
> the email to based on the headers written by SA (e.g. a spam
> subfolder)?


Use Sieve maybe. Or modify the command in local_deliver to use different
mailbox if the message is likely to be spam.

> Config:
> exim4.12-4
> cyrus 2.1.12-7
> spamassassin 2.52-1
>
> Thanks in advance, apparently this config isn't very common as I've been
> scouring the web for example configs but haven't had much luck.


You can try my configuration if you like it better. Put sa_scan router
before your system_aliases router. This will only scan messages that
came was not locally submitted, did not came from localhost and were
smaller than 150k (there's no really need to scan a 10M message - it's
not spam anyway).

# Router
sa_scan:
    driver = manualroute
    condition = ${if and{\
        {def:sender_host_address}\
        {!eq{$sender_host_address}{127.0.0.1}}\
        {<{$message_size}{150k}}\
    }{yes}{no}}
    route_data = localhost
    transport = sa_scan
    self = send
    no_verify


# Transport
sa_scan:
    driver = smtp
    interface = 127.0.0.1
    helo_data = localhost
    transport_filter = /usr/bin/spamc


> -- Derek
>
> # Spam Assassin
> spamcheck_router:
>    no_verify
>    check_local_user
>    # When to scan a message :
>    #   -   it isn't already flagged as spam
>    #   -   it isn't already scanned
>    condition = "${if and { {!def:h_X-Spam-Flag:} {!eq\
>        {$received_protocol}{spam-scanned}}} {1}{0}}"
>    driver = accept
>    transport = spamcheck

>
> # Spam Assassin
> spamcheck:
>    driver = pipe
>    command = /usr/sbin/exim -oMr spam-scanned -bS
>    use_bsmtp = true
>    transport_filter = /usr/bin/spamc
>    home_directory = "/tmp"
>    current_directory = "/tmp"
>    # must use a privileged user to set $received_protocol on the way back in!
>    user = cyrus

            ^^^^^ <- Has cyrus user enough priviliges to use -oMr?


>    group = mail
>    log_output = true
>    return_fail_output = true
>    return_path_add = false
>    message_prefix =
>    message_suffix =


--
Kirill Miazine
mailto:km@krot.org
http://km.krot.org/