LDAP¶
Note
A director proxy doesn’t need userdb configuration (unlike backends).
There are two ways to do LDAP authentication:
Both of these have their own advantages and disadvantages.
LDAP as userdb and other common LDAP query settings.
Configuration common to LDAP passdb and userdb¶
Connecting¶
There are two alternative ways to specify what LDAP server(s) to connect to:
hosts
: A space separated list of LDAP hosts to connect to. You can also use host:port syntax to use different ports.uris
: A space separated list of LDAP URIs to connect to. This isn’t supported by all LDAP libraries. The URIs are in syntaxprotocol://host:port
. For exampleldap://localhost or ldaps://secure.domain.org
If multiple LDAP servers are specified, it’s decided by the LDAP library how the server connections are handled. Typically the first working server is used, and it’s never disconnected from. So there is no load balancing or automatic reconnecting to the “primary” server.
SSL/TLS¶
You can enable TLS in two alternative ways:
Connect to ldaps port (636) by using “ldaps” protocol, e.g.
uris = ldaps://secure.domain.org
Connect to ldap port (389) and use STARTTLS command. Use
tls=yes
to enable this.
See the tls_*
settings in dovecot-ldap-example.conf
for how to
configure TLS. (I think they apply to ldaps too?)
SASL binds¶
It’s possible to use SASL binds instead of the regular plaintext binds if your
LDAP library supports them. See the sasl_*
settings in
dovecot-ldap-example.conf
.
Note
SASL binds are currently incompatible with authentication binds.
Active Directory¶
When connecting to AD, you may need to use port 3268. Then again, not all LDAP fields are available in port 3268. Use whatever works. https://technet.microsoft.com/en-us/library/cc978012.aspx
A director proxy doesn’t need userdb configuration (unlike backends).
passdb {
args = /etc/dovecot/dovecot-ldap.conf.ext
driver = ldap
}
This enables LDAP to be used as passdb.
The included dovecot-ldap-director.conf.ext
can be used as template for the
/etc/dovecot/dovecot-ldap.conf.ext
. Its most important settings are:
hosts = ldap.example.com
dn = cn=admin,dc=example,dc=com
dnpass = secret
base = dc=example,dc=com
Configure how the LDAP server is reached. Active directory allows binding with username@domain.
auth_bind_userdn = %u
auth_bind = yes
Use LDAP authentication binding for verifying users’ passwords.
pass_attrs =
=proxy=y,
=proxy_timeout=10,
=user=%{ldap:mailRoutingAddress},
=password=%{ldap:userPassword}
Normalize the username to exactly the mailRoutingAddress field’s value
regardless of how the pass_filter
found the user.
pass_filter = (mailRoutingAddress=%u)
iterate_attrs = mailRoutingAddress=user
iterate_filter = (objectClass= messageStoreRecipient)
How to iterate through all the valid usernames.