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 =
ServerB will be using ServerA as the
relay
orrelayhost
, 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 =