I am trying to setup a mail server on Debian Jessie and have come across a problem that's doing my head in.
When trying to access OpenLDAP through saslauthd via the command
testsaslauthd -u user1 -p user1pw -f /var/spool/postfix/var/run/saslauthd/mux
I get the following error in auth.log
Apr 17 10:36:50 debmailserv saslauthd[1661]: user ldap_search_st() failed: Bad search filter
Apr 17 10:36:50 debmailserv saslauthd[1661]: Retrying authentication
Apr 17 10:36:50 debmailserv saslauthd[1661]: user ldap_search_st() failed: Bad search filter
Apr 17 10:36:50 debmailserv saslauthd[1661]: Authentication failed for user1: Retry condition (ldap server connection reset or broken) (-3)
Apr 17 10:36:50 debmailserv saslauthd[1661]: do_auth : auth failure: [user=user1] [service=imap] [realm=] [mech=ldap] [reason=Unknown]
But if i use the same search filter used in saslauthd.conf using the following ldapsearch it works fine.
ldapsearch -D "uid=saslauthd,ou=services,dc=example,dc=com" -w saslauthdpw \
-p 389 -h 127.0.0.1 -b "ou=people,dc=example,dc=com" \
-s sub "(&(uid=user1)(mailEnabled=TRUE))"
My saslauthd.conf looks like this
# Server
ldap_servers: ldap://127.0.0.1/
# Identity
ldap_bind_dn: uid=saslauthd,ou=services,dc=example,dc=com
ldap_bind_pw: saslauthdpw
ldap_auth_method: bind
# Connection
ldap_version: 3
ldap_timeout: 10
ldap_time_limit: 10
ldap_referrals: yes
# Search
ldap_scope: sub
ldap_search_base: ou=people,dc=example,dc=com
ldap_filter: (&(uid=%u)(mailEnabled=TRUE))
# SSL
ldap_ssl: no
ldap_starttls: no
If I comment out the ldap_filter then the testsaslauth works fine.
Any pointers will be greatly appreciated!