2

I have a Postfix SMTP server running at home which can't send or receive mails because of an ISP restriction. (no incoming port 25, nor outgoing)
I have a VPS with a public IP that I want to use to relay my home mails to the internet.

It should go like this:
receiving mail: Internet > VPS Relay > Homeserver
sending mail: Homeserver > VPS Relay > Internet

I managed to succesfully setup an outgoing postfix SMTP relay which works. The problem now is receiving mails: if I tell the relay to send incoming mails to my home server it works, but it also sends all outgoing mail back to my home server (which sends it back to the relay which sends it back to my home, ...)

I tried to use a SSH tunnel to forward incoming mails on my VPS to my home server, which worked, but also made it an open relay. (The requests came from localhost so everything was allowed)

The only thing I need to know is how to tell postfix to send incoming mails to my home server and outgoing to the internet, but I couldn't manage to find it.

Thanks for taking a look!

Home server relevant config: postconf -n

myhostname = [*homeservers public dns name*] mynetworks = 127.0.0.0/8, [*my public relay's IP*]/32 mynetworks_style = subnet myorigin = $myhostname relay_domains = $mydestination relayhost = [*my public relay's domain name*]:587

VPS server relevant config: postconf -n mydestination = localhost myhostname = [*VPS public dns name*] mynetworks = 127.0.0.0/8, [*home server public ip*]/32 mynetworks_style = subnet relay_domains = soft_bounce = yes transport_maps = hash:/etc/postfix/transport

cyllos
  • 21

2 Answers2

1

The issue is that you have not set "mydestination" so it's defaulting to the value of my hostname, rather then the domain name(s) you are trying to receive mail for, and rejecting other email as not local.

davidgo
  • 73,366
0

I found a solution!

For those wondering: I added a second postfix server on the same host and used one for receiving and one for sending mail.

cyllos
  • 21