Postgrey – Postfix Greylisting Policy Server

Greylisting is an anti-spam and virus measure you can use on your mail servers. When a remote server connects for the first time it’s automatically disconnected and can’t connect for a set time limit (default is 5 minutes). If it’s a real mail server it should keep trying to deliver the mail but viruses and spam will more than likely be stopped cold.

Postgrey is a greylisting server for Postfix that Colm Buckley installed on the machine that runs
On Debian, it’s as easy as apt-get install postgrey but then you have to configure Postfix to use it:
Edit /etc/postfix/ and modify the line that starts with:
smtpd_client_restrictions = ...
and add inet: to the end of it.
Now, you probably want to enable white listing of clients too so edit /etc/default/postgrey and change so it looks like this:
POSTGREY_OPTS="--inet= --delay=300 --auto-whitelist-clients"
You might want to add the IP range for your local network to /etc/postgrey/whitelist_clients so they’re not greylisted:
/^192\.168\.1\..*/ does the job for my situation I think.
Now, restart Postfix and Postgrey and you should see the following message appear in /var/log/
Client host rejected: Greylisted for 300 seconds (see
If you don’t, it’s not working!
Much later… It’s been active for about 20 hours now and I’ve only received about 10 spams, down from well over 200 usually! The delay in delivery is annoying, but it’s something we can hopefully live with!

Shudder's Digital Darkroom

This script is available for Photoshop, Photoshop Elements, Paint Shop Pro and The GIMP! The GIMP version is a Scheme file and looks like a useful addition to anyone’s digital workflow.