1. Install graypold:

make install
make test



2. Create tables:

2.1. PostgreSQL:

psql -U graylist -d graylist -f graypol.postgre.sql


2.2. MySQL:

mysql -ugraylist -p graylist < graypol.my.sql



3. Adjust main.cf:

3.1 If you want graylisting:

smtpd_recipient_restrictions =
	...
	check_policy_service unix:/var/run/graypold_graypol.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.pl) in
   /usr/local/etc/graypol.conf



5. 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



6. Create an unprivileged user:

6.1 On FreeBSD:
    pw useradd graylist -d /nonexistent -s /usr/sbin/nologin -c "Graylisting Daemon"

6.2 On Linux:
    useradd -d /nonexistent -s /usr/sbin/nologin -c "Graylisting Daemon" -M graylist



7. Start graypold.pl, use either one of the supplied RC scripts or call
   /usr/local/sbin/graypol.pl directly



8. Restart postfix
