Re: [exim] Usage of dnsdb primary mx

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Phil Pennock
Data:  
Para: exim-users
Assunto: Re: [exim] Usage of dnsdb primary mx
On 2009-05-29 at 07:42 -0700, Marc Perkel wrote:
> Phil Pennock wrote:
> > ${if !eq{${reduce{<\n ${lookup dnsdb{mx=$domain}}}{70000 .}{${if <{${extract{1}{ }{$item}}}{${extract{1}{ }{$value}}}{$item}{$value}}}}}{70000 .}{${reduce{<\n ${lookup dnsdb{mx=$domain}}}{70000 .}{${if <{${extract{1}{ }{$item}}}{${extract{1}{ }{$value}}}{$item}{$value}}}}}fail}
> >
> I haven't really tried to figure this out yet but it seems to work. how
> would this code be modified to return all MX records EXCEPT the lowest?
> The above code works great for me to test "is the lowest MX pointing to
> any of my server". What I want to test separately is "are MX records
> other than the lowest numbered MX pointing to our server" so that then I
> can test "we are not the primary but we are the secondary for $domain"


domainlist secondary_mx = ! ${extract{2}{THE ABOVE}} : @mx_any/ignore=<;127.0.0.1;0.0.0.0

That's the simplest way -- use the @mx_any support already built into
Exim, exclude the primary.

The other way is to generate the highest priority MX per the above and
then use that in a ${filter ...} clause, to test that the items in a
dnsdb lookup do not match that value.

${filter{<\n ${lookup dnsdb{mx=$domain}}}{!eq{$item}{${if !eq{${reduce{<\n ${lookup dnsdb{mx=$domain}}}{70000 .}{${if <{${extract{1}{ }{$item}}}{${extract{1}{ }{$value}}}{$item}{$value}}}}}{70000 .}{${reduce{<\n ${lookup dnsdb{mx=$domain}}}{70000 .}{${if <{${extract{1}{ }{$item}}}{${extract{1}{ }{$value}}}{$item}{$value}}}}}fail}}}}

Note that the result of this is a list using newline as the separator.

Note that if you actually use this in production then you're crazy --
for one, if it's too complex to understand then it's too complex to
debug and for another it defers your logic into third-party DNS which
means there's probably a security hole in your set-up.

So if you use this and it breaks horribly and destroys your business, on
your head be it. All liability explicitly disavowed (without prejudice
to normal lack of liability for free advice on public mailing-lists).

-Phil