Multiple user attributes in LDAP userdb query strings

BINOTTO Luis SIDOR lbinotto at sidor.com
Tue Oct 21 19:26:58 UTC 2014


 

Hello list, I have an issue with dovecot and Ldap... Any help will be
grateful...
 
I have my virtual users stored in an Active Directory database. I am
using 2 attributes in AD to locate the user account: mail (their primary
email address) and proxyAddresses (a multivalue attribute containing
their mail aliases). I also control the mount point in which the mail is
located with another attribute in AD, in this case I used "pager". 
  
I have dovecot 1.2.15 and there are no immediate plans to upgrade it.
 
I configured Dovecot's deliver process in order to integrate sieve
capability. I have configured userdb ldap and passdb ldap in Dovecot and
have set up master and client sockets. I am using maildir format for
directory layout.
 
The problem is to set the variables home and mail that will define the
mail location. The format must be like this: 
home: /Mailboxes/<mount point>/<user login>/
mail: /Mailboxes/<mount point>/<user login>/Maildir
 
So, for a particular user (Login: user1, smtp: user1 at domain1.com, alias
smtp: user1_alias at domain1.com) the variables will be:
home: /Mailboxes/AdmUsers/user1/
mail: /Mailboxes/AdmUsers/user1/Maildir
 
Active Directory has the values in: mail:(user1 at domain1.com),
proxyAddresses:(user1_alias at domain1.com), sAMAaccountName(user1).
 
I have defined home and mail in dovecot-ldap.conf. 
 
# User attributes are given in LDAP-name=dovecot-internal-name list. The
# internal names are:
#   uid - System UID
#   gid - System GID
#   home - Home directory
#   mail - Mail location
#
# There are also other special fields which can be returned, see
# http://wiki.dovecot.org/UserDatabase/ExtraFields
user_attrs = pager=home=/mailboxes/%$/%u,mobile=quota_rule=*:storage=%$M
 
If the mail is sent to the Principal SMTP (user1 at domain1.com) in which
the user part (%u) is the same as sAMAccountName, it works. The variable
home is set correctly (home: /Mailboxes/AdmUsers/user1/). The problem is
when the mail is sent to the smtp alias, in which the variable home is
set incorrectly (home: /Mailboxes/AdmUsers/user1_alias/).
 
There is a way to set two values to user_attrs?, in this case I would
need to set pager and sAMAccountName (instead of %u), to it.
 
Thanking you in anticipation...
 
 
Attached is the out of dovecot -n
 
# 1.2.15: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-5-686 i686 Debian 6.0.7
log_path: /var/log/dovecot.log
protocols: imap imaps pop3 pop3s
disable_plaintext_auth: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login
login_executable(pop3): /usr/lib/dovecot/pop3-login
mail_uid: 16343
mail_gid: 16343
mail_location: maildir:~/Maildir
mail_debug: yes
mbox_write_locks: fcntl dotlock
mail_executable(default): /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/pop3
mail_plugins(default): autocreate deleted_to_trash quota imap_quota
expire
mail_plugins(imap): autocreate deleted_to_trash quota imap_quota expire
mail_plugins(pop3): quota expire
mail_plugin_dir(default): /usr/lib/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3
imap_client_workarounds(default): delay-newmail outlook-idle
netscape-eoh
imap_client_workarounds(imap): delay-newmail outlook-idle netscape-eoh
imap_client_workarounds(pop3):
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
lda:
  postmaster_address: postmaster at domain1.com
  mail_plugins: quota expire
  log_path: /var/log/dovecot.log
auth default:
  mechanisms: gssapi gss-spnego login ntlm plain
  username_format: %Ln
  use_winbind: yes
  passdb:
    driver: pam
  userdb:
    driver: ldap
    args: /etc/dovecot/dovecot-ldap.conf
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 432
      user: postfix
      group: postfix
    master:
      path: /var/run/dovecot/auth-master
      mode: 384
      user: vmail
plugin:
  autocreate: Deleted Items
  autocreate: Sent Items
  autosubscribe: Deleted Items
  autosubscribe: Sent Items
  deleted_to_trash_folder: Sent Items
  quota: maildir:User quota
  quota_rule: *:storage=100M
  quota_rule2: Deleted Items:ignore
  quota_warning: storage=80%% /etc/dovecot/scripts/quota-warning.sh 80
  quota_warning2: storage=90%% /etc/dovecot/scripts/quota-warning.sh 90
  quota_warning3: storage=99%% /etc/dovecot/scripts/quota-exceeded.sh
100
  expire: "Deleted Items" 1 "Deleted Items/*" 1
  expire_dict: proxy::expire
dict:
  expire: pgsql:/etc/dovecot/dovecot-dict-expire.conf
 


" Notificacion Automatica:
Este mensaje y cualquier archivo que se adjunte contiene informacion privilegiada y confidencial. Es para uso exclusivo del destinatario. Si usted ha recibido esta comunicacion por error, por favor avisenos inmediatamente.
Automatic notification: 
This e-mail and any file transmitted with it are confidential and may be legally privileged. It is intended solely for the addressee and may not be disclosed to or used by anyone other than the addressee. If you have received this e-mail by mistake , please advise the sender immediately"


More information about the dovecot mailing list