IMSVA 9.x SPF SOP
IMSVA 9.x SPF SOP
Configuration Guide
1. Introduction
SPF (Sender Policy Framework) is an open standard which provides solutions to resist sender
address forgery. Organizations who want to adopt SPF are required to publish DNS records for the
hosts that are used in “MAIL FROM” and “HELO” identities so that recipients can identify whether
a host is authorized to send email messages for the domain by querying these records. The
complete specifications of SPF are documented in RFC 4408. For a simple introduction, visit
http://www.openspf.org/Introduction.
This document guides you on how to integrate SPF checking for IMSVA 8.2. This solution makes
use of the Postfix SMTP access policy delegation mechanism. A script will be used to do SPF
checking and report specific actions to Postfix. Postfix then takes the appropriate action. For
further details, visit http://www.postfix.org/SMTPD_POLICY_README.html.
2. Enable/Disable
To Enable SPF
1. Modify your Postfix settings to inject SPF checking to the Postfix email message flow.
Postfix has two main configuration files: master.cf and main.cf. The master.cf configuration file
defines how a client program connects to a service, and what daemon program runs when a
service is requested. The Postfix main.cf configuration file specifies a subset of all the parameters
that controls the operation of the Postfix mail system.
In /opt/trend/imss/postfix/etc/postfix/master.cf, remove the comments for the following so that
the SPF script will be launched by Postfix when needed.
SPFPolicyd unix - n n - 0 spawn
user=imss argv=/opt/trend/imss/postfix/etc/postfix/SPFPolicyd/SPFPolicyd.py
By default, Postfix stops the SPF check process after 1000 seconds. This is too short for a policy
daemon that may need to run for as long as the SMTP server process that talks to it. To extend
the time for the SPF check process, remove the comments for the following in main.cf.
SPFPolicyd_time_limit = 3600
2. Restart the Postfix service, to make all the modifications take effect, using the following
command:
# postfix restart
The logs of the SPF check script are written to /var/log/maillog, with a leading “SPFPolicyd” in
front of each line in the log.
To verify that SPF checking works, send an email message that can pass an IMSVA scan. If the
message contains “Received-SPF” in the header, the SPF check script is working correctly.
To Disable SPF
To disable SPF checking, insert comments for the entries added in the previous section to
master.cf and main.cf. Then restart the Postfix service.
3. Configuration
The file config.ini, under the same folder as the script, is the main configuration file. The format
for the file is as follows:
# Comments…
[section1]
Key1 = value1
[section2]
Key2 = value1, value2
NOTE: Possible values are separated by pipes “|”. Underlined values are default values. For
parameters that can have multiple values, use a comma or space to separate them. For example:
example.com, example2.com.
Sometimes you may want to apply specific actions to some domains. For example, the domain
example.com has a published SPF record and never sends messages using hosts not in the SPF
record. So you want to block messages if they do not come from the hosts in the SPF record. You
can add a section in config.ini to block those messages.
[<domain>.com]
none=block
Now if the SPF query result is none, the message will be blocked. Actions for other query results
are kept the same as the global actions. You can also override actions for other query results if
needed.
Wildcards are supported. For example, you can use “*.example.com” to define actions for
example.com and all its sub-domains. The SPF check automatically searches for the best matched
domains. If the sender is “postmaster@example.com”, the SPF check will first look for
“[example.com]”, if this section does not exist, it will look for “[*.example.com]” next.
The priority of this section is lower than approved list and enforcement list.
If you are using Cloud Pre-Filter, a little more configuration is needed. Cloud Pre-Filter actually
works as a proxy, so messages passed from Cloud Pre-Filter may not pass an SPF check. You have
to add the IP addresses of Cloud Pre-Filter to the approved list. If you enabled Cloud Pre-Filter,
open the file “/opt/trend/imss/postfix/etc/postfix/NRSAllowAccessList”, and add the IP addresses
in this file to “white_ip”, so messages from Cloud Pre-Filter will not be subjected to an SPF check.
There may be many IP addresses for Cloud Pre-Filter, so you can make use of the subnet format
(<IP address>/<subnet mask length>) to save time.
- SPFFail keyword
There are two kinds of fail:1. SoftFail;2. Fail Create the keyword you want.
-follow the policy creation wizard. Set the preferred action(“Tag subject”, Quarantine ….)
Others:
1. In some environment, DNS may have performance issue. If you encounter this issue, you can
set smtpd_policy_service_timeout to 600 (or higher) to make sure query is not timeout.
- In main.cf, set smtpd_policy_service_timeout=600s
- postfix reload