This comes from this guide.
Postgrey sends SMTP 450 (Come back later), and a working MTA should retry to deliver mail (some don’t, sigh). It manages to block a pile of spam though - I use it on my backup MX to combat the spammers who will send spam to the backup MX hoping that it doesn’t perform any spam trapping.
apt-get install postgrey
Configure Postfix, editing main.cf to add check_policy_service inet:127.0.0.1:10023 at the end of smtpd_recipient_restrictions.
Postgrey previously used port 60000 - this changed to 10023.
Reload Postfix’s configuration
The default config should work, and Greylisting is up and running.