Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
policies [2012-06-08 13:32] – [Priorities] randersonpolicies [2013-12-06 10:18] (current) – Fix formatting rspencer
Line 1: Line 1:
-=====About=====+====== Policies ====== 
 This internal module is responsible for processing policy specifications. This internal module is responsible for processing policy specifications.
  
 Policy specifications can be specified for both Source and Destination. IP address specifications are however not valid in the Destination specification. Specifications can be formatted in the below manner and can be comma-separated to generate the equivalent of an AND. All specifications with the exception of the ANY match support negation by prefixing the specification with ! Policy specifications can be specified for both Source and Destination. IP address specifications are however not valid in the Destination specification. Specifications can be formatted in the below manner and can be comma-separated to generate the equivalent of an AND. All specifications with the exception of the ANY match support negation by prefixing the specification with !
  
-=====Priorities=====+===== Priorities ===== 
 Priorities are processed in an ascending fashion, this means that 0 will be processed before 1, 10 before 20 etc. Priorities are processed in an ascending fashion, this means that 0 will be processed before 1, 10 before 20 etc.
  
-=====Specifications===== +===== Specifications =====
-NULL or "any" +
-This will match anything.+
  
 +Match **anything**
 +
 +<code>
 +NULL
 +any
 +</code>
 +
 +Match all email @**domain**
 +
 +<code>
 @domain @domain
-This will match all email @domain.+</code> 
 + 
 +Match all email user@domain
  
 +<code>
 user@domain user@domain
-This will match all email user@domain.+</code>
  
 +Match < >.
 +
 +<code>
 @ @
-(present in r412+ and v2.1.x)+</code> 
 + 
 +  * present in r412+ and v2.1.x
  
-This will match < >.+Match a single sending server IP address
  
 +<code>
 a.b.c.d a.b.c.d
-Matches a single sending server IP address.+</code>
  
 +Match a CIDR formatted range of sending server IP addresses
 +
 +<code>
 a.b.c.d/e a.b.c.d/e
-Matches a CIDR formatted range of sending server IP addresses.+</code>
  
-(Additional options for r493+ and v2.1.x)+  * Additional options for r493+ and v2.1.x 
 +  * Refer to IP address specification
  
-Refer to IP Address Specification.+Match a single **peer** server IP address. This **does not** match the IP address of the server where the email came from, this matches the IP address of the server which requested the policy.
  
 +<code>
 [a.b.c.d] [a.b.c.d]
-(present in r413+ and v2.1.x)+</code>
  
-Matches a single peer server IP addressThis DOES NOT match the IP address of the server where the email came from, this matches the IP address of the server which requested the policy.+  * present in r413+ and v2.1.x
  
 +Match a CIDR formatted range of peer server IP addresses. This **does not** match the IP address of the server where the email came from, this matches the IP address of the server which requested the policy.
 +
 +<code>
 [a.b.c.d/e] [a.b.c.d/e]
-(present in r413+ and v2.1.x)+</code>
  
-Matches a CIDR formatted range of peer server IP addressesThis DOES NOT match the IP address of the server where the email came from, this matches the IP address of the server which requested the policy.+  * present in r413+ and v2.1.x 
 +  * Additional options for r493+ and v2.1.x 
 +  * Refer to IP Address Specification.
  
-(Additional options for r493+ and v2.1.x) +Match an IPv6 range of sending server IP addressesBitmask is optional. The bitmask defaults to 128 if the IPv6 address contains all octets or if the right most octet is specified. If there is no octet on the right hand side of a :: , the bitmask is automatically calculated depending on how many bits are left out. Refer to IP Address Specification for additional formats.
- +
-Refer to IP Address Specification.+
  
 +<code>
 a:b:c:d:e:f:g:h[/e] a:b:c:d:e:f:g:h[/e]
-(present in r493+ and v2.1.x)+</code>
  
-Matches an IPv6 range of sending server IP addressesBitmask is optional. The bitmask defaults to 128 if the IPv6 address contains all octets or if the right most octet is specified. If there is no octet on the right hand side of a :: , the bitmask is automatically calculated depending on how many bits are left out. Refer to IP Address Specification for additional formats.+  * present in r493+ and v2.1.x
  
 +Match an IPv6 range of peer server IP addresses. This DOES NOT match the IP address of the server where the email came from. this matches the IP address of the server which requested the policy. The bitmask defaults to 128 if the IPv6 address contains all octets or if the right most octet is specified. If there is no octet on the right hand side of a :: , the bitmask is automatically calculated depending on how many bits are left out. Refer to IP Address Specification for additional formats.
 +
 +<code>
 [a:b:c:d:e:f:g:h[/e] [a:b:c:d:e:f:g:h[/e]
-(present in r493+ and v2.1.x)+</code> 
 + 
 +  * present in r493+ and v2.1.x
  
-Matches an IPv6 range of peer server IP addresses. This DOES NOT match the IP address of the server where the email came fromthis matches the IP address of the server which requested the policy. The bitmask defaults to 128 if the IPv6 address contains all octets or if the right most octet is specifiedIf there is no octet on the right hand side of a :: the bitmask is automatically calculated depending on how many bits are left outRefer to IP Address Specification for additional formats.+Match a group which, in turn, can comprise of a list of any of the above specification types including groupsPolicyd cycles through the group members recursively and looks for an item to matchMaking groups ideal for cases where  you could have any number of negative results before matching, or large pool of matching members, depending on your set upEffectively, this is a way to accomplish a type of OR "select".
  
 +<code>
 %group %group
-Matches a group, which in turn can comprise of a list of any of the above specification types including groups.+</code>
  
 +Match a SASL username. You can also use $* to match any SASL username and $- to match no SASL username.
 +
 +<code>
 $sasl_username $sasl_username
-This will match a SASL username. You can also use $* to match any SASL username and $- to match no SASL username.+</code>
  
-whatever.example.com +Match the reverse dns of the IP where the client is connecting from.
-This will match the reverse dns of the IP where the client is connecting from.+
  
-- You can use * as a wildcard match against anything except the ., for example hello.*.example.com . You can use * as much as you like. +<code> 
-- Specifying example.com will only match example.com +whatever.example.com 
-- Specifying .example.com will match anything.example.com and fu.bar.example.com+</code>
  
-As a technical note, * is expanded into [a-z0-9\-_\.] and if . doesn't prefix the specification it gets ^. All reverse dns specifications are matched with end of line $ at the end.+  * You can use * as a wildcard match against anything except the ., for example hello.*.example.com 
 +  * Specifying example.com will only match example.com 
 +  * Specifying .example.com will match anything.example.com and fu.bar.example.com 
 +  * As a technical note, * is expanded into [a-z0-9\-_\.] and if . doesn't prefix the specification it gets ^. All reverse dns specifications are matched with end of line $
  
-Complete Example+===== Examples =====
  
-The pre-configured default polices are defiend as follows...+The preconfigured default polices are defined as follows:
  
 +<code>
 Default System Policy Default System Policy
 Priority: 0 Priority: 0
 Source: ANY Source: ANY
 Desination: ANY Desination: ANY
 +</code>
  
 +<code>
 Default Outbound Policy Default Outbound Policy
 Priority: 10 Priority: 10
 Source: %internal_ips,%internal_domains Source: %internal_ips,%internal_domains
 Destination: !%internal_domains Destination: !%internal_domains
 +</code>
  
 +<code>
 Default Inbound Policy Default Inbound Policy
 Priority: 10 Priority: 10
 Source: !%internal_ips,!%internal_domains Source: !%internal_ips,!%internal_domains
 Destination: %internal_domains Destination: %internal_domains
 +</code>
  
 +<code>
 Default Internal Policy Default Internal Policy
 Priority: 20 Priority: 20
 Source: %internal_ips,%internal_domains Source: %internal_ips,%internal_domains
 Destination: %internal_domains Destination: %internal_domains
 +</code>
  
-These groups are defined in the following manner...+These groups are defined in the following manner:
  
 +<code>
 internal_ips internal_ips
 10.0.0.0/8 10.0.0.0/8
 +</code>
  
 +<code>
 internal_domains internal_domains
 example.org example.org
 example.com example.com
 example.net example.net
 +</code>