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_alias_maps across domains

From: Bill Weiss (houdini+postfixclanspum.net)
Date: Mon Sep 10 2007 - 16:08:21 CDT


mouss(mlist.onlyfree.fr)Mon, Sep 10, 2007 at 10:36:37PM +0200:
> Jorey Bump wrote:
> >Bill Weiss wrote:
> >>
> >>It's not a lot better, but here's what I do:
> >>
> >>In main.cf:
> >> virtual_alias_maps = pcre:/etc/postfix/pcre_virt
> >>
> >>In pcre_virt:
> >>if /(mydomain1|
> >> mydomain2|
> >> mydomain3|
> >> etc...
> >> )/x
> >>/^(houdini|root|postmaster|abuse|etc)/ houdini
> >>endif
> >>
> >>That list is auto generated by my "add a virtual domain" scripts I've
> >>written that also adds the domain to my virtual_alias_domains file.
> >>
> >>I'm sure that someone can tell me what's wrong with this, but it seems to
> >>work.
> >Interesting solution. It's probably not as fast as a hash or better performing
> >map type, but that may not matter for a lot of sites.
> >If a site uses a map type other than pcre/regexp, it may still be possible to
> >use this technique by specifying multiple maps:
> > virtual_alias_maps = pcre:/etc/postfix/vadmin hash:/etc/postfix/virtual
> >Put your postmaster addresses in vadmin and your normal virtual alias mappings
> >in virtual. I haven't tested this, and I don't know if order matters. Will it
> >perform better if the pcre map follows the hash map? Or will the pcre map
> >always be consulted, even if a hash entry matches first?
>
> first match wins.
>
> Whatever map type is used, I find it better to to put "generic aliases" at
> last, so they can be overriden by an explicit alias.

My actual config is a good bit more complex :) I've got on the order of
10 virtual_alias_maps for various things, but I didn't want to make the
example any more complicated than needed.

> PS. it is safer to add '' to the pcre:
> /^(houdini|root|postmaster|abuse|etc)/ houdini
> otherwise, it would match houdiniblahblahexample.com and so on.

I do get email for houdinisomethingme fairly regularly :)

I left it this way to deal with plus addresses, but I now realize that
plus addresses (recipient_delimiter = +) don't really come in to it.
Thanks for the reminder!

--
Bill Weiss
 
How To Write Good
 49. The adverb always follows the verb.