[Dovecot] %d not recognized with LDAP
I saw the recent threads but didn't help for me.
Here's my configuration:
The domain isn't getting expanded as per logs: Jan 4 08:06:40 vds5 dovecot: [ID 107833 mail.info] IMAP(admin): maildir: data=/var/mail/apps//admin/Maildir
# 20080102: /usr/local/dovecot/etc/dovecot.conf listen: *:143 ssl_disable: yes disable_plaintext_auth: no login_dir: /usr/local/dovecot/var/run/dovecot/login login_executable: /usr/local/dovecot/libexec/dovecot/imap-login login_log_format_elements: user=<%n@%d> method=%m rip=%r lip=%l %c login_max_connections: 64 max_mail_processes: 128 mail_location: maildir:/var/mail/apps/%d/%n/Maildir mail_debug: yes auth default: passdb: driver: ldap args: /usr/local/dovecot/etc/dovecot-ldap.conf userdb: driver: static args: uid=vmail gid=vmail home=/var/mail/apps/%d/%n
Here's the relevant LDAP configuration: auth_bind = yes pass_attrs = uid=user pass_filter = uid=%n
I tried setting the mail_location to: maildir:~/Maildir and explicitly specifying the full path, but still the Maildir is getting created with out the %d. Of course, the user is logging in with "admin@domain.com".
Any ideas?
On Fri, 2008-01-04 at 08:12 -0800, Anil wrote:
pass_attrs = uid=user pass_filter = uid=%n
uid=user makes Dovecot change the full username to uid's value, which means it drops the domain. You could probably just leave pass_attrs empty. I don't remember if LDAP lookups are case-insensitive though. If they are, use %Ln and %Ld in your home and mail_location to avoid getting "user" and "User" and "uSer" directories.
LDAP will return whatever the LDAP schema is defined as (for the case), which is "uid".
I took out the pass_attrs, but didn't appear to be working.
I then added: pass_attrs = uid
then, it was able to find the domain!
http://wiki.dovecot.org/AuthDatabase/LDAP is a bit confusing in the documentation of pass_attrs.
IMO, pass_attrs_map is a better name, since its used for mapping attributes from LDAP attributes to Dovecot names.
But, if "pass_attrs = uid" is working, what exactly is getting mapped to what?
On Jan 4, 2008 4:04 PM, Timo Sirainen tss@iki.fi wrote:
On Fri, 2008-01-04 at 08:12 -0800, Anil wrote:
pass_attrs = uid=user pass_filter = uid=%n
uid=user makes Dovecot change the full username to uid's value, which means it drops the domain. You could probably just leave pass_attrs empty. I don't remember if LDAP lookups are case-insensitive though. If they are, use %Ln and %Ld in your home and mail_location to avoid getting "user" and "User" and "uSer" directories.
Anil wrote:
LDAP will return whatever the LDAP schema is defined as (for the case), which is "uid".
I took out the pass_attrs, but didn't appear to be working.
I then added: pass_attrs = uid
then, it was able to find the domain!
http://wiki.dovecot.org/AuthDatabase/LDAP is a bit confusing in the documentation of pass_attrs.
IMO, pass_attrs_map is a better name, since its used for mapping attributes from LDAP attributes to Dovecot names.
But, if "pass_attrs = uid" is working, what exactly is getting mapped to what?
I _think_ i was having a similar problem to you. I was trying to login with user@domain and in the ldap directory i have the ou=people with uid=user. When i had
pass_attrs = uid
in the logs i saw
Jan 4 16:17:45 slayer dovecot: auth(default): master out: USER^I2^Iiain^Igid=XXX^Ihome=/home/iain^Iuid=XXXX Jan 4 16:17:45 slayer dovecot: imap-login: Login: user=<iain>, method=PLAIN, rip=X.X.X.X, lip=X.X.X.X, TLS Jan 4 16:17:45 slayer dovecot: IMAP(iain): Ambiguous mail location setting, don't know what to do with it: /opt/mail//iain/ (try prefixing it with mbox: or maildir:)
I changed this to be
pass_attrs = uid=user@domain
And now i see
Jan 4 17:11:11 slayer dovecot: auth(default): master out: USER^I1^Iiain@shihad.org^Igid=XXX^Ihome=/home/iain^Iuid=XXXX Jan 4 17:11:11 slayer dovecot: imap-login: Login: user=iain@shihad.org, method=PLAIN, rip=X.X.X.X, lip=X.X.X.X, TLS Jan 4 17:11:11 slayer dovecot: IMAP(iain@shihad.org): Ambiguous mail location setting, don't know what to do with it: /opt/mail/shihad.org/iain/ (try prefixing it with mbox: or maildir:)
Please note that the "ambiguous mail location setting" is because i was daft enough to have
mail_location: /opt/mail/%d/%n/
And changing this to
mail_location: maildir:/opt/mail/%d/%n/
sorted the problem :) Also IP's etc change to protect the guilty ;)
So basically my ldap settings are now
#user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid user_filter = (&(objectClass=posixAccount)(uid=%n)) pass_attrs = uid=user@domain,userPassword=password pass_filter = (&(objectClass=posixAccount)(uid=%n))
and this seems to return the information i want
So perhaps you could try
pass_attrs = uid=user@domain
Cheers
Iain
On Jan 4, 2008 4:04 PM, Timo Sirainen tss@iki.fi wrote:
On Fri, 2008-01-04 at 08:12 -0800, Anil wrote:
pass_attrs = uid=user pass_filter = uid=%n
uid=user makes Dovecot change the full username to uid's value, which means it drops the domain. You could probably just leave pass_attrs empty. I don't remember if LDAP lookups are case-insensitive though. If they are, use %Ln and %Ld in your home and mail_location to avoid getting "user" and "User" and "uSer" directories.
On Fri, 2008-01-04 at 16:39 -0800, Anil wrote:
LDAP will return whatever the LDAP schema is defined as (for the case), which is "uid".
I took out the pass_attrs, but didn't appear to be working.
Empty pass_attrs actually means "return all fields from LDAP". I had forgotten this, and maybe I should just remove that feature.
But, if "pass_attrs = uid" is working, what exactly is getting mapped to what?
uid is mapped to uid, so practically everything is being ignored. The important point being that "user" isn't being overridden by anything.
Here's the relevant LDAP configuration: auth_bind = yes pass_attrs = uid=user pass_filter = uid=%n
I tried setting the mail_location to: maildir:~/Maildir and explicitly specifying the full path, but still the Maildir is getting created with out the %d. Of course, the user is logging in with "admin@domain.com".
Any ideas?
I'll take a stab at it... meaning I could be totally off-base...
pass_attrs = uid=user
my LDAP attributes look like
uid: jhorner mail: jhorner@arinbe.com
so my pass_attrs are (among others)
pass_attrs = mail=user
participants (4)
-
Anil
-
Iain Conochie
-
Jim Horner
-
Timo Sirainen