On 2010-04-08 postfix-us...@tja-server.de wrote:
> Server A (MX, SMTP: smtp.example.com) has:
>
> relay_domains = $myhostname, localhost.$mydomain, localhost,  
> /etc/postfix/mydomains

$myhostname and localhost.$mydomain should go into $mydestination, not
into $relay_domains. You can forward all mail to valid local addresses
to your internal host via entries in $alias_maps.

> relay_transport = smtp:[smtp.example.com]
> mynetworks = [ip.ad.dr.es], ...

I don't think [a.b.c.d] is valid syntax for IPv4 addresses in
$mynetworks. Lose the square brackets.

> Where /etc/postfix/mydomains lists all domains to be relayed

You may want to use a more "speaking" name for your relay domains (like,
/etc/postfix/relay_domains ;).

> and the relay_transport is the IP of Server B:

In your config snippet from server A, the parameter $relay_transport
doesn't contain the IP address of server B, but the FQDN of server A.
Unless you mis-obfuscated the parameter value you need to correct that
line.

> Server B (IMAP, imap.example.com) has:
>
> relayhost = [smtp.example.com]
> mydestination = $myhostname, localhost.$mydomain, localhost,  
> /etc/postfix/mydomains
> mynetworks = [ip.ad.dr.es], ...

See above.

> 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.

Expected, since you configured $myhostname as a relay domain.

> I would like to let already Server A bounce those mails!

# Server A
mydestination = $myhostname, localhost.$mydomain, localhost
relay_domains = /etc/postfix/relay_domains
alias_maps = hash:/etc/aliases
local_recipient_maps = $alias_maps
relay_recipient_maps = hash:/etc/postfix/relay_recipients

> 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

<cough>awk -F: '$0 !~ /^(#|$)/ {print $1" OK"}' /etc/aliases</cough>

> So, for example, it contains lines like:
>
> user1@        OK
> user2@        OK
>
> But this does not work :-(
>
> 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).
>
> Is there a way to reach that goal?
> Or do i need to add one line for each user in every domain?

The postconf man-page [1] isn't too clear about this, but I think you
need to specify full addresses (us...@example.com OK). I have a script
somewhere that will generate a list of valid recipients from various
(file-based) recipient and domain lists. If I manage to unearth it after
I get home tonight, I'll post it here.

[1] http://www.postfix.org/postconf.5.html#relay_recipient_maps

Regards
Ansgar Wiechers
-- 
"Abstractions save us time working, but they don't save us time learning."
--Joel Spolsky

Reply via email to