In postfix, how could I disable incoming mail?

I would like to be able to send mail to remote servers, from scripts running on my VPS via SMTP, but otherwise reject all incoming mail with postfix on Debian squeeze.

(And in general disable any other features for now. I would like to avoid security risks, provided that I have default settings except for the domain name and don't need anything but sending some mails anyway. Another main concern is that I'm currently very short on time.)


Solution 1:

You can use the inet_interfaces directive in /etc/postfix/main.cf to control what address Postfix listens on for incoming connections. If you set it to the following it will only listen on the loopback interface, which means that connections can only originate from that machine.

inet_interfaces = loopback-only

Solution 2:

You can disable incoming SMTP by editing master.cf, just comment out the smtp and submission services. This will tell postfix not to spawn an smtpd process, which would listen on port 25 (587 for submission) for incoming SMTP connections.