chapps.spf_policy module

SPF Enforcement policy manager

Isolated here to prevent the core codebase from depending upon the SPF libraries.

class chapps.spf_policy.SPFEnforcementPolicy[source]

Bases: chapps.policy.EmailPolicy

Policy manager which enforces SPF policy

Instance attributes (in addition to those of EmailPolicy):

actions

a PostfixSPFActions instance

Behavior of the SPF enforcer is configured under the [PostfixSPFActions] heading in the config file.

redis_key_prefix = 'spf'

For completeness. SPF is not expected to use Redis.

__init__(cfg=None)[source]

Setup an SPF enforcement policy manager

Parameters

cfg (chapps.config.CHAPPSConfig) – optional config override

approve_policy_request(ppr)[source]

Perform SPF enforcement decision-making

Parameters

ppr (PostfixPolicyRequest) – a Postfix payload

Return type

str

Returns

a string which contains a Postfix instruction

The PostfixSPFActions class translates between the outcome of the SPF check and the configured response thus indicated, which gets sent back to Postfix.