SYNOPSIS

    use Courier::Filter::Module::SPFout;

    my $module = Courier::Filter::Module::SPFout->new(
        match_on            => ['fail', 'permerror', 'temperror'],
        default_response    => $default_response_text,
        force_response      => $force_response_text,
        outbound_ip_addresses
                            => ['129.257.16.1', '2001:6ag:10e1::1'],
        spf_options         => {
            # any Mail::SPF::Server options
        },

        logger      => $logger,
        inverse     => 0,
        trusting    => 0,
        testing     => 0,
        debugging   => 0
    );

    my $filter = Courier::Filter->new(
        ...
        modules     => [ $module ],
        ...
    );

DESCRIPTION

This class is a filter module for use with Courier::Filter. It matches a message if any of the receiving (local) machine's outbound \s-1IP\s0 addresses are not authorized to send mail from the envelope sender's (\s-1MAIL\s0 \s-1FROM\s0) domain according to that domain's \s-1DNS\s0 \s-1SPF\s0 (Sender Policy Framework) record. This is outbound \s-1SPF\s0 checking.

The point of inbound \s-1SPF\s0 checking is for message submission agents (MSAs, smarthosts) to protect others against forged envelope sender addresses in messages submitted by the \s-1MSA\s0's users.

Constructor

The following constructor is provided:

new(%options): returns Courier::Filter::Module::SPFout

Creates a new SPFout filter module. %options is a list of key/value pairs representing any of the following options:

trusting

Disabled. Since outbound \s-1SPF\s0 checking, as opposed to inbound \s-1SPF\s0 checking, is applied to trusted (authenticated) messages only, setting this module to be trusting does not make sense. This property is thus locked to false. Also see the description of Courier::Message's \*(C`trusted\*(C' property .

match_on

A reference to an array containing the set of \s-1SPF\s0 result codes which should cause the filter module to match a message. Possible result codes are \*(C`pass\*(C', \*(C`fail\*(C', \*(C`softfail\*(C', \*(C`neutral\*(C', \*(C`none\*(C', \*(C`permerror\*(C', and \*(C`temperror\*(C'. See the \s-1SPF\s0 specification for details on the meaning of those. If \*(C`temperror\*(C' is listed, an \*(C`temperror\*(C' result will by definition never cause a permanent rejection, but only a temporary one. Defaults to ['fail', 'permerror', 'temperror']. Note: With early \s-1SPF\s0 specification drafts as well as the obsolete Mail::SPF::Query module, the \*(C`permerror\*(C' and \*(C`temperror\*(C' result codes were known as \*(C`unknown\*(C' and \*(C`error\*(C', respectively; the old codes are now deprecated but still supported for the time being.

default_response

A string that is to be returned as the module's match result in case of a match, that is when the \*(C`match_on\*(C' option includes the result code of the \s-1SPF\s0 check (by default when a message fails the \s-1SPF\s0 check). However, this default response is used only if the (claimed) envelope sender domain does not provide an explicit response. See \*(L"default_authority_explanation\*(R" in Mail::SPF::Server for more information. \s-1SPF\s0 macro substitution is performed on the default response, just like on explanations provided by domain owners. If undef, Mail::SPF's default explanation will be used. Defaults to undef.

force_response

Instead of merely specifying a default response for cases where the sender domain does not provide an explicit response, you can also specify a response to be used in all cases, even if the sender domain does provide one. This may be useful if you do not want to confuse your own users with 3rd-party provided explanations when in fact they are only dealing with your server not wanting to relay their messages. Defaults to undef.

outbound_ip_addresses

A reference to an array containing the local system's set of outbound \s-1IP\s0 addresses that will be assumed as the sender \s-1IP\s0 address in outbound \s-1SPF\s0 checks. This set should include all public \s-1IP\s0 addresses that are used for relaying mail. By default, automatic discovery of one public \s-1IP\s0 address that is \*(L"en route\*(R" to \*(L"the internet\*(R" is attempted for each of IPv4 and IPv6. Auto-discovery does not work from behind NATs.

spf_options

A hash-ref specifying options for the Mail::SPF server object used by this filter module. See \*(L"new\*(R" in Mail::SPF::Server for the supported options.

All options of the Courier::Filter::Module constructor (except for the trusting option) are also supported. Please see \*(L"new\*(R" in Courier::Filter::Module for their descriptions.

Instance methods

See \*(L"Instance methods\*(R" in Courier::Filter::Module for a description of the provided instance methods.

RELATED TO Courier::Filter::Module::SPFout…

Courier::Filter::Module::SPF, Courier::Filter::Module, Courier::Filter::Overview, Mail::SPF.

For \s-1AVAILABILITY\s0, \s-1SUPPORT\s0, and \s-1LICENSE\s0 information, see Courier::Filter::Overview.

REFERENCES

\s-1SPF\s0 website (Sender Policy Framework)

<http://www.openspf.org>

\s-1SPF\s0 specification

<http://www.openspf.org/Specifications>

AUTHOR

Julian Mehnle <[email protected]>