I operate a Linux system where I give out free Linux shell accounts to people for educational purposes. Unfortunately, while doing so it's expected to meet abusive users who will keep sending spam emails to other servers such as Google, Zoho, etc and hence will get the IP of the server blocked.
What I would like to do is allow the users on the system to send messages within localhost only. This means that when a user tries to send out an email to an external domain name, GMail for example, the request will be refused. However, if the user tries to send an email to another user on localhost (example: giovanni@localhost), the message will be sent. I don't mind receiving emails from other servers, but I don't want my server to send emails to other servers. How can I do so?
I'm running CentOS 6.5 with Postfix installed. How can I configure this? Any suggestion will be hugely appreciated!