Andy Rabagliati wrote:
> Folks,
>
> I would like local_domains to be set from an LDAP lookup. I use
> powerdns, and serve DNS out of this LDAP tree, and anticipate having a
> lot of domains here.
>
> My LDAP entries look like this :-
>
> dn: dc=_forward_,ou=Computers,dc=aims,o=ami-net
> dc: _forward_
> objectClass: dNSDomain
> objectClass: domainRelatedObject
> mXRecord: 10 smtp.aims.ac.za.
> mXRecord: 20 frogfoot.ami-net.org.
> nSRecord: ns1.aims.ac.za.
> nSRecord: ns2.aims.ac.za.
> nSRecord: frogfoot.ami-net.org.
> associatedDomain: aims.ac.za
> businessCategory: Server
> sOARecord: ns2.aims.ac.za hostmaster@??? 1171107778 1800 3600 1814400 84600
>
> dn: dc=_aminet_,ou=Computers,dc=aims,o=ami-net
> dc: _aminet_
> objectClass: dNSDomain
> objectClass: domainRelatedObject
> mXRecord: 10 smtp.aims.ac.za.
> mXRecord: 20 frogfoot.ami-net.org.
> nSRecord: ns1.aims.ac.za.
> nSRecord: ns2.aims.ac.za.
> nSRecord: frogfoot.ami-net.org.
> associatedDomain: ami-net.org
> businessCategory: Server
> sOARecord: ns2.aims.ac.za hostmaster@??? 1171107778 1800 3600 1814400 84600
>
> I would like an LDAP lookup to return all 'associatedDomain' entries
> for which we are listed as an mXRecord.
>
> I found this on Mr. Google :-
> http://www.exim.org/mail-archives/exim-users/Week-of-Mon-20050207/msg00019.html
>
> So I tried this :-
>
> LOCAL_LAN = 192.168.42.0/24
> LDAP_HOST = localhost
> LDAP_BASE = dc=aims,o=ami-net
>
> domainlist local_domains = ${tr {${lookup ldapm{ \
> ldap://LDAP_HOST/ou=Computers,LDAP_BASE?associatedDomain?one?(mXRecord=10 smtp.aims.ac.za.)}}} {\n}{:}}
>
> It works !!
> But I need a wildcard on the MX record, like so :-
>
> domainlist local_domains = ${tr {${lookup ldapm{ \
> ldap://LDAP_HOST/ou=Computers,LDAP_BASE?associatedDomain?one?(mXRecord=*smtp.aims.ac.za*)}}} {\n}{:}}
>
> No Go. Any help there, please ?
>
> Cheers, Andy!
>
Wildcards work in LDAP (with some restrictions). I don't see why this
search wouldn't work, provided the LDAP directory supports wildcard
lookups for the attribute in question. Are there any special matching
rules on the mXRecord attribute which would cause a wildcard lookup to fail?
Try running Exim with -d+lookup to see the ldap lookup results.
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@???
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555