[ start | index | login ]
start > knowledgebase > linux > mail > greylisting with postgrey

greylisting with postgrey

Created by brandon. Last edited by glenn, one year and 338 days ago. Viewed 2,446 times. #3
[diff] [history] [edit] [rdf]
labels
attachments
Greylisting has proven to be a pretty effective method for reducing the amount of spam you receive. It works by temporarily rejecting emails. Valid email servers will then retry delivery, and be allowed through while spammers will (hopefully) give up. See >>http://www.greylisting.org/ for more info. The postgrey application at >>http://postgrey.schweikert.ch/ provides a simple way to implement greylisting for postfix mail servers.

Debian and Ubuntu have the package available in the main repositories. On CentOS/RHEL based distros, you will need to enable the rpmforge repository per >>http://bliki.rimuhosting.com/space/retep/extra+packages+for+rhel4+and+centos5

Then just install postgrey with apt

apt-get install postgrey

Configure postgrey to start at boot:

Debian/Ubuntu:

update-rc.d postgrey defaults

CentOS/RHEL:

chkconfig postgrey on

And tell it to start up (any distro):

/etc/init.d/postgrey start

Now, tell postfix to use it:

Debian/Ubuntu: The package listens on localhost:60000 by default, so edit /etc/postfix/main.cf, and add 'check_policy_service inet:127.0.0.1:60000' to smtpd_recipient_restrictions. Make sure to add it after permit_sasl_authenticated so you don't greylist authenticated users. Like this:

smtpd_recipient_restrictions =
        permit_mynetworks
        permit_sasl_authenticated
        reject_unauth_destination
        check_policy_service inet:127.0.0.1:60000

CentOS/RHEL: This package listens on a unix socket by default, so edit /etc/postfix/main.cf and add 'check_policy_service unix:/var/spool/postfix/postgrey/socket' to 'smtpd_recipient_restrictions. Again, make sure to add it after permit_sasl_authenticated so as not to greylist yourself. Example:

smtpd_recipient_restrictions =
        permit_mynetworks
        permit_sasl_authenticated
        reject_unauth_destination
        check_policy_service unix:/var/spool/postfix/postgrey/socket

no comments | post comment
Powered by snipsnap.org Found a mistake in a howto? Let us know via an email to p.blikibugs at rimuhosting com.