This is an old revision of the document!


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 !

Priorities are processed in an ascending fashion, this means that 0 will be processed before 1, 10 before 20 etc.

NULL or "any" This will match anything.

@domain This will match all email @domain.

user@domain This will match all email user@domain.

@ (present in r412+ and v2.1.x)

This will match < >.

a.b.c.d Matches a single sending server IP address.

a.b.c.d/e Matches a CIDR formatted range of sending server IP addresses.

(Additional options for r493+ and v2.1.x)

Refer to IP Address Specification.

[a.b.c.d] (present in r413+ and v2.1.x)

Matches 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.

[a.b.c.d/e] (present in r413+ and v2.1.x)

Matches 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.

(Additional options for r493+ and v2.1.x)

Refer to IP Address Specification.

a:b:c:d:e:f:g:h[/e] (present in r493+ and v2.1.x)

Matches an IPv6 range of sending server IP addresses. Bitmask 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.

[a:b:c:d:e:f:g:h[/e] (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 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.

%group Matches a group, which in turn can comprise of a list of any of the above specification types including groups.

$sasl_username This will match a SASL username. You can also use $* to match any SASL username and $- to match no SASL username.

whatever.example.com 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. - 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 $ at the end.

Complete Example

The pre-configured default polices are defiend as follows…

Default System Policy Priority: 0 Source: ANY Desination: ANY

Default Outbound Policy Priority: 10 Source: %internal_ips,%internal_domains Destination: !%internal_domains

Default Inbound Policy Priority: 10 Source: !%internal_ips,!%internal_domains Destination: %internal_domains

Default Internal Policy Priority: 20 Source: %internal_ips,%internal_domains Destination: %internal_domains

These groups are defined in the following manner…

internal_ips 10.0.0.0/8

internal_domains example.org example.com example.net