[Dovecot] Postfix, mailbox_command, Dovecot deliver, LDAP and mail_location
I am trying to tell Dovecot deliver to use $mail_location as the location to store mail for system users. From the docs I've read http://wiki.dovecot.org/MailLocation I believe this is possible, but mail to my system users always gets delivered to their /home/<USERNAME> homedirectory.
Here's what I've done so far:
# Postfix main.cf mailbox_command = /usr/lib/dovecot/deliver
# Dovecot # dovecot-ldap.conf user_attrs = mailHomeDirectory=home,mailUidNumber=uid,mailGidNumber=gid,mailQuota=quota=maildir:storage,mail=mailHomeDirectory
Above you can see, I query for $mail as documented in http://wiki.dovecot.org/UserDatabase.
# dovecot.conf # dovecot -n # 1.0.5: /etc/dovecot/dovecot.conf log_timestamp: %Y-%m-%d %H:%M:%S protocols: imap imaps pop3 pop3s ssl_cert_file: /etc/ssl/mail.state-of-mind.de.crt ssl_key_file: /etc/ssl/private/mail.state-of-mind.de.key 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 login_greeting_capability(default): yes login_greeting_capability(imap): yes login_greeting_capability(pop3): no mail_extra_groups: mail mail_location: maildir:~ mail_debug: yes maildir_copy_with_hardlinks: yes mail_executable(default): /usr/lib/dovecot/imap mail_executable(imap): /usr/lib/dovecot/imap mail_executable(pop3): /usr/lib/dovecot/pop3 mail_plugins(default): quota imap_quota mail_plugins(imap): quota imap_quota mail_plugins(pop3): quota 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): outlook-idle netscape-eoh delay-newmail imap_client_workarounds(imap): outlook-idle netscape-eoh delay-newmail imap_client_workarounds(pop3): outlook-idle pop3_uidl_format(default): pop3_uidl_format(imap): pop3_uidl_format(pop3): %08Xu%08Xv pop3_client_workarounds(default): pop3_client_workarounds(imap): pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh auth default: mechanisms: plain login digest-md5 cram-md5 ntlm passdb: driver: ldap args: /etc/dovecot/dovecot-ldap.conf userdb: driver: ldap args: /etc/dovecot/dovecot-ldap.conf socket: type: listen master: path: /var/run/dovecot/auth-master mode: 384 user: virtual group: virtual
What am I missing?
TIA,
p@rick
-- state of mind Agentur für Kommunikation, Design und Softwareentwicklung
Patrick Koetter Tel: 089 45227227 Echinger Strasse 3 Fax: 089 45227226 85386 Eching Web: http://www.state-of-mind.de
Amtsgericht München Partnerschaftsregister PR 563
On Sunday 27 January 2008 12:48:24 Patrick Ben Koetter wrote:
I am trying to tell Dovecot deliver to use $mail_location as the location
# Dovecot # dovecot-ldap.conf user_attrs = mailHomeDirectory=home,mailUidNumber=uid,mailGidNumber=gid,mailQuota=quota= maildir:storage,mail=mailHomeDirectory
It is my understanding that mail_location only gets uses if no mail attribute is specified. In any case, it appears that the above perhaps should read mailHomeDirectory=mail. Also making the home and the mail directory the same has caused problems for others on this list; like odd files showing up as mail folders in the email client.
Jim
- Jim Horner jhorner@arinbe.com:
On Sunday 27 January 2008 12:48:24 Patrick Ben Koetter wrote:
I am trying to tell Dovecot deliver to use $mail_location as the location
# Dovecot # dovecot-ldap.conf user_attrs = mailHomeDirectory=home,mailUidNumber=uid,mailGidNumber=gid,mailQuota=quota= maildir:storage,mail=mailHomeDirectory
It is my understanding that mail_location only gets uses if no mail attribute is specified. In any case, it appears that the above perhaps should read mailHomeDirectory=mail. Also making the home and the mail directory the same
Doh! Thanks, that fixed the mail location problem. In the log I can now see it is used when I use dovecot as Postfix service.
The initial problem yet still remains. If I use "mailbox_command = ../deliver" deliver seems to use the $ENV settings. I can probably change those, but I'd rather have deliver read system user delivery options from LDAP, jsut as I do for my virtual users.
has caused problems for others on this list; like odd files showing up as mail folders in the email client.
Haven't had that yet, but will do as soon as I have problems, thanks. I can/will fix that if I get deliver use my LDAP settings.
I've switched off all other userdb drivers. From my understanding deliver _must_ read from LDAP:
userdb: driver: ldap args: /etc/dovecot/dovecot-ldap.conf
Wrong assumption?
p@rick
-- state of mind Agentur für Kommunikation, Design und Softwareentwicklung
Patrick Koetter Tel: 089 45227227 Echinger Strasse 3 Fax: 089 45227226 85386 Eching Web: http://www.state-of-mind.de
Amtsgericht München Partnerschaftsregister PR 563
On Sun, 2008-01-27 at 19:25 +0100, Patrick Ben Koetter wrote:
It is my understanding that mail_location only gets uses if no mail attribute is specified. In any case, it appears that the above perhaps should read mailHomeDirectory=mail. Also making the home and the mail directory the same
Doh! Thanks, that fixed the mail location problem. In the log I can now see it is used when I use dovecot as Postfix service.
The initial problem yet still remains. If I use "mailbox_command = ../deliver" deliver seems to use the $ENV settings. I can probably change those, but I'd rather have deliver read system user delivery options from LDAP, jsut as I do for my virtual users.
That's how it should work. Also deliver v1.1 will clear out the environment by default.
I've switched off all other userdb drivers. From my understanding deliver _must_ read from LDAP:
userdb: driver: ldap args: /etc/dovecot/dovecot-ldap.conf
It should. Set auth_debug=yes and mail_debug=yes. What does it log when delivering a mail?
Timo,
thanks for picking up on this. Read the logs and my considerations below:
- Timo Sirainen tss@iki.fi:
On Sun, 2008-01-27 at 19:25 +0100, Patrick Ben Koetter wrote:
It is my understanding that mail_location only gets uses if no mail attribute is specified. In any case, it appears that the above perhaps should read mailHomeDirectory=mail. Also making the home and the mail directory the same
Doh! Thanks, that fixed the mail location problem. In the log I can now see it is used when I use dovecot as Postfix service.
The initial problem yet still remains. If I use "mailbox_command = ../deliver" deliver seems to use the $ENV settings. I can probably change those, but I'd rather have deliver read system user delivery options from LDAP, jsut as I do for my virtual users.
That's how it should work. Also deliver v1.1 will clear out the environment by default.
I've switched off all other userdb drivers. From my understanding deliver _must_ read from LDAP:
userdb: driver: ldap args: /etc/dovecot/dovecot-ldap.conf
It should. Set auth_debug=yes and mail_debug=yes. What does it log when delivering a mail?
The order of the log blocks is reversed. First I sent a mail over command line. Then I logged using my MUA:
# Mail delivery Jan 31 20:28:20 mail deliver(p): Loading modules from directory: /usr/lib/dovecot/modules/lda Jan 31 20:28:20 mail deliver(p): Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so Jan 31 20:28:20 mail deliver(p): Module loaded: /usr/lib/dovecot/modules/lda/lib90_cmusieve_plugin.so Jan 31 20:28:20 mail deliver(p): maildir: data=/home/p/Maildir Jan 31 20:28:20 mail deliver(p): maildir: root=/home/p/Maildir, index=/home/p/Maildir, control=, inbox= Jan 31 20:28:20 mail deliver(p): cmusieve: Using sieve path: /home/p/.dovecot.sieve Jan 31 20:28:20 mail deliver(p): cmusieve: Executing script /home/p/.dovecot.sievec Jan 31 20:28:20 mail amavis[26081]: (26081-09) Passed CLEAN, root@state-of-mind.de -> p@state-of-mind.de, Message-ID: 20080131192820.822F680CCAA@mail.state-of-mind.de, mail_id: 28jhpw3tdpQd, Hits: 0.685, queued_as: A6F1B80CCA0, 226 ms Jan 31 20:28:20 mail postfix/lmtp[32258]: 822F680CCAA: to=p@state-of-mind.de, relay=127.0.0.1[127.0.0.1]:10024, delay=0.26, delays=0.03/0/0/0.23, dsn=2.6.0, status=sent (250 2.6.0 Ok, id=26081-09, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as A6F1B80CCA0) Jan 31 20:28:20 mail postfix/qmgr[10756]: 822F680CCAA: removed Jan 31 20:28:20 mail deliver(p): msgid=20080131192820.822F680CCAA@mail.state-of-mind.de: saved mail to INBOX
# Mail login Jan 31 20:28:36 mail dovecot: auth(default): client in: AUTH^I1^ICRAM-MD5^Iservice=IMAP^Ilip=194.126.158.26^Irip=62.245.202.194 Jan 31 20:28:36 mail dovecot: auth(default): client out: CONT^I1^IPDA4MjU4MjkyMzAyNTYzMjUuMTIwMTgwNzcxNkBtYWlsPg== Jan 31 20:28:36 mail dovecot: auth(default): client in: CONT<hidden> Jan 31 20:28:36 mail dovecot: auth(default): ldap(p@state-of-mind.de,62.245.202.194): pass search: base=ou=customers,dc=state-of-mind,dc=de scope=subtree filter=(|(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=p@state-of-mind.de)(mailEnabled=TRUE))(&(objectClass=PostfixBookMailAccount)(mailAlias=p@state-of-mind.de)(mailEnabled=TRUE))) fields=uniqueIdentifier,userPassword Jan 31 20:28:36 mail dovecot: auth(default): ldap(p@state-of-mind.de,62.245.202.194): result: uniqueIdentifier(user)=p@state-of-mind.de userPassword(password)=<hidden> Jan 31 20:28:36 mail dovecot: auth(default): client out: OK^I1^Iuser=p@state-of-mind.de Jan 31 20:28:36 mail dovecot: auth(default): master in: REQUEST^I2^I32303^I1 Jan 31 20:28:36 mail dovecot: auth(default): passwd(p@state-of-mind.de,62.245.202.194): lookup Jan 31 20:28:36 mail dovecot: auth(default): passwd(p@state-of-mind.de,62.245.202.194): unknown user Jan 31 20:28:36 mail dovecot: auth(default): ldap(p@state-of-mind.de,62.245.202.194): user search: base=ou=customers,dc=state-of-mind,dc=de scope=subtree filter=(|(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=p@state-of-mind.de))(&(objectClass=PostfixBookMailAccount)(mailAlias=p@state-of-mind.de))) fields=mailHomeDirectory,mailUidNumber,mailGidNumber,mailQuota,mailHomeDirectory Jan 31 20:28:36 mail dovecot: auth(default): master out: USER^I2^Ip@state-of-mind.de^Iquota=maildir:storage=2621440^Iuid=1000^Igid=1000^Imail=/srv/mail/state-of-mind.de/p/Maildir Jan 31 20:28:36 mail dovecot: imap-login: Login: user=p@state-of-mind.de, method=CRAM-MD5, rip=62.245.202.194, lip=194.126.158.26 Jan 31 20:28:36 mail dovecot: IMAP(p@state-of-mind.de): Loading modules from directory: /usr/lib/dovecot/modules/imap Jan 31 20:28:36 mail dovecot: IMAP(p@state-of-mind.de): Module loaded: /usr/lib/dovecot/modules/imap/lib10_quota_plugin.so Jan 31 20:28:36 mail dovecot: IMAP(p@state-of-mind.de): Module loaded: /usr/lib/dovecot/modules/imap/lib11_imap_quota_plugin.so Jan 31 20:28:36 mail dovecot: IMAP(p@state-of-mind.de): Effective uid=1000, gid=1000, home= Jan 31 20:28:36 mail dovecot: IMAP(p@state-of-mind.de): maildir: data=/srv/mail/state-of-mind.de/p/Maildir Jan 31 20:28:36 mail dovecot: IMAP(p@state-of-mind.de): maildir: root=/srv/mail/state-of-mind.de/p/Maildir, index=/srv/mail/state-of-mind.de/p/Maildir, control=, inbox=
What irritates me, is that on Mail delivery deliver always claims to be working for "p", while dovecot: auth says it does the job for IMAP(p@state-of-mind.de). Both should be p@state-of-mind.de.
p@rick
-- state of mind Agentur für Kommunikation, Design und Softwareentwicklung
Patrick Koetter Tel: 089 45227227 Echinger Strasse 3 Fax: 089 45227226 85386 Eching Web: http://www.state-of-mind.de
Amtsgericht München Partnerschaftsregister PR 563
On Thu, 2008-01-31 at 20:36 +0100, Patrick Ben Koetter wrote:
# Mail delivery Jan 31 20:28:20 mail deliver(p): Loading modules from directory: /usr/lib/dovecot/modules/lda Jan 31 20:28:20 mail deliver(p): Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so Jan 31 20:28:20 mail deliver(p): Module loaded: /usr/lib/dovecot/modules/lda/lib90_cmusieve_plugin.so Jan 31 20:28:20 mail deliver(p): maildir: data=/home/p/Maildir Jan 31 20:28:20 mail deliver(p): maildir: root=/home/p/Maildir, index=/home/p/Maildir, control=, inbox= Jan 31 20:28:20 mail deliver(p): cmusieve: Using sieve path: /home/p/.dovecot.sieve Jan 31 20:28:20 mail deliver(p): cmusieve: Executing script /home/p/.dovecot.sievec Jan 31 20:28:20 mail deliver(p): msgid=20080131192820.822F680CCAA@mail.state-of-mind.de: saved mail to INBOX
There's no auth info here, so it's not doing an auth lookup. So you're not giving -d parameter to deliver?
- Timo Sirainen dovecot@dovecot.org:
On Thu, 2008-01-31 at 20:36 +0100, Patrick Ben Koetter wrote:
# Mail delivery Jan 31 20:28:20 mail deliver(p): Loading modules from directory: /usr/lib/dovecot/modules/lda Jan 31 20:28:20 mail deliver(p): Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so Jan 31 20:28:20 mail deliver(p): Module loaded: /usr/lib/dovecot/modules/lda/lib90_cmusieve_plugin.so Jan 31 20:28:20 mail deliver(p): maildir: data=/home/p/Maildir Jan 31 20:28:20 mail deliver(p): maildir: root=/home/p/Maildir, index=/home/p/Maildir, control=, inbox= Jan 31 20:28:20 mail deliver(p): cmusieve: Using sieve path: /home/p/.dovecot.sieve Jan 31 20:28:20 mail deliver(p): cmusieve: Executing script /home/p/.dovecot.sievec Jan 31 20:28:20 mail deliver(p): msgid=20080131192820.822F680CCAA@mail.state-of-mind.de: saved mail to INBOX
There's no auth info here, so it's not doing an auth lookup. So you're not giving -d parameter to deliver?
You mean on the Postfix $mailbox_command? No, I am not.
p@rick
-- state of mind Agentur für Kommunikation, Design und Softwareentwicklung
Patrick Koetter Tel: 089 45227227 Echinger Strasse 3 Fax: 089 45227226 85386 Eching Web: http://www.state-of-mind.de
Amtsgericht München Partnerschaftsregister PR 563
On Thu, 2008-01-31 at 20:49 +0100, Patrick Ben Koetter wrote:
- Timo Sirainen dovecot@dovecot.org:
On Thu, 2008-01-31 at 20:36 +0100, Patrick Ben Koetter wrote:
# Mail delivery Jan 31 20:28:20 mail deliver(p): Loading modules from directory: /usr/lib/dovecot/modules/lda Jan 31 20:28:20 mail deliver(p): Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so Jan 31 20:28:20 mail deliver(p): Module loaded: /usr/lib/dovecot/modules/lda/lib90_cmusieve_plugin.so Jan 31 20:28:20 mail deliver(p): maildir: data=/home/p/Maildir Jan 31 20:28:20 mail deliver(p): maildir: root=/home/p/Maildir, index=/home/p/Maildir, control=, inbox= Jan 31 20:28:20 mail deliver(p): cmusieve: Using sieve path: /home/p/.dovecot.sieve Jan 31 20:28:20 mail deliver(p): cmusieve: Executing script /home/p/.dovecot.sievec Jan 31 20:28:20 mail deliver(p): msgid=20080131192820.822F680CCAA@mail.state-of-mind.de: saved mail to INBOX
There's no auth info here, so it's not doing an auth lookup. So you're not giving -d parameter to deliver?
You mean on the Postfix $mailbox_command? No, I am not.
The userdb lookup is done only when giving -d dest@user parameter to deliver. I don't know if mailbox_command allows that.
- Timo Sirainen tss@iki.fi:
On Thu, 2008-01-31 at 20:49 +0100, Patrick Ben Koetter wrote:
- Timo Sirainen dovecot@dovecot.org:
On Thu, 2008-01-31 at 20:36 +0100, Patrick Ben Koetter wrote:
# Mail delivery Jan 31 20:28:20 mail deliver(p): Loading modules from directory: /usr/lib/dovecot/modules/lda Jan 31 20:28:20 mail deliver(p): Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so Jan 31 20:28:20 mail deliver(p): Module loaded: /usr/lib/dovecot/modules/lda/lib90_cmusieve_plugin.so Jan 31 20:28:20 mail deliver(p): maildir: data=/home/p/Maildir Jan 31 20:28:20 mail deliver(p): maildir: root=/home/p/Maildir, index=/home/p/Maildir, control=, inbox= Jan 31 20:28:20 mail deliver(p): cmusieve: Using sieve path: /home/p/.dovecot.sieve Jan 31 20:28:20 mail deliver(p): cmusieve: Executing script /home/p/.dovecot.sievec Jan 31 20:28:20 mail deliver(p): msgid=20080131192820.822F680CCAA@mail.state-of-mind.de: saved mail to INBOX
There's no auth info here, so it's not doing an auth lookup. So you're not giving -d parameter to deliver?
You mean on the Postfix $mailbox_command? No, I am not.
The userdb lookup is done only when giving -d dest@user parameter to deliver. I don't know if mailbox_command allows that.
Ah!
The Postfix mailbox_command allows to pass optional information as described in the postconf man page:
$ man 5 postconf | less +/^mailbox_command
Yesterday I came up with this and it works:
mailbox_command = /usr/lib/dovecot/deliver -d "$RECIPIENT"
Thanks for your assistance!
p@rick
-- state of mind Agentur für Kommunikation, Design und Softwareentwicklung
Patrick Koetter Tel: 089 45227227 Echinger Strasse 3 Fax: 089 45227226 85386 Eching Web: http://www.state-of-mind.de
Amtsgericht München Partnerschaftsregister PR 563
- Jim Horner jhorner@arinbe.com:
On Sunday 27 January 2008 12:48:24 Patrick Ben Koetter wrote:
I am trying to tell Dovecot deliver to use $mail_location as the location
# Dovecot # dovecot-ldap.conf user_attrs = mailHomeDirectory=home,mailUidNumber=uid,mailGidNumber=gid,mailQuota=quota= maildir:storage,mail=mailHomeDirectory
It is my understanding that mail_location only gets uses if no mail attribute is specified. In any case, it appears that the above perhaps should read mailHomeDirectory=mail. Also making the home and the mail directory the same
Doh! Thanks, that fixed the mail location problem. In the log I can now see it is used when I use dovecot as Postfix service.
The initial problem yet still remains. If I use "mailbox_command = ../deliver" deliver seems to use the $ENV settings. I can probably change those, but I'd rather have deliver read system user delivery options from LDAP, jsut as I do for my virtual users.
has caused problems for others on this list; like odd files showing up as mail folders in the email client.
Haven't had that yet, but will do as soon as I have problems, thanks. I can/will fix that if I get deliver use my LDAP settings.
I've switched off all other userdb drivers. From my understanding deliver _must_ read from LDAP:
userdb: driver: ldap args: /etc/dovecot/dovecot-ldap.conf
Wrong assumption?
p@rick
-- state of mind Agentur für Kommunikation, Design und Softwareentwicklung
Patrick Koetter Tel: 089 45227227 Echinger Strasse 3 Fax: 089 45227226 85386 Eching Web: http://www.state-of-mind.de
Amtsgericht München Partnerschaftsregister PR 563
The initial problem yet still remains. If I use "mailbox_command = ../deliver" deliver seems to use the $ENV settings. I can probably change those, but I'd rather have deliver read system user delivery options from LDAP, jsut as I do for my virtual users.
Ah, I see. I guess what I was saying is in the ldap config we use
user_attrs = mailMessageStore=home,,uidNumber=uid,gidNumber=gid
minus and mail attribute and in dovecot config we have
mail_location = maildir:%h/Maildir
but we also use virtual transport for all users (system and virtual) so I have not experienced $ENV overriding all of these settings.
Jim
- Jim Horner jhorner@arinbe.com:
The initial problem yet still remains. If I use "mailbox_command = ../deliver" deliver seems to use the $ENV settings. I can probably change those, but I'd rather have deliver read system user delivery options from LDAP, jsut as I do for my virtual users.
Ah, I see. I guess what I was saying is in the ldap config we use
user_attrs = mailMessageStore=home,,uidNumber=uid,gidNumber=gid
minus and mail attribute and in dovecot config we have
mail_location = maildir:%h/Maildir
but we also use virtual transport for all users (system and virtual) so I have not experienced $ENV overriding all of these settings.
I had that too in the beginning, but it breaks local distribution lists on my side. deliver says it cannot handle more than one recipient at a time. That's why I turned to mailbox_command.
p@rick
-- state of mind Agentur für Kommunikation, Design und Softwareentwicklung
Patrick Koetter Tel: 089 45227227 Echinger Strasse 3 Fax: 089 45227226 85386 Eching Web: http://www.state-of-mind.de
Amtsgericht München Partnerschaftsregister PR 563
participants (3)
-
Jim Horner
-
Patrick Ben Koetter
-
Timo Sirainen