Haraka SPF Plugin

1.2.11 · active · verified Sun Apr 19

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.

Common errors

Warnings

Install

Imports

Quickstart

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.

/* Haraka config/plugins file */
# This is a comment
# Your other plugins...
data.headers
rules
queue/smtp_proxy

spf  # Add this line to enable the SPF plugin


/* Haraka config/spf.ini file */
; Place this file in your Haraka config directory (e.g., /etc/haraka/config/spf.ini)

lookup_timeout = 29

[relay]
context=sender

[skip]
relaying=false
auth=false

[deny]
mfrom_fail=true  ; Only deny explicit MAIL FROM SPF failures
openspf_text=true ; Add OpenSPF explanation text on deny

[deny_relay]
; Typically do not deny SPF for relayed mail, unless specific policies are needed.
mfrom_fail=false
openspf_text=false


// After configuring, restart Haraka:
// sudo haraka -c /etc/haraka
// (or whichever command you use to start Haraka)

view raw JSON →