Spam Fighters

Postgrey

  • Install mail-filter/postgrey:
$ emerge -av postgrey
  • Add to default runlevel and start:
$ rc-update add postgrey default
$ /etc/init.d/postgrey restart
  • Change Postgrey listen type to unix:
/etc/conf.d/postgrey
# ...
POSTGREY_TYPE="unix"
# ...
  • Add Postgrey policy filter to Postfix by adding check_policy_service unix:private/postgrey to smtpd_recipient_restrictions:
/etc/postfix/main.cf
#smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_pipelining, reject_rbl_client zen.spamhaus.org, reject_non_fqdn_recipient, reject_invalid_helo_hostname, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service unix:private/recipient_policy_incoming, permit
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_pipelining, reject_rbl_client zen.spamhaus.org, reject_non_fqdn_recipient, reject_invalid_helo_hostname, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service unix:private/recipient_policy_incoming, check_policy_service unix:private/postgrey, permit
  • Restart Postfix.
$ /etc/init.d/postfix restart
  • Check whether Postgrey is working. You should see some similar after receiving a mail:
$ grep postgrey /var/log/mail.log 
$ Aug 14 17:05:58 pepper postgrey[21683]: action=pass, reason=client whitelist, client_name=mail-we0-f181.google.com, client_address=74.125.82.181, sender=daniel.morlock@gmail.com, recipient=daniel.morlock@awesome-mail.de