From: postfix-users on
Hello,

i would like to create the following setup for two postfix servers.

The setup:

Server A is the smtp(s) server and the MX record for some domains.
He accepts mail from clients over sasl/tls for delivery to the internet
or to the domains.
He does forward all external mail to Server B
He works as a mail-gateway

Server B has no MX record, but takes all mails from Server A, stores
them locally (for access via IMAP) or delivers them to hosts from the
domains.
All outbound mail will NOT be delivered directly, but transported to the
mail-gateway Server A, which in turn delivers to the internet. This may,
the MX server will the the source of such mail ...

So, all external input or output will be done by Server A.
Internal delivery will be done by Server B, while all other domains will
be forwared to Server A again ...

This sound like a possible loop :-/


I have some ideas about mydestinaton, relay_domains, mynetworks and a
transport map, but i feel that there may be a easy and RECOMMENED way to
create such a setup ...

Can anybody give me a hint about the best direction to go?

Thank you!

From: Noel Jones on
On 4/7/2010 8:13 PM, postfix-users(a)tja-server.de wrote:
> Hello,
>
> i would like to create the following setup for two postfix servers.
>
> The setup:
>
> Server A is the smtp(s) server and the MX record for some domains.
> He accepts mail from clients over sasl/tls for delivery to the internet
> or to the domains.
> He does forward all external mail to Server B
> He works as a mail-gateway

For a mail gateway, all domains you're responsible for should
be listed as relay_domains, with recipients should be listed
in relay_recipient_maps.

Use transport_maps entries to tell this box where to deliver
each domain. (or use split-horizon DNS.)

It gets a little more complicated if you must use this box for
client submission. The SASL software on the gateway will need
access to usernames and credentials from the internal mailstore.

>
> Server B has no MX record, but takes all mails from Server A, stores
> them locally (for access via IMAP) or delivers them to hosts from the
> domains.
> All outbound mail will NOT be delivered directly, but transported to the
> mail-gateway Server A, which in turn delivers to the internet. This may,
> the MX server will the the source of such mail ...

OK, typical mailstore setup with "relayhost =
gateway.example.com". Each domain handled locally will be
listed in mydestination OR virtual_alias_domains OR
virtual_mailbox_domains depending on how mail is stored on
this box, your choice of IMAP/POP software, and how many users
you expect.


>
> So, all external input or output will be done by Server A.
> Internal delivery will be done by Server B, while all other domains will
> be forwared to Server A again ...
>
> This sound like a possible loop :-/

Only if you don't follow directions.

>
>
> I have some ideas about mydestinaton, relay_domains, mynetworks and a
> transport map, but i feel that there may be a easy and RECOMMENED way to
> create such a setup ...
>
> Can anybody give me a hint about the best direction to go?
>
> Thank you!

Start with the links under "General Configuration"
http://www.postfix.org/documentation.html

Then come back when you have more specific questions.



-- Noel Jones

From: postfix-users on
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.

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 :-(

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?

Thank you!
:)

From: postfix-users on
I got caught by that already :-O

My server bounced two mails from the list (having relay_recipient_maps
set up wrongly) - and i have no idea if that was already an answer ...

So, if somebody answered to my last mail, please send it again.
:)

Sorry for that!


postfix-users(a)tja-server.de schrieb:
> 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.
>
> 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 :-(
>
> 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?
>
> Thank you!
> :)
>

From: Noel Jones on
On 4/8/2010 5:32 AM, postfix-users(a)tja-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 user(a)domain.
user1(a)domain1 OK
user1(a)domain2 OK
user1(a)domain3 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