OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: relay_recipients_maps / generic clash

From: John Knappers (jknappers-argentiahotmail.com)
Date: Sun Oct 01 2006 - 23:58:32 CDT


>John Knappers wrote:
>>Hello everyone,
>>
>>I consolidate a dozen of old domains in 2 domains with the generic table
>>function of Postfix at our gateway relay / Mail hub.
>>This works fine, but now. at last I finally wanted to implement the
>>relay_recipient_maps function. After a night studying the awk syntax to
>>convert the virtual table of our internal mailserver to a
>>relay_recipients_map table I created a nice script just doing that.
>>
>>But now the problems starts. Only the mail of the 2 consolidated domains
>>is accepted, and the mail to addresses ending with domains in the generic
>>table is rejected. Does anyone a way to overcome this? My scripting
>>knowledge is not sufficient to take the generic table in account when
>>creating a relay_recipient_table.
>>
>>With other words: Is it possible to accept mail / do the generic domain
>>consolidation, and apply the releay_recipients_maps feature after that?
>
>
>post concrete examples and you'll get concrete answers...
>
>if your a map contains things like
>foodomain1.example bardomain2.example
>
>and you want to add "bardomain2.example" then
>
> grep -v "^#" $map| grep | awk '{print $2 " something"}'
>
>will do. if you want to add both key and value, then
>
> grep -v "^#" $map| grep | awk '{print $1 " got1"; print $2 " got2"}'
>
>This assumes that you do not use addresses with spaces (such as "foo
>bar"example.com).
>
Sorry, if my explanation was not clear enough:
Generic at the mailbub:
domain1.ccom newdomain1.com
domain2.com newdomain1.com
domain3.com newdomain2.com
domain4.com newdomain2.com
and so on

In the virtual table at our internal mailsystem:
user1newdomain1.com user1
user2newdomain2.com user2
and so on.

At the internal mailsystem I create a relay_recipients_map with the
following script:
#Whre to get to virtual table to convert
RELAY_RECIPIENTS_PATH=/etc/postfix/maps/relay_recipients
#Name of the created recipients_table
RELAY_RECIPIENTS=relay_recipients_domain1.com

AWK_BIN=/bin/awk
POSTMAP_BIN=/usr/sbin/postmap

# script vars, do not change anything here
RELAY_RECIPIENTS_PROTO=relay_recipients_proto
DB=db

# Sanity Checks:
# Laterz, first get it working

echo " creating $RELAY_RECIPIENTS_PATH/$RELAY_RECIPIENTS"
$AWK_BIN '!/#/ && // {printf ("%s\tOK\n",$1)}' $VIRTUAL >
$RELAY_RECIPIENTS_PATH/$RELAY_RECIPIENTS_PROTO

        $POSTMAP_BIN hash:$RELAY_RECIPIENTS_PATH/$RELAY_RECIPIENTS_PROTO

                mv $RELAY_RECIPIENTS_PATH/$RELAY_RECIPIENTS_PROTO
$RELAY_RECIPIENTS_PATH/$RELAY_RECIPIENTS
                mv $RELAY_RECIPIENTS_PATH/$RELAY_RECIPIENTS_PROTO.$DB
$RELAY_RECIPIENTS_PATH/$RELAY_RECIPIENTS.$DB

echo " Done!"

>

This is then copied to the mailhub.
The now created relay_recipient_map has only mail addresses of the
consolidated maildomains.

_________________________________________________________________
500 foto's per maand uploaden, GRATIS! http://spaces.live.com