[Dovecot] How can i override mail_location?
Hi, all.
I use dovecot-1.1.11 with OpenLDAP backend. but i found the mail_location is not correct. How can i override mail_location setting in dovecot.conf?
LDAP user data and dovecot config are attached below. in dovecot config, mail_location is:
mail_location = maildir:/%Lh/%Ld/%Ln/:INDEX=/%Lh/%Ld/%Ln/
but the correct maildir should be 'homeDirectory' + 'mailMessageStore':
maildir:/home/vmail/a.cn/w/ww/www/
LDAP user:
dn: mail=www@a.cn,ou=Users,domainName=a.cn,o=domains,dc=iredmail,dc=org objectClass: inetOrgPerson objectClass: mailUser objectClass: top cn: www sn: www uid: www mail: www@a.cn accountStatus: active homeDirectory: /home/vmail mailQuota: 104857600 userPassword: {SSHA}crkYO5tg8KRkOY7W3bRgjtLQ+79U4NgG enabledService: mail enabledService: smtp enabledService: pop3 enabledService: imap enabledService: deliver mailMessageStore: a.cn/w/ww/www/
Dovecot ldap config file:
user_attrs = homeDirectory=home,=sieve_dir=/home/vmail/sieve/%Ld/%Ln/,mailMessageStore=maildir:mail,mailQuota=quota_rule=*:bytes=%$
Dovecot main config file:
# dovecot -n # 1.1.11: /etc/dovecot.conf # OS: Linux 2.6.18-128.el5 x86_64 Red Hat Enterprise Linux Server release 5.3 (Tikanga) log_path: /var/log/dovecot.log protocols: pop3 pop3s imap imaps listen: * ssl_cert_file: /etc/pki/iRedMail/SSL_Cert.pem ssl_key_file: /etc/pki/iRedMail/SSL_Key.pem login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap-login login_executable(imap): /usr/libexec/dovecot/imap-login login_executable(pop3): /usr/libexec/dovecot/pop3-login mail_uid: 500 mail_gid: 500 mail_location: maildir:/%Lh/%Ld/%Ln/:INDEX=/%Lh/%Ld/%Ln/ mail_debug: yes mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec/dovecot/imap mail_executable(pop3): /usr/libexec/dovecot/pop3 mail_plugins(default): quota imap_quota zlib mail_plugins(imap): quota imap_quota zlib mail_plugins(pop3): quota zlib mail_plugin_dir(default): /usr/lib64/dovecot/imap mail_plugin_dir(imap): /usr/lib64/dovecot/imap mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3 pop3_client_workarounds(default): pop3_client_workarounds(imap): pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh auth default: mechanisms: plain login default_realm: a.cn user: vmail passdb: driver: ldap args: /etc/dovecot-ldap.conf userdb: driver: ldap args: /etc/dovecot-ldap.conf socket: type: listen client: path: /var/spool/postfix/dovecot-auth mode: 438 user: postfix group: postfix master: path: /var/run/dovecot/auth-master mode: 438 user: vmail group: vmail plugin: quota: maildir quota_rule: *:storage=10M expire: Trash 7 Trash/* 7 Junk 30 expire_dict: proxy::expire auth_socket_path: /var/run/dovecot/auth-master sieve: /home/vmail/sieve/%Ld/%Ln/.dovecot.sieve dict: expire: db:/var/lib/dovecot/expire/expire.db
-- Best regards.
Zhang Huangbin
- Open Source Mail Server Solution for RHEL/CentOS 5.x: http://code.google.com/p/iredmail/
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Fri, 13 Mar 2009, Zhang Huangbin wrote:
I use dovecot-1.1.11 with OpenLDAP backend. but i found the mail_location is not correct. How can i override mail_location setting in dovecot.conf?
homeDirectory: /home/vmail mailMessageStore: a.cn/w/ww/www/ user_attrs = homeDirectory=home,=sieve_dir=/home/vmail/sieve/%Ld/%Ln/,mailMessageStore=maildir:mail,mailQuota=quota_rule=*:bytes=%$
"mailMessageStore=maildir:mail"
this looks odd. Try:
mailMessageStore=mail
Dovecot should detect Maildir vs. mbox itself by existance of cur subdir. But if relative paths work?
As far as I know Dovecot cannot concat strings retrieved from a backend. A SQL-backend itself can do it and will pass the result back, but LDAP cannot.
Depending on your user management it should be easier to add another LDAP attribute, say "mailDovecotLocation" with the prebuilt string, so you can add :INDEX, too.
Bye,
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iQEVAwUBSbpzanWSIuGy1ktrAQJWrgf/RK1FLtRil8kWqpax+RKk9goSTkJglapx V91bAaUSDnVSIz1nlDJNkYmhBeFkz7yLllRlpar6+QSZS2SjBfIjJMaRIdJdBtM3 zYXlXimyFoYkoptd0sBXpJKz6e79CE1urJSMUht7JY8esxsFtevEsYgOcBzHxOgV zW0OuB8oDDbZwgRv7/sraLY7enDx1cxFf0zq1WcCyexHxr+hZgyZEC+0s6jBSJMM QHDixP9yNqrfC2n1MdgNmVZFyWq//rsQS8w7YHc0gfN5XNSsLtCe5nkHWGmx5HMF Zi41LMYbzGvVaZ88tAj60guZzBSDhkHOCAaVEalXtBwt6gzbgwYthQ== =b1Fu -----END PGP SIGNATURE-----
Thanks Steffen. :)
Steffen Kaiser wrote:
"mailMessageStore=maildir:mail"
this looks odd. Try:
mailMessageStore=mail
If i use absolute path in mailMessageStore, the maildir path is correct with 'mailMessageStore=mail', but deliver doesn't create the directory recursively:
deliver(www@a.cn): Mar 14 09:42:33 Info: auth input: home=/home/vmail deliver(www@a.cn): Mar 14 09:42:33 Info: auth input: quota_rule=*:bytes=104857600 deliver(www@a.cn): Mar 14 09:42:33 Info: auth input: mail=/home/vmail/a.cn/w/ww/www/ deliver(www@a.cn): Mar 14 09:42:33 Info: auth input: sieve_dir=/home/vmail/sieve/a.cn/www/ deliver(www@a.cn): Mar 14 09:42:33 Info: Quota root: name= backend=maildir args= deliver(www@a.cn): Mar 14 09:42:33 Info: Quota rule: root= mailbox=* bytes=104857600 messages=0 deliver(www@a.cn): Mar 14 09:42:33 Info: maildir autodetect: stat(/home/vmail/a.cn/w/ww/www//cur) failed: No such file or directory deliver(www@a.cn): Mar 14 09:42:33 Info: mbox autodetect: data=/home/vmail/a.cn/w/ww/www/ deliver(www@a.cn): Mar 14 09:42:33 Info: mbox autodetect: INBOX file: stat(/home/vmail/a.cn/w/ww/www/) failed: No such file or directory deliver(www@a.cn): Mar 14 09:42:33 Info: mbox autodetect: has .imap/: stat(/home/vmail/a.cn/w/ww/www//.imap) failed: No such file or directory deliver(www@a.cn): Mar 14 09:42:33 Info: mbox autodetect: has inbox: stat(/home/vmail/a.cn/w/ww/www//inbox) failed: No such file or directory deliver(www@a.cn): Mar 14 09:42:33 Info: mbox autodetect: has mbox: stat(/home/vmail/a.cn/w/ww/www//mbox) failed: No such file or directory deliver(www@a.cn): Mar 14 09:42:33 Error: mail_location: Ambiguous mail location setting, don't know what to do with it: /home/vmail/a.cn/w/ww/www/ (try prefixing it with mbox: or maildir:) deliver(www@a.cn): Mar 14 09:42:33 Fatal: Namespace initialization failed
How can i solve this?
-- Best regards.
Zhang Huangbin
- Open Source Mail Server Solution for RHEL/CentOS 5.x: http://code.google.com/p/iredmail/
On Fri, 2009-03-13 at 22:17 +0800, Zhang Huangbin wrote:
homeDirectory: /home/vmail
Is it always /home/vmail?
user_attrs = homeDirectory=home,=sieve_dir=/home/vmail/sieve/%Ld/%Ln/,mailMessageStore=maildir:mail,mailQuota=quota_rule=*:bytes=%$
Maybe mailMessageStore=maildir:/home/vmail/%$
Also home directory should be different for each user, so you most likely don't want to set homeDirectory=home.
Timo Sirainen wrote:
On Fri, 2009-03-13 at 22:17 +0800, Zhang Huangbin wrote:
homeDirectory: /home/vmail
Is it always /home/vmail?
Yes, homeDirectory is always /home/vmail.
user_attrs = homeDirectory=home,=sieve_dir=/home/vmail/sieve/%Ld/%Ln/,mailMessageStore=maildir:mail,mailQuota=quota_rule=*:bytes=%$
Maybe mailMessageStore=maildir:/home/vmail/%$
I set it like this:
user_attrs = homeDirectory=home,=sieve_dir=/home/vmail/sieve/%Ld/%Ln/,mailMessageStore=maildir:/home/vmail/%$,mailQuota=quota_rule=*:bytes=%$
It find the correct path, but deliver to path setting in mail_location:
deliver(www@a.cn): Mar 14 09:49:31 Info: auth input: home=/home/vmail deliver(www@a.cn): Mar 14 09:49:31 Info: auth input: quota_rule=*:bytes=104857600 deliver(www@a.cn): Mar 14 09:49:31 Info: auth input: maildir:/home/vmail/%$=/home/vmail/a.cn/w/ww/www/ deliver(www@a.cn): Mar 14 09:49:31 Info: auth input: sieve_dir=/home/vmail/sieve/a.cn/www/ deliver(www@a.cn): Mar 14 09:49:31 Info: Quota root: name= backend=maildir args= deliver(www@a.cn): Mar 14 09:49:31 Info: Quota rule: root= mailbox=* bytes=104857600 messages=0 deliver(www@a.cn): Mar 14 09:49:31 Info: maildir: data=//home/vmail/a.cn/www/:INDEX=//home/vmail/a.cn/www/ deliver(www@a.cn): Mar 14 09:49:31 Info: maildir++: root=//home/vmail/a.cn/www, index=, control=, inbox=//home/vmail/a.cn/www deliver(www@a.cn): Mar 14 09:49:31 Info: cmusieve: Using sieve path: /home/vmail/sieve/a.cn/www/.dovecot.sieve deliver(www@a.cn): Mar 14 09:49:31 Info: cmusieve: Executing script /home/vmail/sieve/a.cn/www/.dovecot.sievec deliver(www@a.cn): Mar 14 09:49:31 Info: msgid=49BB0D17.8070101@a.cn: saved mail to Junk
setting in dovecot.conf:
mail_location = maildir:/%Lh/%Ld/%Ln/:INDEX=/%Lh/%Ld/%Ln/
Also home directory should be different for each user, so you most likely don't want to set homeDirectory=home.
I will try to change this, thanks Timo :)
-- Best regards.
Zhang Huangbin
- Open Source Mail Server Solution for RHEL/CentOS 5.x: http://code.google.com/p/iredmail/
Timo Sirainen wrote:
On Fri, 2009-03-13 at 22:17 +0800, Zhang Huangbin wrote:
homeDirectory: /home/vmail
Is it always /home/vmail?
user_attrs = homeDirectory=home,=sieve_dir=/home/vmail/sieve/%Ld/%Ln/,mailMessageStore=maildir:mail,mailQuota=quota_rule=*:bytes=%$
Maybe mailMessageStore=maildir:/home/vmail/%$
Also home directory should be different for each user, so you most likely don't want to set homeDirectory=home.
hi, Timo.
Any suggestion about these LDAP attributes:
homeDirectory mailMessageStore
Both are absolute path? like /home/vmail/a.cn/w/ww/www/ or what?
Need to add more attributes? How about mailbox INDEX?
-- Best regards.
Zhang Huangbin
- Open Source Mail Server Solution for RHEL/CentOS 5.x: http://code.google.com/p/iredmail/
participants (3)
-
Steffen Kaiser
-
Timo Sirainen
-
Zhang Huangbin