Re: [Dovecot] deliver to subfolder with dovecot's LDA
On Fri, March 16, 2007 8:12 pm, Tom Bombadil grlists@gmail.com said:
How can deliver messages to a subfolder using the LDA? For example, I want a message to joe+spam@abc.com to be placed inside the 'spam' subfolder.
$ deliver --help Usage: deliver [-c <config file>] [-d <destination user>] [-m <mailbox>] [-f <envelope sender>]
So for the example above, you can call it like this:
$ deliver -d joe@abc.com -m spam
To do this from Postfix, /etc/postfix/master.cf:
dovecot unix - n n - - pipe flags=DRhu user=virtual argv=/usr/libexec/dovecot/deliver -d ${recipient} -f ${sender} -m ${extension}
However, I think LDA freaks out if you pass -m "". So this might not work when there is no "+folder".
Timo: Should -m treat empty string as if -m was not passed at all?
Bill
On Fri, 2007-03-16 at 22:41 -0400, Bill Boebel wrote:
flags=DRhu user=virtual argv=/usr/libexec/dovecot/deliver -d ${recipient} -f ${sender} -m ${extension}
However, I think LDA freaks out if you pass -m "". So this might not work when there is no "+folder".
Timo: Should -m treat empty string as if -m was not passed at all?
OK, done:
- empty mailbox name is ignored
- added -n parameter to disable autocreating mailboxes
- if saving to specified mailbox fails, it fallbacks to saving to INBOX.
Op vr, 16-03-2007 te 22:41 -0400, schreef Bill Boebel:
So for the example above, you can call it like this: deliver -d joe@abc.com -m spam To do this from Postfix, /etc/postfix/master.cf: dovecot unix - n n - - pipe flags=DRhu user=virtual argv=/usr/libexec/dovecot/deliver -d ${recipient} -f ${sender} -m ${extension}
I have this setup like that, although without the -f and -m options. Anyway, it seems that postfix first tries to run deliver with $recipient=joe+spam, and deliver happily creates a new mailbox 'joe +spam'. Any idea how to solve this?
The postfix documentation says it first tries to deliver to 'joe+spam', and then to 'joe'. I'm not sure why deliver just accepts the user+ext name, and creates a new folder.
Koen
On Sat, 2007-03-17 at 14:33 +0100, Koen Vermeer wrote:
flags=DRhu user=virtual argv=/usr/libexec/dovecot/deliver -d ${recipient} -f ${sender} -m ${extension}
I have this setup like that, although without the -f and -m options. Anyway, it seems that postfix first tries to run deliver with $recipient=joe+spam, and deliver happily creates a new mailbox 'joe +spam'. Any idea how to solve this?
The postfix documentation says it first tries to deliver to 'joe +spam', and then to 'joe'. I'm not sure why deliver just accepts the user+ext name, and creates a new folder.
Creates a new user joe+spam, or creates a mailbox "joe+spam" into joe's mailboxes?
Op zo, 18-03-2007 te 17:39 +0200, schreef Timo Sirainen:
I have this setup like that, although without the -f and -m options. Anyway, it seems that postfix first tries to run deliver with $recipient=joe+spam, and deliver happily creates a new mailbox 'joe +spam'. Any idea how to solve this? The postfix documentation says it first tries to deliver to 'joe +spam', and then to 'joe'. I'm not sure why deliver just accepts the user+ext name, and creates a new folder. Creates a new user joe+spam, or creates a mailbox "joe+spam" into joe's mailboxes?
A new folder with the name "joe+spam" into the virtual domains folder. I guess that's what you call a new user. The mail doesn't arrive in joe's mailbox, or anywhere in his maildir.
Thanks!
Koen
On Sun, 2007-03-18 at 21:58 +0100, Koen Vermeer wrote:
I have this setup like that, although without the -f and -m options. Anyway, it seems that postfix first tries to run deliver with $recipient=joe+spam, and deliver happily creates a new mailbox 'joe +spam'. Any idea how to solve this? The postfix documentation says it first tries to deliver to 'joe +spam', and then to 'joe'. I'm not sure why deliver just accepts the user +ext name, and creates a new folder. Creates a new user joe+spam, or creates a mailbox "joe+spam" into joe's mailboxes?
A new folder with the name "joe+spam" into the virtual domains folder. I guess that's what you call a new user. The mail doesn't arrive in joe's mailbox, or anywhere in his maildir.
What's your userdb configuration? It looks like it doesn't check the user's existence at all. If you're using for example static userdb then this happens..
Op zo, 18-03-2007 te 23:13 +0200, schreef Timo Sirainen:
On Sun, 2007-03-18 at 21:58 +0100, Koen Vermeer wrote:
A new folder with the name "joe+spam" into the virtual domains folder. I guess that's what you call a new user. The mail doesn't arrive in joe's mailbox, or anywhere in his maildir.
What's your userdb configuration? It looks like it doesn't check the user's existence at all. If you're using for example static userdb then this happens..
Yes, right on! Your remote debug-skills are amazing... Normally, postfix already does the user check, so if I send a mail to an non-existent user, postfix rejects it. Therefore, I never noticed this before.
Now, this behaviour of deliver isn't what I would expect. Any chance on a fix for this, or a notice in the config-file or the wiki about why this is happening?
Thanks!
Koen
On Sun, 2007-03-18 at 22:30 +0100, Koen Vermeer wrote:
Op zo, 18-03-2007 te 23:13 +0200, schreef Timo Sirainen:
On Sun, 2007-03-18 at 21:58 +0100, Koen Vermeer wrote:
A new folder with the name "joe+spam" into the virtual domains folder. I guess that's what you call a new user. The mail doesn't arrive in joe's mailbox, or anywhere in his maildir.
What's your userdb configuration? It looks like it doesn't check the user's existence at all. If you're using for example static userdb then this happens..
Yes, right on! Your remote debug-skills are amazing... Normally, postfix already does the user check, so if I send a mail to an non-existent user, postfix rejects it. Therefore, I never noticed this before.
Now, this behaviour of deliver isn't what I would expect. Any chance on a fix for this, or a notice in the config-file or the wiki about why this is happening?
So you are using static userdb? I'm not sure how this could be fixed. Especially if you're using passdb PAM + userdb static it could be impossible for Dovecot to verify if the user exists (I don't think PAM_USER_UNKNOWN reply can be relied on, plus it could do 2 second delays for each user "lookup" because the password is wrong). With other passdbs it would be possible, but that's again userdb static specific so I don't think I'll bother..
But yes, I could mention this in LDA's wiki page.
So you are using static userdb? I'm not sure how this could be fixed. Especially if you're using passdb PAM + userdb static it could be impossible for Dovecot to verify if the user exists (I don't think PAM_USER_UNKNOWN reply can be relied on, plus it could do 2 second delays for each user "lookup" because the password is wrong). With other passdbs it would be possible, but that's again userdb static specific so I don't think I'll bother..
But yes, I could mention this in LDA's wiki page.
Yes. I'm using ldap passdb + static userdb.
I fixed this in exim: If the address is joe+spam@abc.com, I use exim's appendfile transport (and no indexing is done). If the address is joe@abc.com, I use dovecot's LDA.
This is probably even better as very few ppl need their other folders pre-indexed anyways... mainly the SPAM folder.
Thanks
Op ma, 19-03-2007 te 15:50 +0200, schreef Timo Sirainen:
So you are using static userdb? I'm not sure how this could be fixed. Especially if you're using passdb PAM + userdb static it could be impossible for Dovecot to verify if the user exists (I don't think PAM_USER_UNKNOWN reply can be relied on, plus it could do 2 second delays for each user "lookup" because the password is wrong). With other passdbs it would be possible, but that's again userdb static specific so I don't think I'll bother..
But yes, I could mention this in LDA's wiki page.
Yes, my setup is like this:
passdb passwd-file { args = /var/mail/vhosts/vermeer.tv/shadow }
userdb static { args = uid=1002 gid=1002 home=/var/mail/vhosts/%d/homes/%n/ mail=maildir:/var/mail/vhosts/%d/%n/ }
The required data is there: The shadow-file contains a list of valid usernames. It would be nice to have something like an extra option for userdb static to tell it to have a look in this list and see if a user exists. Maybe a 'userlist = /var/mail/vhosts/vermeer.tv/shadow' entry or something like that. Running a database just for this purpose seems to be a bit too much...
Thanks!
Koen
On Mon, 2007-03-19 at 19:28 +0100, Koen Vermeer wrote:
passdb passwd-file { args = /var/mail/vhosts/vermeer.tv/shadow }
userdb static { args = uid=1002 gid=1002 home=/var/mail/vhosts/%d/homes/%n/ mail=maildir:/var/mail/vhosts/%d/%n/ }
The required data is there: The shadow-file contains a list of valid usernames. It would be nice to have something like an extra option for userdb static to tell it to have a look in this list and see if a user exists. Maybe a 'userlist = /var/mail/vhosts/vermeer.tv/shadow' entry or something like that. Running a database just for this purpose seems to be a bit too much...
Well... Fine: http://dovecot.org/list/dovecot-cvs/2007-March/008265.html http://dovecot.org/list/dovecot-cvs/2007-March/008266.html
Op wo, 21-03-2007 te 22:13 +0200, schreef Timo Sirainen:
On Mon, 2007-03-19 at 19:28 +0100, Koen Vermeer wrote:
The required data is there: The shadow-file contains a list of valid usernames. It would be nice to have something like an extra option for userdb static to tell it to have a look in this list and see if a user exists. Maybe a 'userlist = /var/mail/vhosts/vermeer.tv/shadow' entry or something like that. Running a database just for this purpose seems to be a bit too much... Well... Fine: http://dovecot.org/list/dovecot-cvs/2007-March/008265.html http://dovecot.org/list/dovecot-cvs/2007-March/008266.html
Thanks! I patched the Debian rc27 package, and ran a quick test. The new folder isn't created anymore, which is good news! The bad news is that the message is now bounced ('user unknown'). I'm not sure where the problem is: postfix, dovecot, some mis-communication between those two, or just my config...
Koen
On Wed, 2007-03-21 at 23:02 +0100, Koen Vermeer wrote:
Thanks! I patched the Debian rc27 package, and ran a quick test. The new folder isn't created anymore, which is good news! The bad news is that the message is now bounced ('user unknown'). I'm not sure where the problem is: postfix, dovecot, some mis-communication between those two, or just my config...
You need to tell Postfix's pipe not to send the "+mailbox" part to Dovecot, since Dovecot just treats "user+mailbox" as a username. I don't know how though.
Op do, 22-03-2007 te 00:10 +0200, schreef Timo Sirainen:
You need to tell Postfix's pipe not to send the "+mailbox" part to Dovecot, since Dovecot just treats "user+mailbox" as a username. I don't know how though.
The Postfix doc says that it will first try to deliver to "user +mailbox", then to "user". I don't know why an error on the first attempt doesn't result in trying the second method. I'll check with the postfix people.
Koen
Op do, 22-03-2007 te 00:10 +0200, schreef Timo Sirainen:
You need to tell Postfix's pipe not to send the "+mailbox" part to Dovecot, since Dovecot just treats "user+mailbox" as a username. I don't know how though.
Just an update: It seems that postfix doesn't first try 'user +foo@domain' and then 'user@domain' when you use pipe. So, I'm trying indeed how to get the address rewritten to 'user@domain' when calling deliver. I'll report back on that later.
Koen
participants (4)
-
Bill Boebel
-
Koen Vermeer
-
Timo Sirainen
-
Tom Bombadil