Next: , Previous: , Up: Library   [Contents][Index]

5.27 Control Database

Control database is a DBM file whose records define actions to be taken for mails coming from particular IP or email addresses. Functions and variables for using the control database are defined in module cdb.mfl.

cdb variable: string cdb_name

Name of the database file to use as control database. By default it is /etc/mail/mfctl.db.

cdb variable: number cdb_greylist_interval

Greylisting interval, for database records that prescribe greylisting (see below). Defaults to 900 seconds.

Library Function: void cdb_check (string prefix, string addr)

Perform a look up in the database. If the value is found, take the action it indicates.

The key to use for the look up depends on the value of prefix:

ip

The addr argument must be an IP address. The look up key is ‘ip:addr’.

email

The addr argument is an email address. The key is ‘email:cemail’, where cemail is addr in canonical form, obtained by converting its domain part to lower case.

domain

The addr argument is an email address. The key is formed as ‘domain:dom’, where dom is domain part of addr converted to lower case.

subdomain

Initial key value is obtained as for ‘domain’. If the key is found, the requested action is performed. Otherwise, the shortest hostname prefix (sequence of characters up to and including the first dot) is stripped off the domain and the process is retried.

Thus, the action is determined by the longest subdomain of addr, x, for which the key ‘domain:x’ exists in the database.

mx

If addr is an email address, its domain part is selected, otherwise it is used as is. The list of MX servers for this domain is obtained. For each host from that list the key ‘mx:host’ is looked up. First entry found is used.

The function cdb_check returns if the key was not found in the database or if the value found was ‘OK’ (case-insensitive) or empty. Otherwise, the looked up value determines the action (see reply actions), as described in the following table. The action is returned and execution of the filter program stops.

CONTINUE

Continue to the next milter state. See continue.

ACCEPT

Accept the mail. See accept.

REJECT

Reject the mail. See reject.

TEMPFAIL

Return a temporary failure. See tempfail.

GREYLIST

Greylist the mail using the interval defined by the cdb_greylist_interval variable. If called in envrcpt handler, the action is taken immediately. Otherwise, if called in connect, helo or envfrom, the action is delayed until envrcpt is invoked. Otherwise, if called in any other handler an error is reported.

code xcode text
code text
text

Here, code is SMTP response code, xcode is extended STMP response code, and text is an arbitrary text. If code is given, it must begin with ‘4’ or ‘5’. Its first digit defines the action to be taken: temporary failure (if ‘4’) or reject (if ‘5’). If xcode is given, its first digit must match that of code.

If only text is supplied, it is equivalent to

reject(550, 5.1.0, text)

Next: , Previous: , Up: Library   [Contents][Index]