Discussion:
postfix / dovecot / virtual_mailbox_maps regex
(too old to reply)
Dirk
2016-05-25 20:00:55 UTC
Permalink
I going in circels with a problem I have with postfix/dovecot.
I have a setup for two virtual_mailbox_domains on my postfix.

domain1.com
x.domain1.com

both domains are delivered by postfix to users maildir which is accessed
via dovecot
Which user to what maildir is definend in.
virtual_mailbox_maps = hash:/etc/postfix/vmaps

The second (sub)domain has not fixed user assignment. The users must
match an regex defined as well in
virtual_mailbox_maps = regexp:/etc/postfix/vmaps-regex

This works quite fine.
But now I would like to use sieve with dovecot.

Therefore I would have to enable
#virtual_transport = lmtp:unix:private/dovecot-lmtp

If I do so - the mails for the sub domain x.domain1.com which has
"dynamic users" based on a pattern is rejected by dovecot

[private/dovecot-lmtp] said: 550 5.1.1 <***@x.domain1.com> User doesn't exist: ***@x.domain1.com (in reply to RCPT TO command)

The question is now - how can I set this up that i can define
dovcot-lmtp to enable sieve and stick to my dynamic users.

It would maybe solve my probelm if I could enable the virtual_transport
only for domain1.com not x.domain1.com.
But this configuration I did in transports fails.

Can someone give me a hint how to get this fixed ?

best regards

Dirk
Viktor Dukhovni
2016-05-25 20:27:35 UTC
Permalink
Post by Dirk
Which user to what maildir is definend in.
virtual_mailbox_maps = hash:/etc/postfix/vmaps
The second (sub)domain has not fixed user assignment. The users must
match an regex defined as well in
virtual_mailbox_maps = regexp:/etc/postfix/vmaps-regex
Presumably, you have:

virtual_mailbox_maps =
hash:/etc/postfix/vmaps,
regexp:/etc/postfix/vmaps-regex

to accomplish both. Right?

What kind of mappings happen in that regexp table? Sure you can
the mail delivered to some maildir or other, but how are users able
to read the mail? Presumably dovecot still needs to know about
the mailboxes created by virtual(8) so it can grant access to them
to suitably authenticated users via IMAP.
Post by Dirk
But now I would like to use sieve with dovecot.
For both domains? Or just one of them?
Post by Dirk
Therefore I would have to enable
#virtual_transport = lmtp:unix:private/dovecot-lmtp
Fine, now the LMTP recipient needs to be a recipient name known to
dovecot, but that's not much different from the requirement that
dovecot be able to associated users with mailboxes for IMAP.

So you've not explained your problem in sufficient detail.
Well dovecot does not know about that mailbox. Deliver to a mailbox
that dovecot does know about. You'd typically use virtual_alias_maps
for that.
Post by Dirk
It would maybe solve my probelm if I could enable the virtual_transport
only for domain1.com not x.domain1.com.
You can certainly use the transport(5) table to direct either domain
to a different transport, but it is not clear that this is the right
approach.

http://www.postfix.org/ADDRESS_REWRITING_README.html
http://www.postfix.org/ADDRESS_CLASS_README.html
http://www.postfix.org/virtual.5.html
http://www.postfix.org/postconf.5.html#virtual_alias_maps
http://www.postfix.org/postconf.5.html#transport_maps
--
Viktor.
Dirk
2016-05-25 20:56:36 UTC
Permalink
Hi Viktor,

thanks or you reply.
Post by Dirk
Post by Dirk
Which user to what maildir is definend in.
virtual_mailbox_maps = hash:/etc/postfix/vmaps
The second (sub)domain has not fixed user assignment. The users must
match an regex defined as well in
virtual_mailbox_maps = regexp:/etc/postfix/vmaps-regex
virtual_mailbox_maps =
hash:/etc/postfix/vmaps,
regexp:/etc/postfix/vmaps-regex
to accomplish both. Right?
Yes you are right.
Post by Dirk
What kind of mappings happen in that regexp table? Sure you can
the mail delivered to some maildir or other, but how are users able
to read the mail? Presumably dovecot still needs to know about
the mailboxes created by virtual(8) so it can grant access to them
to suitably authenticated users via IMAP.
/.*\***@x.domain1.com/ x.domains1.com/dirk/
This is kind of my own "spamgourmet.com" implementation where I can give
email Addresses on the fly to any "webpage".
Everything is dilvered to one maildir.
Post by Dirk
Post by Dirk
But now I would like to use sieve with dovecot.
For both domains? Or just one of them?
Ideally both.
Post by Dirk
Post by Dirk
Therefore I would have to enable
#virtual_transport = lmtp:unix:private/dovecot-lmtp
Fine, now the LMTP recipient needs to be a recipient name known to
dovecot, but that's not much different from the requirement that
dovecot be able to associated users with mailboxes for IMAP.
So you've not explained your problem in sufficient detail.
As to my knowlege dovecot can not handle "dynamically" created emails
addresses.
Post by Dirk
Well dovecot does not know about that mailbox. Deliver to a mailbox
that dovecot does know about. You'd typically use virtual_alias_maps
for that.
Not possible - there is no mapping until the mail arrives. The email
address is dynamic.
Post by Dirk
Post by Dirk
It would maybe solve my probelm if I could enable the virtual_transport
only for domain1.com not x.domain1.com.
You can certainly use the transport(5) table to direct either domain
to a different transport, but it is not clear that this is the right
approach.
http://www.postfix.org/ADDRESS_REWRITING_README.html
http://www.postfix.org/ADDRESS_CLASS_README.html
http://www.postfix.org/virtual.5.html
http://www.postfix.org/postconf.5.html#virtual_alias_maps
http://www.postfix.org/postconf.5.html#transport_maps
I read to virtual and transport_maps serveral times - no luck till now.
Viktor Dukhovni
2016-05-25 21:03:44 UTC
Permalink
Post by Dirk
Post by Viktor Dukhovni
What kind of mappings happen in that regexp table? Sure you can
the mail delivered to some maildir or other, but how are users able
to read the mail? Presumably dovecot still needs to know about
the mailboxes created by virtual(8) so it can grant access to them
to suitably authenticated users via IMAP.
This is kind of my own "spamgourmet.com" implementation where I can give
email Addresses on the fly to any "webpage".
Everything is dilvered to one maildir.
Post by Viktor Dukhovni
Post by Dirk
But now I would like to use sieve with dovecot.
For both domains? Or just one of them?
Ideally both.
Post by Viktor Dukhovni
Post by Dirk
Therefore I would have to enable
#virtual_transport = lmtp:unix:private/dovecot-lmtp
Fine, now the LMTP recipient needs to be a recipient name known to
dovecot, but that's not much different from the requirement that
dovecot be able to associated users with mailboxes for IMAP.
So you've not explained your problem in sufficient detail.
As to my knowlege dovecot can not handle "dynamically" created emails
addresses.
Give it addresses it knows.
Post by Dirk
Post by Viktor Dukhovni
Well dovecot does not know about that mailbox. Deliver to a mailbox
that dovecot does know about. You'd typically use virtual_alias_maps
for that.
Not possible - there is no mapping until the mail arrives. The email
address is dynamic.
Nonsense, essentially the same regexp table can be used in
virtual_alias_maps instead of virtual_mailbox_maps:

/\***@x.domain1.com/ ***@x.domain1.com
--
Viktor.
Dirk
2016-05-30 21:21:09 UTC
Permalink
Hi Viktor,

thanks for pointing this out.
Works now after adding the virtual_alias_maps.

best regards

Dirk
Post by Viktor Dukhovni
Nonsense, essentially the same regexp table can be used in
2***@gmail.com
2016-09-05 12:00:49 UTC
Permalink
Hi Dirk,

Would mind sharing your configs for this (excerpts from postconf -n and dovecot -n)?

I'm having trouble setting up a configuration with local system users, postfix regex maps and dovecot's lmtp delivery, and it seems that what I'm after is very similar to your config.

(my original problem is really described here: http://www.dovecot.org/list/dovecot/2016-September/105385.html but for now, I just want to have user maps in Postfix, but delivery through dovecot/lmtp)
Loading...