changing the digital world one bit at a time...

Blants (noun) the rants of a blogger

Gleylist spammers on Ubuntu using Postfix and Postgrey

November 3, 2014 by The Man

1. Hopefully you have Postfix already installed so simply install Postgres

sudo apt-get install postgrey

2. Edit the Postfix config file /etc/postfix/ and add or amend

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated,
reject_unauth_destination, reject_unknown_sender_domain,
check_policy_service inet:

3. Restart Postfix and we should be good to go

sudo service postfix restart

4. To test just send yourself an email from, say, then check the mail.log for something like this.

postfix/smtpd: connect from[]
postgrey: action=greylist, reason=new,, client_address=,,
postfix/smtpd[24856]: NOQUEUE: reject: RCPT from[]: 450 4.2.0 <>: Recipient address rejected: Greylisted, see; from=<> to=<> proto=ESMTP helo=
postfix/smtpd: disconnect from[]