Score:0

Postfix double relay configuration

it flag

I have 2 servers with postfix.

ServerA with this main.cf:

relayhost = smtp.public.com:587
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smarthost_passwd
smtp_sasl_security_options =

Sending emails locally from server A works fine, it does properly the relay over the public smtp and the message arrives to the destination

Now I want to configure ServerB so that when I send an email from it, it will go directly to ServerA which should send the email through the public smtp server (as it does when sending from ServerA by itself)

Telnet from ServerB to ServerA on port 25 is working.

How can I perform this configuration ? I'm not even able to find the correct words for googling it.


EDIT

It worked after following the validated answer.

In case of this can be useful for someone else, these are the configuration files that I finally used:

ServerA:

main.cf:

relayhost = <IP/domain SMTP externe>:<port>
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smarthost_passwd
smtp_sasl_security_options =
mynetworks = <Net of ServerB>

/etc/postfix/smarthost_passwd:

<IP/domain SMTP externe>:<port>     <user>:<pass>

ServerB:

main.cf:

relayhost = <hostname_ServerA>:<port>
smtp_use_tls=yes
smtp_sasl_auth_enable = no
smtp_sasl_security_options =
Michael Hampton avatar
cz flag
With `relayhost`?
Zumo de Vidrio avatar
it flag
@MichaelHampton In serverA yes, in serverB I don’t know if there is another way to do it
Michael Hampton avatar
cz flag
Why wouldn't you use `relayhost`? It is the obvious solution.
Score:3
za flag

ServerB will be using ServerA as the relay or relayhost, similar to how ServerA is currently using smtp.public.com as the relay.

Additionally ServerA must be configured in some way to grant permission to permit ServerB to do so.
There are many ways to configure that, as attested to http://www.postfix.org/SMTPD_ACCESS_README.html

The most trivial for both servers is to configure ServerA so that ServerB's IP-address is permitted to do so, rather than setting up more sophisticated authentication.

Typically it is sufficient to add ServerB's IP-address to mynetworks =

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.