The greylist tar ball contains a sample greylist.cfg file. Copy this to /etc/greylist.cfg and edit it to suit your needs.
The greylist configuration file (/etc/greylist.cfg) holds a list of objects. These objects define what greylist does with incoming triplets, how to compare them with the database backend, what TCP port to listen on and all other settings. A typical object definition looks like this:
[object] property1=value property2=value ..
The different parts of greylist are initialised and processed in the same order as they are defined in the configuration file. Which means that in order to use a particular object it must have been defined previously. For example:
[object1] name=myname .. [object2] use=myname ..
This does not work if [object2] is defined before [object1].
Currently supported objects:
- (rw)Essential data storage backend - can be anything supported by libdbi (MySQL, PostgreSQL, SQLite/SQLite3, Firebird/Interbase, FreeTDS/MS SQL/Sybase, (Ingres, mSQL, Oracle).
- Provides access to a part of a backend - e.g. a table in a database, depends on a backend
- Method to match an incoming triplet against a datasource - e.g. match all triplets against the triplet table (allmatch) or the recipient address against a whitelist table, depends on a datasource .
- Decides what action to take if a match was found - e.g. whitelist an incoming triplet or greylist it.
- This configures the TCP server and resource management
Below is a simple greylist configuration file. It defines this structure:
TCP server on port 4096 | MySQL Database | Datasource | +- Match recipient address and whitelist | +- Greylist
[database] name=greylistdb type=mysql host=localhost dbname=greylist username=root password= [datasource] type=db name=tripletds table=triplet database=greylistdb [datasource] type=db name=recipientds table=recipient database=greylistdb [match] name=recipient match type=cached exact match lookup=address match=recipient return=comment datasource=recipientds [policy] type=whitelist match=recipient match [match] name=allmatch type=all [policy] type=greylist mode=reverse match=allmatch datasource=tripletds weakbytes=3 timeout=60 [server] listen=0.0.0.0 #default port=4096 #default sparethreads=2 maxthreads=150 maxrequests=0 cacherefresh=50 poolrefresh=10 log=full deferwithstatus=true defer=defer_if_permit Service is unavailable dunno=dunno onerror=dunno stats=1