CWL and CBL

Description

The Custom Black List (CBL) and Custom White List (CWL) are per-recipient-domain black-/ or whitelists. This is basically a re-implementation of postfix built in smtpd_restriction_classes. If you prefer those, use them! There are various use cases which require those kind of recipient domain based black-/whitelists. If you can't think of any (eg if you run a mail server for your company with only "global" black-/whitelists) you probably don't need them.


Configuration

use_negative_cache

Default: 0
Allowed values: 0, 1

Cache entries for database misses will be written, too. Depending on the kind of SPAM you receive, it might fill your cache very fast (and triggers invalidation far to early) or not.

tables

Default: empty
Allowed values: array of [ 'ips', 'domains', 'addresses' ]

There are three kind of tables which could be used for lookups:

Usage Suggestion

Put the CWL in front of the CBL and DNSBL. The CBL can be used before or after DNSBL, but for the it is faster than DNSBL (no name resolution and probably small dataset), so better before DNSBL.

Database

This module uses the database. Here is the SQL example for creating the tables. It is written in SQLite, but should be usable with small or no modifications in most supported RDBS.

CBL

-- TABLE: cbl_domains (SQLITE):
CREATE TABLE CBL_DOMAINS (sender_domain varchar(255), recipient_domain varchar(255),
    id INTEGER PRIMARY KEY);

CREATE UNIQUE INDEX CBL_DOMAINS_RECIPIENT_DOMAIN_SENDER_DOMAIN
    ON CBL_DOMAINS (recipient_domain, sender_domain);

-- TABLE: cbl_addresses (SQLITE):
CREATE TABLE CBL_ADDRESSES (sender_address varchar(255), recipient_domain varchar(255),
    id INTEGER PRIMARY KEY);

CREATE UNIQUE INDEX CBL_ADDRESSES_RECIPIENT_DOMAIN_SENDER_ADDRESS ON CBL_ADDRESSES
    (recipient_domain, sender_address);

-- TABLE: cbl_ips (SQLITE):
CREATE TABLE CBL_IPS (client_address varchar(39), recipient_domain varchar(255),
    id INTEGER PRIMARY KEY);

CREATE UNIQUE INDEX CBL_IPS_RECIPIENT_DOMAIN_CLIENT_ADDRESS ON CBL_IPS (recipient_domain,
    client_address);

CWL

-- TABLE: cwl_domains (SQLITE):
CREATE TABLE CWL_DOMAINS (sender_domain varchar(255), recipient_domain varchar(255),
    id INTEGER PRIMARY KEY);

CREATE UNIQUE INDEX CWL_DOMAINS_RECIPIENT_DOMAIN_SENDER_DOMAIN ON CWL_DOMAINS
    (recipient_domain, sender_domain);

-- TABLE: cwl_addresses (SQLITE):
CREATE TABLE CWL_ADDRESSES (sender_address varchar(255), recipient_domain varchar(255),
    id INTEGER PRIMARY KEY);

CREATE UNIQUE INDEX CWL_ADDRESSES_RECIPIENT_DOMAIN_SENDER_ADDRESS ON CWL_ADDRESSES
    (recipient_domain, sender_address);

-- TABLE: cwl_ips (SQLITE):
CREATE TABLE CWL_IPS (client_address varchar(39), recipient_domain varchar(255),
    id INTEGER PRIMARY KEY);

CREATE UNIQUE INDEX CWL_IPS_RECIPIENT_DOMAIN_CLIENT_ADDRESS ON CWL_IPS (recipient_domain,
    client_address);

Example

For CBL and CWL alike

---

disable: 0

use_negative_cache: 1

tables:
    - ips
    - domains
    - addresses

Performance

Depending on your database, but should be very fast.