Debian Tutorials

Debian Tutorials

Step by step tutorials showing you how to install and configure various applications and services on Debian based Linux distros.

June 2024


Enable greylisting in Postfix using Postgrey


Greylisting is a new weapon to use against spam in this great war being waged upon it. With this new shielding method, by which you may block out huge amounts of spam, you are sure to please your email clients!

In name, as well as operation, greylisting is related to whitelisting and blacklisting. What happen is that each time a given mailbox receives an email from an unknown contact (ip), that mail is rejected with a “try again later”-message (This happens at the SMTP layer and is transparent to the end user). This, in the short run, means that all mail gets delayed at least until the sender tries again – but this is where spam loses out! Most spam is not sent out using RFC compliant MTAs; the spamming software will not try again later.

Now let’s install postgrey
apt-get install postgrey

Configure Postfix (pico /etc/postfix/
Add “check_policy_service inet:” to the list recipient restrictions

The list may look similar to this one:
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, check_policy_service inet:

Reload the Postfix daemon
postfix reload

By default postgrey delays all messages for 5 minutes. To change this, edit the postgrey configuration file (pico /etc/default/postgrey)

Change POSTGREY_OPTS so that it read something like this:
POSTGREY_OPTS="--inet= --delay=60"
The delay is specified in number of seconds. When you have changed the value, restart the daemon
/etc/init.d/postgrey restart

Comments 0
There are currently no comments.