Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: catch-all local mail

From: Charlie Root (charlieroot0gmail.com)
Date: Thu Apr 01 2010 - 05:23:13 CDT

On Mon, Mar 29, 2010 at 10:12 PM, mouss <moussml.netoyen.net> wrote:
> Charlie Root a écrit :
>> I've been fighting with it for a long time but still can't get the desirable:
>> - forward all local mail sent to valid unix users (+postmaster and
>> abuse redirects of course) to specific email address.
>> I.e. forward all mail sent to:
>> [any-valid-unix-name-from-etc-passwd][any-ip-address-of-the-host]
>> [valid-user][any-hostname-of-the-server]
>> just [valid-user] without domain part
>> In other words any address which local service would accept.
>> I've tried luser_relay but it local service still desperately wants to
>> deliver to local unix mailbox first.
>> I've tried "mailbox_transport = virtual" and "localredir_alias_maps =
>> static:redirect-hereexample.org" but then virtual service failed to
>> deliver to "redirect-hereexample.org" with "User unknown in virtual
>> alias table".
>> Is it possible to setup catch-all for local mail without specifing
>> each valid local user and/or each valid IP/hostname of the mail
>> server?
> <Untested>
> maybe try
> real_alias_maps = hash:/etc/aliases
> local_recipient_maps = proxy:unix:passwd.byname $real_alias_maps
> alias_maps = static:redirect-hereexample.org
> (without overriding "local" configuration).

It seems that local lookup for owner-$user in the alias database, and
once the alias found (and it will as we have static:) it substitute
Envelope From to owner-$user instead of just $user. And I have not
found the option to override it.

However changing static to simple regexp completely solved the issue:

real_alias_maps = hash:/etc/aliases
local_recipient_maps = proxy:unix:passwd.byname $real_alias_maps
alias_maps = alias_maps = regexp:/etc/postfix/catch-all-local.regexp

!/^owner-/ redirect-hereexample.org

Thanks a lot for insight!