Clamd-Greylist is a PostgreSQL implementation of a greylist interface for clamd-queue. Clamd-greylist does not enforce any greylist policy, but rather expects your database or other programs to enforce such policies as described below.
This variable determines the amount of data that both clamd-queue and clamd-greylist spit out on stderr during processing. The default value is 1, which logs only errors. Values of 2 and 3 produce other useful information, including the results of greylisting and scanning operations. Values above 4 print runtime configuration information and a value of 8 prints all debugging messages.
This file is read to obtain the connection string required to connect to the greylist database. This string
is passed unaltered to PQconnectdb(). lease see the PostgreSQL API documentation for a list of parameters, or
try this example:
host=sql.domain.com dbname=greylist_db user=username password=password sslmode=require
The databased used by clamd-greylist must contain two tables:
whitelist_table { ts timestamp host varchar(39) } greylist_table { ts timestamp host varchar(39) addr bytea }
And two views:
whitelist_view { host (from whitelist_table host) } greylist_view { host (from greylist_table host) addr (from greylist_table addr) }
In the simplest case, the views can be defined as:
SELECT host FROM whitelist_table;
and:
SELECT host, addr FROM greylist_table;
Though your greylist policy likely dictates a more complex select statement.
There are three basic greylist policy decisions:
While you're welcome to make whatever policy decisions you like, I recommend:
Given the 1st policy above, I would write my view select statements as:
SELECT host FROM whitelist_table;
and:
SELECT host, addr FROM greylist_table WHERE ts < now()-'5 minutes'::interval;
So that messages that have been greylisted in the past 5 minutes are not
shown in greylist_view.
To enforce the 2nd and 3rd policies I would create daily cron jobs that run the following SQL statements:
DELETE FROM whitelist_table WHERE ts < now()-'1 year'::interval;
DELETE FROM greylist_table WHERE ts < now()-'12 hours'::interval;
These policies could also be enforced directly with the view, but deleting old entires will keep the
database from growing too large, and will help keep the view select statements speedy.