Table of Contents

Policies

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

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

Specifications

Match anything

NULL
any

Match all email @domain

@domain

Match all email user@domain

user@domain

Match < >.

@

Match a single sending server IP address

a.b.c.d

Match a CIDR formatted range of sending server IP addresses

a.b.c.d/e

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.

[a.b.c.d]

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.

[a.b.c.d/e]

Match 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]

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.

[a:b:c:d:e:f:g:h[/e]

Match a group which, in turn, can comprise of a list of any of the above specification types including groups. Policyd cycles through the group members recursively and looks for an item to match. Making groups ideal for cases where you could have any number of negative results before matching, or a large pool of matching members, depending on your set up. Effectively, this is a way to accomplish a type of OR "select".

%group

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

$sasl_username

Match the reverse dns of the IP where the client is connecting from.

whatever.example.com

Examples

The preconfigured default polices are defined 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