This article describes howto setup sqlgrey with postfix and mysql on Debian Lenny.
The normal graylisting with postgrey store the whitelist in a berkeley database which needs to be replicated on a mailserver cluster. With sqlgrey you can do that replication with a mysql database.
First create a Database “sqlgrey” with an user “sqlgrey” on your database server. (The tables will be created by sqlgrey.)
1. Install sqlgrey:
aptitude install sqlgrey
2. Edit the sqlgrey configuration file:
Edit the database settings:
## Database settings db_type = mysql db_name = sqlgrey db_host = YOUR_DATABASE_SERVER db_port = default db_user = sqlgrey db_pass = YOUR_PASS_WORD db_cleandelay = 1800 clean_method = sync
4. Add sqlgrey to the postfix configuration:
Append the recipient restrictions:
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_unknown_client, reject_invalid_hostname, check_policy_service inet:127.0.0.1:2501, permit
5. Restart the services:
/etc/init.d/sqlgrey restart /etc/init.d/postfix restart
Watch the content of the table “connect” it contains the sender information of every incoming mail.