Re: [exim] Lowest MX records test

Top Pagina
Delete this message
Reply to this message
Auteur: Marc Perkel
Datum:  
Aan: exim-users
Onderwerp: Re: [exim] Lowest MX records test


Ian Eiloart wrote:
>
>
> --On 26 December 2006 21:05:28 -0800 Marc Perkel <marc@???> wrote:
>
>>
>>
>> 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.
>
> Does this comment indicate that you've not bothered to put any effort
> at all into trying out Colin's solution?


It's a good solution if a better one doesn't come along. I think that
the Exim scripting language is capable of doing this without running an
external program which would be slow. I don't want to sound ungrateful
because I do appreciate it. I'm just holding out to see if it can be
done using Exim itself.

>
>