Quota support for Policyd v2. This module supports message count and message cumulative size over a user defined period of time.
Message counters can be based on (tracked) depending on sender, recipient or sender IP. It works in the following manner… One defines a quota linked to a policy, you then set how this quota is going to be tracked using the below "Track"ing options, a period is provided over which time the limits will apply. Limits are then defined and linked against the quota, a counter type (described below) is supplied along with the counter limit.
See an explanation at the bottom of this page regarding counters.
Configuration for this module is done in the [Quotas] section in the configuration file.
The following example demonstrates how to limit the number of outbound emails per hour to 3600:
Policy: Default Outbound Policy Track: Sender:user@domain Period: 3600 # Associate a limit: Type: MessageCount CounterLimit: 3600
Quota counters example:
1. Counter = DBValue 2. ElapsedTime = Now - LastUpdate 3. IF ElapsedTime > Period THEN CurrentCounter = 0 ELSE CurrentCounter = ( 1 - (ElapsedTime / Period) ) * Counter 4. Delta = CurrentCounter - Counter 5. CurrentCounter++ 6. IF CurrentCounter > Limit THEN 7. DBValue += Delta (+1)
Consider the following if Counter is currently 8 and the Period is 300:
Counter = 8 ElapsedTime = 13:29:57 - 13:26:22 = 215 CurrentCounter = ( 1 - (215 / 300) ) * 8 = 2.27 Delta = 2.27 - 8 = -5.73 * * allow mail .... CurrentCounter (+1) < Limit * * DBValue += -5.73 (+1) = 3.27