I am using the ldap lookup for relay_domains,
my current configs:
main.cf:
relay_domains = ldap:/etc/postfix/ldap-domains.cf
ldap-domains.cf:
server_host = localhost
search_base = dc=example,dc=com
scope = sub
query_filter = (registeredAddress=%d)
result_attribute = registeredAddress
typical ldap entry:
dn: o=company,dc=example,dc=com
o: company
objectClass: organization
structuralObjectClass: organization
entryUUID: <uuid>
creatorsName: cn=admin,dc=example,dc=com
createTimestamp: <timestamp>
registeredAddress: example.com
registeredAddress: mydomain.com
Kyle A. King
Quentus Technologies, INC
Cell: 703-635-9512
Work: 253-218-6030
Fax: 206-462-1861
Email: [email protected]
On 02/25/2012 01:19 PM, Viktor Dukhovni wrote:
> On Sat, Feb 25, 2012 at 09:18:39AM -0800, Kyle King wrote:
>
>> I store my domains as an attribute for an org, while for a org with one
>> domain the lookup works fine when a org has several domains (and
>> therefore returns all domains of that user) The ldap look up fails. is
>> there a way to parse the list, such as using string expansions like in exim?
> You have completely failed to specify in what context the LDAP data
> is being used. We're not psychic, so please elaborate. Which Postfix
> feature (transport_maps, virtual_alias_maps, ...) are you implementing
> via an LDAP lookup, what is a typical LDIF and what do you want the
> lookup to return for any given key.
>
> If the context requires a domain as a key and a single result value
> (perhaps a transport, perhaps something else, who knows), then in
> any sane schema the domain list is stored as a multi-valued attribute.
> You can still query these and return a single value:
>
> LDIF:
>
> org: Example Corp
> domain: example.com
> domain: example.net
> domain: example.org
>
> table.cf:
>
> # Use the domain as a lookup key
> query_filter = domain = %s
> # Pick any single-valued attribute of the object
> result_attribute = org
> # Return the lookup key
> result_format = %S
>
> Depending on your actual use-case this may need some tuning.
>