Re: [exim] Lowest MX records test

Top Page
Delete this message
Reply to this message
Author: Marc Perkel
Date:  
To: Colin Keith
CC: exim-users
Subject: Re: [exim] Lowest MX records test


Colin Keith wrote:
> 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.
>


There's a lot of sharp people in this list. I bet someone figures it out.