Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revisionBoth sides next revision
quotas [2012-06-11 09:18] – created randersonquotas [2013-12-06 12:10] – Fix formatting rspencer
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 options=== + 
-==Policy==+==== Tracking Options ==== 
 + 
 +=== 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:/bitmask   * SenderIP:/bitmask
     * One can specify a bitmask to apply to the sending servers' IP address, for instance /24. This will track the triplet through the entire /24 block. SenderIP's bitmask can be any bitmask, 1-32. A sane value is /24.     * One can specify a bitmask to apply to the sending servers' IP address, for instance /24. This will track the triplet through the entire /24 block. SenderIP's bitmask can be any bitmask, 1-32. A sane value is /24.
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:user@domain   * Recipient:user@domain
     * 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 'yes' for the 5th policy, it will not continue through the rest of the matching quotas.     * 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' for the 5th policy, it will not continue through the rest of the matching quotas.
  
-====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 example demonstrates how to limit the number of outbound emails per hour to 3600:
  
-<code>Policy: Default Outbound Policy+<code> 
 +Policy: Default Outbound Policy
 Track: Sender:user@domain Track: Sender:user@domain
 Period: 3600 Period: 3600
Line 67: Line 74:
  
 Type: MessageCount Type: MessageCount
-CounterLimit: 3600</code>+CounterLimit: 3600 
 +</code>
  
-Quota counters example +Quota counters example
-<code>1. Counter = DBValue+ 
 +<code> 
 +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)</code>+7. DBValue += Delta (+1) 
 +</code>
  
 Consider the following if Counter is currently 8: Consider the following if Counter is currently 8:
-<code>Counter = 8+ 
 +<code> 
 +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</code>+DBValue += -5.73 (+1) = 3.27 
 +</code>