This package, `haraka-plugin-spf`, implements the Sender Policy Framework (SPF) within the Haraka SMTP server. The current stable version is 1.2.11. It primarily adds `Received-SPF` headers to emails, with robust configurable options to defer or deny mail based on SPF test results, such as `mfrom_fail` for sender validation. While it has seen consistent updates recently, including ES6 refactoring, dependency bumps, and header formatting improvements, it does not adhere to a strict time-based release cadence, focusing instead on bug fixes and enhancements. Its key differentiator is its deep and flexible integration into the Haraka ecosystem, allowing granular control via `spf.ini` for handling various SPF outcomes (none, softfail, fail, permerror) for both HELO and MAIL FROM contexts, and specifically for relayed connections. It also provides a valuable command-line tool for debugging SPF records and validating domain configurations. The plugin allows Haraka operators to enforce SPF policies ranging from mere informational headers to hard rejections, providing essential protection against email spoofing.
npm install haraka-plugin-spfVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to enable the `haraka-plugin-spf` by adding it to Haraka's `config/plugins` file and setting up a basic `spf.ini` configuration to deny messages that explicitly fail SPF for the MAIL FROM address.
Review your `spf.ini` against the latest documentation and default settings. Remove any outdated or non-standard directives.
No action is required, but be aware that automated parsers or logs relying on the exact previous header format might need adjustments.
It is generally recommended to disable `deny.helo_fail` and similar HELO-based denial options. Focus instead on `mfrom_fail` for more reliable SPF enforcement.
Only enable deferrals for temporary errors if you are willing to accept potential delays or loss of valid mail. It's often safer to log these errors than to defer on them.
Exercise caution when enabling denial for SPF error results. `mfrom_fail` is typically the only deny option most sites should consider, and even then, be aware of legitimate mail from forwarders/mailing lists.
Upgrade `haraka-plugin-spf` to version 1.2.9 or newer, which contains a fix for crashes in `mech_mx` code when no valid MX records are found.
Create `spf.ini` in your Haraka `config` directory. You can start with the commented-out default settings provided in the `haraka-plugin-spf` repository's README or package.
Review the `spf.ini` file and remove any options that are no longer documented or have been deprecated. Specifically, ensure no 'legacy config support' options are present if upgrading to v1.2.10+.