Re: [Exim] Exim, virtual domains and selective filtering

Top Page
Delete this message
Reply to this message
Author: Kyle Downey
Date:  
To: exim-users
Subject: Re: [Exim] Exim, virtual domains and selective filtering
Just as a follow-up, I did get this to work--I finally found an old
SA-Exim mailing list post covering what I was looking for--without a
system filter. The trick is to embed a conditional in the destination
directory value that tests for the X-Spam-Status header. See below.

--kd

### transport/35_exim4-config_maildir_ldap

# Use this instead of mail_spool if you want to to deliver to Maildir in
# home-directory - change the definition of LOCAL_DELIVERY
#
maildir_ldap:
debug_print = "T: maildir_ldap for $local_part@$domain"
driver = appendfile
directory = /var/imap/${lc:$domain}/${lc:$local_part}/Maildir/${if eq
{${substr_0_3:$header_X-Spam-Status:}}{Yes}{.Junk}{}}
delivery_date_add
envelope_to_add
return_path_add
maildir_format
user = 2000
group = 2000
mode = 0600
mode_fail_narrower = false



On Jul 25, 2004, at 2:18 PM, Stephen Gran wrote:

> On Sat, Jul 24, 2004 at 05:12:02PM -0400, Kyle Downey said:
>> I use Courier-IMAP and LDAP to provide virtual e-mail accounts: users
>> do not have home directories; there is a
>> /var/imap/${domain}/${user}/Maildir directory instead. I've gotten
>> everything running, and recently added amavisd-new, ClamAV and
>> SpamAssassin.
>>
>> What I'd like to do is provide a system-wide rule that will relay
>> virus-infected messages and suspected spam to a particular Maildir for
>> each user.
>>
>> Searching around I've found ways to do this with maildrop, procmail,
>> other MTAs, etc., and ways for Exim that would work if there were a
>> valid $home (like writing an Exim filter in .forward or a system
>> filter
>> that delivers to $home/Maildir/.Junk or the like). Unfortunately I
>> haven't found anything on doing this with virtual domains, where the
>> "home directory" is itself conditional on properties of the incoming
>> message.
>
> I'm not sure why this won't just work without a valid $home - the lines
> below look fine for a system filter.
>
>> What I'd like is somehow add a rule to my LDAP user transport that
>> says "if there's an X-Spam-Status = YES or if the subject starts with
>> VIRUS (is there a mail header for ClamAV+amavis I can use instead?)
>> deliver to
>
> warn  message = X-Virus: $malware_name
>       demime = *
>       malware = *

>
> Will give you a ClamAV header. I would personally just 550 it, but if
> you would prefer to deliver it, that should work.
>
>> /var/imap/${lc:$domain}/${lc:$local_part}/Maildir/.Junk
>>
>> instead of
>>
>> /var/imap/${lc:$domain}/${lc:$local_part}/Maildir
>>
>> which is the regular place. What's the best tool in the exim4 kit for
>> such a thing?
>
> I think a system filter, or alternately an earlier router that has a
> condition check for the headers. ISTR some problems in checking for
> headers in routers, but I think that has been worked out now.
>
> --
>
> -----------------------------------------------------------------------
> ---
> |  Stephen Gran                  | It is no wonder that people are so
>     |
> |  steve@???             | horrible when they start life as
>     |
> |  http://www.lobefin.net/~steve | children.   -- Kingsley Amis
>     |

>
> -----------------------------------------------------------------------
> ---
>
> --
>
> ## List details at http://www.exim.org/mailman/listinfo/exim-users
> Exim details at http://www.exim.org/ ##
>