[Dovecot] Problem using LDAP generating Userhome

Thorsten Habich thorsten.habich at telefonica.de
Tue Nov 24 16:03:05 EET 2009


Hi there,
I'm trying to let dovecot generate the userhome directory dynamicly via 
user_attr.
If "uid" is returned from LDAP before "mail" everything is fine, but if 
"mail" is delivered
before "uid" the localpart of the mailaddress is used in home path.

e.g.:
Mail: testuser at domain.de
UID : test123

sometimes home is /mail/store/testuser and sometimes /mail/store/test123 
depending
on the order the ldap server replies.

I'm currently using version 1.2.7 of dovecot in testing and 1.1.6 in 
production. Both have
the same "bug".

Mails are stored on nfs, indexes are stored local.

This is my dovecot-ldap.conf configuration:

pass_filter = 
(|(&(objectClass=mailRecipient)(mail=%u))(&(objectClass=mailRecipient)(mailalternateAddress=%u))(&(objectClass=mailRecipient)(uid=%n)))
pass_attrs = 
uid=user,userPassword=password,mailMessageStore=home=%$/telefonica.de/%Ln,mailFilterStore=sieve_dir=%$/telefonica.de/%Ln
user_filter = 
(|(&(objectClass=mailRecipient)(mail=%u))(&(objectClass=mailRecipient)(mailalternateAddress=%u))(&(objectClass=mailRecipient)(uid=%n)))
user_attrs = 
uid=user,mailMessageStore=home=%$/telefonica.de/%Ln,mailFilterStore=sieve_dir=%$/telefonica.de/%Ln

The filter needs to be that way, because you need to be able to 
authenticate by uid or mailaddress.



And the dovecot -n output:

# 1.2.7: /etc/dovecot.conf
# OS: Linux 2.6.18-92.1.13.el5 x86_64 Red Hat Enterprise Linux Server 
release 5.2 (Tikanga)
base_dir: /var/run/dovecot/
log_path: /var/log/dovecot.log
info_log_path: /var/log/dovecot-info.log
log_timestamp: %Y-%m-%d %H:%M:%S
syslog_facility: local1
protocols: imap managesieve
listen(default): *:143
listen(imap): *:143
listen(managesieve): *, [::]
ssl: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/libexec/dovecot/imap-login
login_executable(imap): /usr/libexec/dovecot/imap-login
login_executable(managesieve): /usr/libexec/dovecot/managesieve-login
login_greeting: IMAP mail server ready.
max_mail_processes: 200
mail_max_userip_connections(default): 50
mail_max_userip_connections(imap): 50
mail_max_userip_connections(managesieve): 10
verbose_proctitle: yes
first_valid_uid: 1
mail_privileged_group: vmail
mail_uid: 500
mail_gid: 500
mail_location: maildir:~/:INDEX=/mail/index/%Ln/
mailbox_idle_check_interval: 10
mail_debug: yes
mmap_disable: yes
mail_nfs_storage: yes
mail_nfs_index: yes
lock_method: flock
mbox_write_locks: dotlock fcntl
mail_executable(default): /usr/libexec/dovecot/imap
mail_executable(imap): /usr/libexec/dovecot/imap
mail_executable(managesieve): /usr/libexec/dovecot/managesieve
mail_plugins(default): expire autocreate
mail_plugins(imap): expire autocreate
mail_plugins(managesieve):
mail_plugin_dir(default): /usr/lib64/dovecot/imap
mail_plugin_dir(imap): /usr/lib64/dovecot/imap
mail_plugin_dir(managesieve): /usr/lib64/dovecot/managesieve
imap_client_workarounds(default): delay-newmail outlook-idle 
netscape-eoh tb-extra-mailbox-sep
imap_client_workarounds(imap): delay-newmail outlook-idle netscape-eoh 
tb-extra-mailbox-sep
imap_client_workarounds(managesieve):
managesieve_implementation_string(default): dovecot
managesieve_implementation_string(imap): dovecot
managesieve_implementation_string(managesieve): Cyrus timsieved v2.2.13
namespace:
  type: private
  separator: .
  prefix: INBOX.
  inbox: yes
  list: yes
  subscriptions: yes
namespace:
  type: public
  separator: .
  prefix: Public.
  location: maildir:/mail/store/a.backend/shared
  list: yes
  subscriptions: yes
lda:
  hostname: xxx
  mail_plugins: sieve expire
  mail_plugin_dir: /usr/lib64/dovecot/lda
  auth_socket_path: /var/run/dovecot/auth-master
  postmaster_address: xxx at telefonica.de
  sieve_global_dir: /mail/store/backend/sieve/
auth default:
  mechanisms: plain login
  username_format: %Lu
  verbose: yes
  debug: yes
  process_size: 512
  passdb:
    driver: ldap
    args: /etc/dovecot/dovecot-ldap.conf
  userdb:
    driver: ldap
    args: /etc/dovecot/dovecot-ldap.conf
  socket:
    type: listen
    client:
      path: /var/run/dovecot/auth-client
      mode: 432
      user: postfix
      group: vmail
    master:
      path: /var/run/dovecot/auth-master
      mode: 384
      user: vmail
      group: vmail
plugin:
  sieve: ~/%Ln.sieve
  sieve_dir: ~/sieve
  sieve_storage: ~/
  expire: Trash 7 Trash/* 7 Junk 30
  expire_dict: proxy::expire
  autocreate: INBOX.Trash
  autocreate2: INBOX.Drafts
  autocreate3: INBOX.Sent
  autosubscribe: INBOX.Trash
  autosubscribe2: INBOX.Drafts
  autosubscribe3: INBOX.Sent
dict:
  expire: db:/var/lib/dovecot/expire.db


Thanks in advanced.


Thorsten Habich




More information about the dovecot mailing list