About
=====

  It's a lightweight, fast and reliable Sendmail milter that
implements the Greylisting anti spam technology as proposed by Evan
Harris. This technology can significantly reduce the amount of spam
and worms going from zombie hosts, which may produce up to 80% of
world SPAM. This milter has a very effective Greylisting algorithm on
the base of this tuple: sender's IP address (Class C subnet), envelope
sender address and envelope recipient address.  This is derived from
smf-grey, but is a heavier weight alternative which uses a PostgreSQL
database backend for more flexibility and historical state
preservation.

  Features:

    - external editable configuration file;
    - PostgreSQL database configuration and state
    - white/black/greylist and config by an IP address (in CIDR notation);
    - white/black/greylist and config by a PTR (reverse DNS) record;
    - white/black/greylist and config by an envelope sender e-Mail address;
    - white/black/greylist and config by an envelope recipient e-Mail address;
    - configurability of rejectstrings for stupid senders
    - support for auto-accepting replies to email
    - (external) support for auto-promotion to more global accept-lists
    - scalable PostgreSQL greylist/autowhitelist engine;
    - SMTP AUTH support;
    - RFC-2821 standard compliance;
    - Greylisting results header builder.

Install
=======

  Requirements: Linux (and presumably other Unix-like OSen), Sendmail
v8.11 and higher compiled with the MILTER API support enabled,
Sendmail Development Kit, POSIX threads library, PostgreSQL.

  Edit the Makefile according to version of your Sendmail program and OS.

  Under the root account:
make
make install

  Inspect and edit the /etc/mail/smfs/smf-grey.conf file.

/usr/local/sbin/smf-grey
or
/usr/local/sbin/smf-grey -c /etc/mail/smfs/smf-grey.conf

Create smfs Unix user and group accounts

Create PostgreSQL user, database, and configuration (see first five lines of postgres.sql)
Consider other whitelist entries or configuration after reading and understanding the
sql file.

Add this milter to start-up scripts before starting of the Sendmail daemon.

Add the perl script to a nightly cron job

Add these lines to your Sendmail configuration file (usually sendmail.mc):

INPUT_MAIL_FILTER(`smf-sql-grey', `S=local:/var/run/smfs/smf-sql-grey.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
define(`confMILTER_MACROS_CONNECT',`b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl
define(`confMILTER_MACROS_ENVRCPT',`r, v, Z')

mkdir /proj/sandbox/mail/var/run/smfs
chown smfs.smfs /proj/sandbox/mail/var/run/smfs
chmod 755 /proj/sandbox/mail/var/run/smfs

IMPORTANT: make sure that /var/run is not a group writable directory! If so,
or chmod 755 /var/run, or if it's impossible switch to another directory.

Rebuild of your Sendmail configuration file and restart the Sendmail daemon.

Notes: successfully authenticated senders will bypass the Greylisting.

The smf-grey people suggest it would be very useful to add at your
Sendmail configuration file these lines:

define(`confPRIVACY_FLAGS', `goaway,noetrn,nobodyreturn,noreceipts')dnl
define(`confTO_COMMAND', `1m')dnl
define(`confTO_IDENT', `0s')dnl
define(`confMAX_DAEMON_CHILDREN', `256')dnl enlarge if it's required
define(`confCONNECTION_RATE_THROTTLE', `8')dnl enlarge if it's required
define(`confBAD_RCPT_THROTTLE', `1')dnl Sendmail v8.12+
FEATURE(`greet_pause', `5000')dnl Sendmail v8.13+
