OSEC

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

From: Noel Jones (njonesmegan.vbhcs.org)
Date: Thu Apr 08 2010 - 07:20:41 CDT


On 4/8/2010 5:32 AM, postfix-userstja-server.de wrote:
> Thank you, Noel!
>
> I got that running - mostly :)
>
> Server A (MX, SMTP: smtp.example.com) has:
>
> relay_domains = $myhostname, localhost.$mydomain, localhost,
> /etc/postfix/mydomains
> relay_transport = smtp:[smtp.example.com]
> mynetworks = [ip.ad.dr.es], ...
>
> Where /etc/postfix/mydomains lists all domains to be relayed and the
> relay_transport is the IP of Server B:
>
> Server B (IMAP, imap.example.com) has:
>
> relayhost = [smtp.example.com]
> mydestination = $myhostname, localhost.$mydomain, localhost,
> /etc/postfix/mydomains
> mynetworks = [ip.ad.dr.es], ...
>
>
> This setup works for me - beside one problem:
>
>
> The /etc/aliases of Server A will not be honored, which means that all
> mail to any of the domains will be transported to Server B, which in
> turn will bounce the mail.

Right. /etc/aliases is expanded during local(8) delivery. If
you must expand aliases on the gateway, use virtual_alias_maps
(not! virtual_alias_domains)

But it's generally better to pass the original recipient to
the internal mail server and do the expansion there.

>
> I would like to let already Server A bounce those mails!
>
>
> Using a relay_recipient_maps as you wrote, seems to be the right way,
> but i cannot get it running.
>
> Like in a /etc/aliases file, i want to accept certain users for all
> domains.
>
> I tried to create the file as follows:
>
> awk -F: '{print $1}' /etc/aliases | egrep -v "^(#|$)" | awk '{print $1"
> OK"}' | sort -u > relay_recipient_map
>
> So, for example, it contains lines like:
>
> user1 OK
> user2 OK
>
> But this does not work :-(

relay_recipient_maps must list the userdomain.
user1domain1 OK
user1domain2 OK
user1domain3 OK
...

>
> I would not like to list all users for all domains, but just accept mail
> to the existing users for ALL domains (as shown in my example above).

List them all individually. Don't worry about the size of the
file; it won't affect performance.

   -- Noel Jones