21 Mar 2013
Cutting down on Postfix spam relaying
Postfix, it's used with many a LAMP stack to send out messages from a site, unfortunately it's prone to relaying many spam messages out of the box.
The below code can be easily appended to Postfix's main.cf to drastically reduce the authorization hole.
On Ubuntu you'll find the file at
smtpd_helo_required = yes
strict_rfc821_envelopes = yes
disable_vrfy_command = yes
unknown_address_reject_code = 554
unknown_hostname_reject_code = 554
unknown_client_reject_code = 554
smtpd_helo_restrictions = permit_mynetworks, reject_invalid_hostname, permit
Then restart postfix:
A couple of other handy commands:
- Check the mail queue with
- Empty the queue with
postsuper -d ALL
Image credit: Flickr user "Alan Levine"