Re: [exim] Auto-whitelist

Pàgina inicial
Delete this message
Reply to this message
Autor: Mike Cardwell
Data:  
A: exim-users
Assumpte: Re: [exim] Auto-whitelist
* on the Fri, Jan 26, 2007 at 11:16:46PM +0800, Chih-Cherng Chin wrote:

>> We use exim 4.62 with mysql. I'd like to set up whitelist that is
>> automatically updated with $recipients value when a user in our domain
>> sends out an email. The $recipients is a comma delimited list of the
>> recipients available during data acl. I see that it can be done using
>> the Perl but I was hoping not to have to use Perl for performance
>> reasons. Has anyone done this without using Perl?
> I have done something similiar without using embedded Perl while setting
> up greylisting. The sender and recipients of every outbound mail are
> stored in a DBM file. With the help of exim acl, recipients' reply would
> skip the greylisting automatically. It greatly reduces the number of ham
> mail deferred by greylisting.
> The way I do it is very simple:


I have a couple of more complicated, but cleaner methods(imo):

1.) I use MySQL. I wrote a mysql stored function that takes the value of
$recipients, and processes each address in a loop.

2.) Use a recursive ACL to separate the contents of $recipients and do a db
call for each recipient, eg below:

acl_smtp_data = acl_check_data

acl_check_data:

   warn set acl_m0 =
        set acl_m1 =
    acl        = acl_process_recipients


acl_process_recipients:

   warn set acl_m0 = ${if eq{$acl_m0}{}{$recipients}{}}
        set acl_m1 = ${if match{$acl_m0}{\N^([^,]+)\N}{$1}{}}
    set acl_m0 = ${sg{$acl_m0}{\N^[^,]+,?(.*?)$\N}{\$2}}


# acl_m1 contains a single email address in the list at this point. #
# Do stuff with it, but do not accept/deny/drop/defer at this point #

   warn !condition = ${if eq{$acl_m0}{}}
        acl        = acl_process_recipients


accept

Disclaimer: That example above is untested. I pulled apart an old piece
of config I wrote and modified it for your purpose. Hoepfully you get
the idea though.

Mike