Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
quotas [2012-06-11 09:18] – created randerson | quotas [2015-06-01 10:09] (current) – Clarified example nkukard | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Quota===== | + | ====== Quota ====== |
Quota support for Policyd v2. This module supports message count and message cumulative size over a user defined period of time. | Quota support for Policyd v2. This module supports message count and message cumulative size over a user defined period of time. | ||
Line 6: | Line 7: | ||
See an explanation at the bottom of this page regarding counters. | See an explanation at the bottom of this page regarding counters. | ||
- | ====Quotas Configuration==== | + | ===== Quotas Configuration ===== |
- | ===Tracking | + | |
- | ==Policy== | + | ==== Tracking |
+ | |||
+ | === Policy === | ||
* Track counters using the policy. All mail hitting this policy will be tracked in a single counter. | * Track counters using the policy. All mail hitting this policy will be tracked in a single counter. | ||
- | ==Sender== | + | === Sender === |
* SenderIP:/ | * SenderIP:/ | ||
* One can specify a bitmask to apply to the sending servers' | * One can specify a bitmask to apply to the sending servers' | ||
Line 29: | Line 34: | ||
* 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 orginating from this user portion will be matched. | * 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 orginating from this user portion will be matched. | ||
- | ==Recipient== | + | === Recipient === |
* Recipient: | * Recipient: | ||
* A counter will be created for each recipient email address and counters for each individual recipient will be tracked. | * A counter will be created for each recipient email address and counters for each individual recipient will be tracked. | ||
Line 39: | Line 45: | ||
* 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. | * 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=== | + | ==== Further Configuration |
* MessageCount | * MessageCount | ||
Line 50: | Line 56: | ||
* 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 ' | * 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 ' | ||
- | ====Server Configuration==== | + | ===== Server Configuration |
Configuration for this module is done in the [Quotas] section in the configuration file. | Configuration for this module is done in the [Quotas] section in the configuration file. | ||
Line 56: | Line 62: | ||
* Set to 1 if you wish to enable this module. Default 0 (disabled). | * Set to 1 if you wish to enable this module. Default 0 (disabled). | ||
- | __Complete Example__ | + | ==== Complete Example ==== |
- | The below example demonstrates how to limit the number of outbound emails per hour to 3600. | + | The following |
- | < | + | < |
+ | Policy: Default Outbound Policy | ||
Track: Sender: | Track: Sender: | ||
Period: 3600 | Period: 3600 | ||
Line 67: | Line 74: | ||
Type: MessageCount | Type: MessageCount | ||
- | CounterLimit: | + | CounterLimit: |
+ | </ | ||
- | Quota counters example | + | Quota counters example: |
- | < | + | |
+ | < | ||
+ | 1. Counter = DBValue | ||
2. ElapsedTime = Now - LastUpdate | 2. ElapsedTime = Now - LastUpdate | ||
3. IF ElapsedTime > Period THEN CurrentCounter = 0 ELSE CurrentCounter = ( 1 - (ElapsedTime / Period) ) * Counter | 3. IF ElapsedTime > Period THEN CurrentCounter = 0 ELSE CurrentCounter = ( 1 - (ElapsedTime / Period) ) * Counter | ||
Line 76: | Line 86: | ||
5. CurrentCounter++ | 5. CurrentCounter++ | ||
6. IF CurrentCounter > Limit THEN | 6. IF CurrentCounter > Limit THEN | ||
- | 7. DBValue += Delta (+1)</ | + | 7. DBValue += Delta (+1) |
+ | </ | ||
+ | |||
+ | Consider the following if Counter is currently 8 and the Period is 300: | ||
- | Consider the following if Counter is currently 8: | + | < |
- | < | + | Counter = 8 |
ElapsedTime = 13:29:57 - 13:26:22 = 215 | ElapsedTime = 13:29:57 - 13:26:22 = 215 | ||
CurrentCounter = ( 1 - (215 / 300) ) * 8 = 2.27 | CurrentCounter = ( 1 - (215 / 300) ) * 8 = 2.27 | ||
Delta = 2.27 - 8 = -5.73 | Delta = 2.27 - 8 = -5.73 | ||
* * allow mail .... CurrentCounter (+1) < Limit * * | * * allow mail .... CurrentCounter (+1) < Limit * * | ||
- | DBValue += -5.73 (+1) = 3.27</ | + | DBValue += -5.73 (+1) = 3.27 |
+ | </ |