Avoid people trying to send spam out from my server

OK. That certainly makes things clearer. That stuff only applied if you actually had a reason to be relaying mail.

If you only need to handle sending mail from the VPS itself, you absolutely do NOT need a relay and you definitely should NOT be accepting ANY mail from outside sources without authentication. That is called being an "open relay" and it is one of the reasons that spamming is so easy to do and so hard to stop.

You need to go back and look at what your actual requirements are. It may well be that you don't need a full MTA at all and you would be better off with a forwarding-only mailer like MSMTP. That would completely eliminate the risk of being an open relay while also doing away with a lot of complexity.

If you really want to run a full MTA for some reason, you need to lock it down. Make it only listen for connections from localhost, firewall it off from the internet, configure it to require authentication for all external connections, anything to make it so that random machines on the internet can't send spam through your server.

/r/sysadmin Thread Parent