Please I need help with
ldap search filter to use to retrieve the user email information from
ldap. I'm running postfix_ldap of Ubuntu
server 12.04. Everything seems to work fine, except getting the values returned from the search.
Version 1
server_host = ldap://samba.example.com
search_base = dc=company, dc=example, dc=com
query_filter = mail=%s
bind = no
domain = example.com
Version 2
server_host = ldap://samba.example.com
search_base = dc=company, dc=example, dc=com
query_filter = mail=%s
bind_dn = cn=Users,dc=company,dc=example,dc=com
domain = example.com
mail logs
Nov 26 11:13:26 mail postfix/smtpd[19662]: match_string: example.com ~? example.com
Nov 26 11:13:26 mail postfix/smtpd[19662]: dict_ldap_lookup: No existing connection for
LDAP source /etc/postfix/ldap-aliases.cf, reopening
Nov 26 11:13:26 mail postfix/smtpd[19662]: dict_ldap_connect: Connecting to
server ldap://samba.example.com
Nov 26 11:13:26 mail postfix/smtpd[19662]: dict_ldap_connect: Actual Protocol version used is 3.
Nov 26 11:13:26 mail postfix/smtpd[19662]: dict_ldap_connect: Binding to
server ldap://samba.example.com with dn cn=Users,dc=company,dc=example,dc=com
Nov 26 11:13:26 mail postfix/smtpd[19662]: warning: dict_ldap_connect: Unable to bind to
server ldap://samba.example.com with dn cn=Users,dc=company,dc=example,dc=com: 49 (Invalid credentials)
Nov 26 11:13:26 mail postfix/smtpd[19662]: warning: ldap:/etc/postfix/ldap-aliases.cf lookup error for "
[email protected]"
Nov 26 11:13:26 mail postfix/smtpd[19662]: maps_find: virtual_alias_maps:
[email protected]: search aborted
Nov 26 11:13:26 mail postfix/smtpd[19662]: mail_addr_find:
[email protected] -> (try again)
Nov 26 11:13:26 mail postfix/smtpd[19662]: NOQUEUE: reject: RCPT from col0-omc3-s2.col0.hotmail.com[65.55.34.140]: 451 4.3.0 <
[email protected]>: Temporary lookup failure; from=<
[email protected]> to=<
[email protected]> proto=ESMTP helo=<col0-omc3-s2.col0.hotmail.com>
Nov 26 11:13:26 mail postfix/smtpd[19662]: > col0-omc3-s2.col0.hotmail.com[65.55.34.140]: 451 4.3.0 <
[email protected]>: Temporary lookup failure
here's another log with successful search result but fialed to get the values of the result
Nov 26 12:04:56 mail postfix/smtpd[20463]: dict_ldap_lookup: Using existing connection for
LDAP source /etc/postfix/ldap-aliases.cf
Nov 26 12:04:56 mail postfix/smtpd[20463]: dict_ldap_lookup: /etc/postfix/ldap-aliases.cf: Searching with filter
[email protected]
Nov 26 12:04:56 mail postfix/smtpd[20463]: dict_ldap_get_values[1]: Search found 1 match(es)
Nov 26 12:04:56 mail postfix/smtpd[20463]: dict_ldap_get_values[1]: Leaving dict_ldap_get_values
Nov 26 12:04:56 mail postfix/smtpd[20463]: dict_ldap_lookup: Search returned nothing
Nov 26 12:04:56 mail postfix/smtpd[20463]: maps_find: virtual_alias_maps:
[email protected]: not found
Nov 26 12:04:56 mail postfix/smtpd[20463]: dict_ldap_lookup: In dict_ldap_lookup
Nov 26 12:04:56 mail postfix/smtpd[20463]: dict_ldap_lookup: /etc/postfix/ldap-aliases.cf: Skipping lookup of key 'tola.akintola': domain mismatch
Nov 26 12:04:56 mail postfix/smtpd[20463]: maps_find: virtual_alias_maps: tola.akintola: not found
Nov 26 12:04:56 mail postfix/smtpd[20463]: dict_ldap_lookup: In dict_ldap_lookup
Nov 26 12:04:56 mail postfix/smtpd[20463]: dict_ldap_lookup: /etc/postfix/ldap-aliases.cf: Skipping lookup of key '@example.com': domain mismatch
Nov 26 12:04:56 mail postfix/smtpd[20463]: maps_find: virtual_alias_maps: @example.com: not found
Nov 26 12:04:56 mail postfix/smtpd[20463]: mail_addr_find:
[email protected] -> (not found)
My refined ldap-aliases.cf looks like this:
server_host = ldap://samba.example.com
server_port = 3268
search_base = dc=company, dc=example, dc=com
query_filter = mail=%s
result_attribute = uid
bind_dn = cn=Administrator,cn=Users,dc=company,dc=example,dc=com
bind_pw = pass
domain = example.com
So I'll like to know what
ldap filter is appropriate to get this to work.
Thanks for helping out.