OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: dict_ldap_connect: Unable to bind to server ldap://localhost:389 as : 2 (Protocol error)

From: Victor Duchovni (Victor.DuchovniMorganStanley.com)
Date: Sun Mar 02 2008 - 15:54:30 CST


On Sun, Mar 02, 2008 at 08:38:35PM +0000, Lou Picciano wrote:

> Victor,
>
> Yes, we clearly have something fundamental not working here.
> Apologies if I've added to the confusion.
>
> Our issue remains that we cannot query against an LDAP store if that ldap source
> is defined in its own file.
> To clarify: We have the following files impacting ldap:
>
> in directory /etc/postfix:
> main.cf
> domains
> aliases
> accounts
> accountsmaps
>
> - snippet of main.cf:
> ...
> # = = = = = = = = = = LDAP SETUP = = = = = = = = = = = = = = = = = =
> # LDAP sources: accounts, accountsmaps, domains, aliases
> # - First: the virtual alias maps
> virtual_alias_maps = ldap:/etc/postfix/accountsmap, ldap:/etc/postfix/aliases
>
> #virtual_transport = virtual
>
> # This sets up the domain-based email under vmail's 'home' dir
> virtual_mailbox_base = /export/home/vmail/domains
>
> virtual_mailbox_maps = ldap:/etc/postfix/accounts
> virtual_mailbox_domains = ldap:/etc/postfix/domains
> # =======
>
> For the file 'domains', we've tried it two ways:
>
> 1) - content of /etc/postfix/domains: (other 3 ldap 'source' files use similar
> syntax)
> # = = = LDAP DOMAINS
> domains_server_host = 127.0.0.1
> domains_version = 3
> #domains_port = 389
> domains_search_base = o=mail,dc= realdomainname,dc=com
> domains_query_filter =
> (&(objectClass=JammVirtualDomain)(jvd=%s)(accountActive=TRUE)(delete=FALSE))
> domains_result_attribute = jvd
> domains_bind = no
> domains_scope = one
> # end LDAP DOMAINS = = = = = = = = = = = = = = = = = = = = = = = = = = =

This is wrong. Prefixes are only used with settings in main.cf

> - OR -
> 2) - content of /etc/postfix/domains:
> # = = = LDAP DOMAINS
> server_host = 127.0.0.1
> version = 3
> #port = 389
> search_base = o=mail,dc= realdomainname,dc=com
> query_filter =
> (&(objectClass=JammVirtualDomain)(jvd=%s)(accountActive=TRUE)(delete=FALSE))
> result_attribute = jvd
> bind = no
> scope = one
> # end LDAP DOMAINS = = = = = = = = = = = = = = = = = = = = = = = = = = =
>

This is correct (assuming the query filter is actually on one line or
the second line starts with whitespace). Show more detailed evidence for
this case.

> With _either_ formatting of the 'domains' file, we cannot get postmap to make
> use of the domains source:
>
> postmap: dict_ldap_connect: Actual Protocol version used is 2.
> postmap: dict_ldap_connect: Binding to server ldap://localhost:389 as dn
> postmap: dict_ldap_connect: Successful bind to server ldap://localhost:389 as
> postmap: dict_ldap_connect: Cached connection handle for LDAP source domains
> postmap: dict_ldap_lookup: domains: Searching with filter (mailacceptinggeneralid=wonderland.com)

Clearly not using the filter you defined, so your settings are not the
correct version above.

If you are having to guess randomly between documented syntax and a
main.cf/external-file chimera, you should read the documentation until
it becomes clear. Once you *know* you have the right settings, and they
still don't work, report clear evidence here.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomopostfix.org?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.