Re: [exim] Lowest MX records test

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Colin Keith
Date:  
À: exim-users
Sujet: Re: [exim] Lowest MX records test
On Tue, Dec 26, 2006 at 06:44:37PM -0800, Marc Perkel wrote:
> How would I do this in an ACL? I want to test to see if the IP of the
> interface that my server received the message on is the lowest MX record
> for the domain that it's being sent to.


I don't think its possible within Exim itself. Part of the way could be
to get the MX via a dnsdb lookup, such as:

${lookup dnsdb{defer_lax,mx=$domain}{$value}fail}


but that doesn't allow you to order the output. Instead, maybe you could
use a shell script such as:

#!/bin/sh
PATH="/bin:/usr/bin"
host -tmx $1 \
|grep 'handled by' \
|sort -nk6 \
| awk ' { print $7 } ' \

|head -1 \
|xargs host -ta \
|grep 'has address' \
|awk ' { print $4 } '


And then use a ${run} command to put this in your ACL:

 condition = ${if eq {$interface_address} \
                     {${run{/usr/exim/bin/lowest_mx $domain}{$value}fail}} \
                  {yes}{no} }


Not tested, but may be something to get you started.

Colin.

--
"Developers are like artists; they produce their best work if they
have the freedom to do so" - Werner Vogels, CTO Amazon.com