Table of Contents

Accounting Configuration

Accounting support from r343 (v2.1.0). This module supports message count and message cumulative size over a fixed period of time. Message counters can be based on (Tracked) depending on sender, recipient or sender IP.

Tracking Options

Policy

Policy:
Track counters using the policy. All mail hitting this policy will be tracked in a single counter.

Policy: Default Outbound Policy

Sender

Sender: IP:/bitmask
Track counters using the sending IP masked with the bitmask provided. For instance if the sender's IP is 192.168.0.10 and the bitmask is /24 then the key in the database will be 192.168.0.0/24 and mail coming from that entire class-c or /24 will be tracked. (Support for IPv6 is included in r493+, v2.1.x).

Specifying any IPv6 bitmask, 1-128 will apply the bitmask to the sending server's IP address. A sane value for this is /64. When using accounting on both IPv4 and IPv6, please ensure you use the IPv4 policy member 0.0.0.0/0 (or 0/0) and the IPv6 policy member ::/0 to distinguish between the two so you get the bitmask right.

SASLUsername
Track counters using the SASL username the user is logged in with. For email where the SASL username is unspecified, the tracking key will be set to "SASLUsername:-", so it may be in your best interest to adjust your policy to ONLY match email which has a SASL username unless this is your intention.

Sender: user@domain
A counter will be created for each sender email address and counters for each individual sender will be tracked.

Sender: @domain
A counter will be created for each sender domain, each domain is tracked on its own and all email sent from these domains will be tracked and matched.

Sender: user@
A counter will be created for each sender user part of the domain, each user is tracked on its own just like the domain \ above. Any email originating from this user portion will be matched.

Recipient

Recipient: user@domain
A counter will be created for each recipient email address and counters for each individual recipient will be tracked.

Recipient: @domain
A counter will be created for each recipient domain, each domain is tracked on its own and all email sent from these domains will be tracked and matched.

Recipient: user@
A counter will be created for each recipient user part of the domain, each user is tracked on its own just like the domain above. Any email destined to this user portion will be matched.

Further Configuration

AccountingPeriod
Period over which to account traffic [Day(0) , Week(1) or Month(2)].

MessageCountLimit
Message count, in other words the number of email messages.

MessageCumulativeSizeLimit
Cumulative size of email messages, or you could say bandwidth used. This number is in Kbytes NOT bytes, with the minimum size per email of 1Kbyte.

Verdict
REJECT, ALLOW, HOLD, DEFER, DISCARD, FILTER or REDIRECT.

Data\\. Text that will be sent along with verdict

LastAccounting
(Present in r348+ and v2.1.x).

The first policy matched will be the only one that gets used, if you have 10 policies ranging from 1 to 10 in priority and you set this to 'yes'(1) for the 5th policy, it will not continue through the rest and add up the accounting records as it normally would do.

defaults to no(0)

Server Configuration

Configuration for this module is done in the [Accounting] section in the configuration file.

enable
Set to 1 if you wish to enable this module. Default 0 (disabled).

enable=1

Complete Example

The below example demonstrates how to limit the number of outbound emails per hour to 3600.

Limit number of outbound mails per sender to 10,000 per month...
Policy: Default Outbound Policy
Track: Sender:user@domain
Period: Monthly
MessageCountLimit: 10000
MessageSizeLimit: <leave blank>
Verdict: REJECT
Data: "Account limit exceeded"