RFC: Way to route emails out through bastion host
Currently the bastion host redirects all incoming mail to the actual server, and this works great for receiving emails.
However by default all traffic originating from the mail server are sent out using that server's internet connection. In the case of most consumer ISPs, this means outgoing emails are blocked, as port 25 is generally blocked for consumers.
So, we want to route the emails back out through the cloud bastion server instead.
I see a few options for how we could achieve this:
Use iptables to achieve the outward routing similar to how we achieved the inward routing. My first attempt at this failed due to the bastion server's routing of email to the real server resulting in a loop back to the mail server. Someone more knowledgeable with iptables could probably get this going pretty easily I suspect.
Setup an SMTP relay server on the bastion server, rather than just using iptables. This would likely take more configuration than option 1, but might provide greater flexibility.