OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Need help munging inbound recipient address

From: Daniel L'Hommedieu (dlhommedieugmail.com)
Date: Mon Jul 13 2009 - 10:24:09 CDT


On Jul 13, 2009, at 10:42, Victor Duchovni wrote:
> On Mon, Jul 13, 2009 at 10:34:00AM -0400, Daniel L'Hommedieu wrote:
>>> main.cf:
>>> # Pick one:
>>> #canonical_maps = hash:/etc/postfix/canonical
>>> #virtual_alias_maps = hash:/etc/postfix/valias
>>> #virtual_alias_domains = ... set me explicitly ...
>>> #
>>> #canonical_maps = cdb:/etc/postfix/canonical
>>> #virtual_alias_maps = cdb:/etc/postfix/valias
>>> #virtual_alias_domains = ... set me explicitly ...
>>> #
>>> #canonical_maps = ldap:/etc/postfix/canonical.cf
>>> #virtual_alias_maps = ldap:/etc/postfix/valias.cf
>>> #virtual_alias_domains = ... set me explicitly ...
>>>
>>> canonical:
>>> oofrab.net foobar.edu
>>>
>>> valias:
>>> foobar.edu oofrab.net
>>>
>>> The headers will read "foobar.edu", but the envelope recipient
>>> for delivery (virtual(5) happens after canonical(5)) will still be
>>> oofrab.net. There are other ways of doing this, but this one is
>>> perhaps the most natural.
>>
>> Thanks Victor.
>>
>> FWIW I had tried the canonical map as you suggest (I thought I had
>> mentioned that), but all that seemed to do was forward the mail
>> back to the
>> .edu address, which put the mail into a loop until I removed the map.
>
> Which is *exactly* why I add the virtual(5) reverse mapping, so that
> the envelope recipient is "de-canonicalized". The procmail regexp
> recipe
> is fragile. Do as you see fit, but I recommend the canonical+virtual
> approach.

Hi Victor.

I must be doing something wrong here, because it isn't working as I
expect. Here's what I see happening:
- email to non-groupwise-foobar.edu (on a server running sendmail)
shows up on my system as being to both non-groupwise-foobar.edu AND oofrab.net
.
- email to groupwise-foobar.edu (my email address on the groupwise
server, which started this whole mess) shows up as to oofrab.net.

Based on your instructions, here is what I added to my main.cf:
        canonical_maps = hash:/etc/postfix/recipient_canonical
        virtual_alias_maps = hash:/etc/postfix/virtual_alias_maps
        virtual_alias_domains = bar.edu

Here is my canonical map:
        oofrab.net foobar.edu

Here is my virtual alias:
        foobar.edu oofrab.net

For this test, I have disabled the procmail recipe.

Any ideas on what I'm doing wrong?

Thanks.

Daniel