Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Postfix + Dovecot daemon combo setup on a mail server (let's call it server M), that supports virtual domains and user look-ups to a LDAP server (let's call it server D). Right now, I've set-up Postfix to deliver mail to a specially created local user on server M to hold mail for all the virtual users, hence the mail directory for a user is in the format of /home/vmail/<domain>/<user id>.

In that case, I've also set-up Dovecot to fetch the mail from the user's directory:

userdb static {
    args = uid=501 gid=501 home=/home/vmail/%d/%n
}

The password lookup is:

passdb ldap {
    args = /etc/dovecot-ldap.conf
}

whereby the config file referred to contains the following:

hosts = server M
base = dc=www,dc=example,dc=com
ldap_version = 3
auth_bind = yes
pass_filter = (mail=%u)

Now, this configuration works (the LDAP object class implemented inetOrgPerson), but when I added posixAccount object class to a user record in server M, Dovecot stopped recognising the user in the format user@domain.

Checking the mail logs show that Dovecot somehow recognises the user as "user" instead of "user@domain", and thus caused my userdb directive to return /home/vmail//user instead of /home/vmail/domain/user

How should I change my configuration to get Dovecot to recognise the user as "user@domain" again?

share|improve this question

2 Answers 2

It seems to me lie the passdb passwd-file { ... } block or maybe a similar userdb block is having precedence over the passdb ldap block

share|improve this answer
up vote 0 down vote accepted

Found the answer!

Basically, to get Dovecot to recognise the user as "user@domain" after the authentication done by adding:

pass_attrs = mail=user

This causes Dovecot to recognise the user from the mail attribute in LDAP. Since the format of the field is "user@domain", it causes Dovecot to accept the user as "user@domain"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.