OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Virtual Delivery Order + Wildcard Aliases

From: Kyle Dent (kdentseaglass.com)
Date: Tue Dec 02 2003 - 10:54:29 CST


On Mon, 1 Dec 2003, Ryan C. Creasey wrote:

> I'm working on a new implementation of postfix with a pgsql backend.
> I've done it with mysql before, but this time I want to treat all
> ingress mail as virtual. Everything's going great so far, but I've
> recently hit a snag.
>
> If I have my virtual mailboxes set like so:
> postfix=# select address, home from view_postfix_users ;
> address | home
> -----------------+------------------------
> ryanp11.com | /p11.com/ryan/Maildir/
> supportp11.com | /p11.com/support/Maildir/
>
> And my virtual aliases like so:
> postfix=# select * from view_postfix_aliases ;
> address | destination
> ----------+--------------------------
> p11.com | ryanp11.com
>
> With the intention on having two mailboxes; 'ryanp11.com' and
> 'supportp11.com' (both delivering to local users 'ryan' and 'support'
> respectively), and a wildcard alias of 'p11.com'.
>
> The problem I'm running into is that the wildcard alias is being greedy
> and matching 'supportp11.com' and relaying it to 'ryanp11.com'. My
> assumption is that postfix is searching the alias table before the
> mailbox table, but I could be way off. However, if I delete the alias,
> ingress mail bound to 'supportp11.com' delievers to the mailbox normally.
>
> Is there a specific config option to specify the order in which these
> tables are referenced? I believe I heard exim being able to do this,
> but I don't want to have to learn another mta. :) Again, I could be
> *waaay* off and would love to have someone set me straight.
>
> [...]

Virtual aliases are checked before virtual mailboxes. You can get
around your problem by listing all of your virtual mailbox
address along with your virtual aliases. With Postfix maps, it
would look like this:

# virtual mailboxes
ryanp11.com /p11.com/ryan/Maildir/
supportp11.com /p11.com/support/Maildir/

# virtual_aliases
p11.com ryanp11.com
ryanp11.com ryanp11.com
supportp11.com supportp11.com

Construct your pgsql queries to return the same results.

Kyle