[Dovecot] Perfect LDAP tree

Evgeny Basov
2013-05-28T08:21:44Z

Hello everybody and Timo.

I have the next problem.

With LDAP tree like

ou=mail
|
- dc=example1.com,ou=Mail
  |
  - mail=box1 at example1.com,dc=example1.com,ou=Mail
  |
  - mail=box2 at example1.com,dc=example1.com,ou=Mail
?
|
- dc=example2.com,ou=Mail
  |
  - mail=box1 at example2.com,dc=example2.com,ou=Mail
  |
  - mail=box2 at example2.com,dc=example2.com,ou=Mail
?


and settings in dovecot configuration files

auth_bind = yes
auth_bind_userdn = mail=%u,dc=%d,ou=mail
base = ou=mail
user_attrs = \
    =home=/var/vmail/%Ld/%Ln, \
    =quota_rule=*:storage=%{ldap:mailQuota}M
user_filter = (&(objectClass=mailUser)(accountStatus=active)(mail=%u))
pass_attrs = \
    =user=%{ldap:mail}, \
    =proxy_maybe=yes, \
    =host=%{ldap:mailHost}, \
    =userdb_home=/var/vmail/%Ld/%Ln, \
    =userdb_quota_rule=*:storage=%{ldap:mailQuota}M
pass_filter = (&(objectClass=mailUser)(accountStatus=active)(mail=%u))
iterate_attrs = mail=user
iterate_filter = (&(objectClass=mailUser)(accountStatus=active))

all works fine.

But my soul of perfectionist do not like this configuration because in
every mailbox record duplicated information about domain:

mail=box1 at example2.com and dc=example2.com


I want to set next LDAP tree

ou=mail
|
- dc=example1.com,ou=Mail
  |
  - mail=box1,dc=example1.com,ou=Mail
  |
  - mail=box2,dc=example1.com,ou=Mail
?
|
- dc=example2.com,ou=Mail
  |
  - mail=box1,dc=example2.com,ou=Mail
  |
  - mail=box2,dc=example2.com,ou=Mail
?

but I don't understand how to limit query to box1 at example1.com in
dc=example1.com,ou=mail without using   base=dc=%d,ou=Clients,o=m  and
how to get working iterate query for all boxes to get list

box1 at example1.com
box2 at example1.com
box1 at example2.com
box2 at example2.com

in some command like doveadm quota recalc -A.

Is it possible? How to take it?