1. Install graypold: make install make test 2. Create tables: 2.1. PostgreSQL: psql -U graylist -d graylist -f postgresql.graypol.sql 2.2. MySQL: mysql -ugraylist -p graylist < mysql.graypol.sql 2.3. SQLite: sqlite3 /var/db/graylist/graylist.sqlite < sqlite.graylist.sql sqlite3 /var/db/graylist/mailcount.sqlite < sqlite.mailcount.sql sqlite3 /var/db/graylist/spf.sqlite < sqlite.spf.sql 3. Adjust main.cf: 3.1 If you want graylisting: smtpd_recipient_restrictions = ... check_policy_service unix:/var/run/graypold_graylist.sock 3.2. If you want mailcounting: smtpd_end_of_data_restrictions = ... check_policy_service unix:/var/run/graypold_mailcount.sock Optionally, if you want to have all recipient addresses reported by the mailcount module (the number of recipients gets always counted): smtpd_recipient_restrictions = ... check_policy_service unix:/var/run/graypold_mailcount.sock, permit_sasl_authenticated, ... 3.3. If you want SASL authenticated users, who are sending mails, to unlock graylisting in the opposite direction: smtpd_recipient_restrictions = ... check_policy_service unix:/var/run/graypold_sent.sock, permit_sasl_authenticated, ... 3.4 If you want to check SPF for the HELO hostname of the sending mailserver: smtpd_helo_restrictions = ... check_policy_service unix:/var/run/graypold_spf_helo.sock, ... 3.5 If you want to check SPF whether the sending mailserver is allowed to send mails on behalf of the envelope from address: smtpd_sender_restrictions = ... check_policy_service unix:/var/run/graypold_spf.sock, ... 4. Overwrite default settings (see /usr/local/lib/graypol.pm) in /usr/local/etc/graypol.conf 5. Set database connection parameters in graypol.conf: 5.1. PostgreSQL: dbtype = Pg dbhost = /tmp (or localhost) dbport = 5432 (or do not specify) dbuser = graylist dbpass = secret dbname = graylist 5.2. MySQL: dbtype = mysql dbhost = localhost dbport = 3306 (or do not specify) dbuser = graylist dbpass = secret dbname = graylist 5.3. SQLite: dbtype = SQLite dbname = /var/db/graylist (just specify directory containing all three *.sqlite files) 6. Create cronjobs: * * * * * /usr/local/libexec/graycron.pl permit */5 * * * * /usr/local/libexec/graycron.pl graph 0 * * * * /usr/local/libexec/graycron.pl clean 0 0 * * * /usr/local/libexec/graycron.pl scrub 7. Create an unprivileged user: 7.1 On FreeBSD: pw useradd graylist -d /nonexistent -s /usr/sbin/nologin -c "Graylisting Daemon" 7.2 On Linux: useradd -d /nonexistent -s /usr/sbin/nologin -c "Graylisting Daemon" -M graylist 8. If you use SQLite: chown graylist /var/db/graylist/*.sqlite chown graylist /var/db/graylist 9. Start graypold.pl: Either use one of the supplied RC scripts, or call /usr/local/sbin/graypold.pl directly. 10. Restart postfix