SPF Howto

Bryan Østergaard  Author
Joshua Saddler  Editor

Updated April 12, 2007

1.  SPF and Gentoo

Introduction

Gentoo uses the Sender Policy Framework, or SPF, to filter forged @gentoo.org email, so it's important to configure your mail client or server correctly so it doesn't get filtered. The most important thing is that MAIL FROM: and your body From: needs to match and that you can't forge return-path. If you obey these rules you shouldn't have problems with SPF filtering your emails.

Below are some configurations for a few common clients and mailers.

SSMTP

To forward all mail through mail.gentoo.org configure /etc/ssmtp/ssmtp.conf as follows:

Code Listing 1.1: Editing ssmtp.conf

mailhub=mail.gentoo.org:25
AuthUser=username (Replace with your username)
AuthPass=password (Replace with your ~/.asmtp password)
AuthMethod=CRAM-MD5
UseTLS=YES
useSTARTTLS=YES

Mutt

You can set your envelope from address in ~/muttrc as follows:

Code Listing 1.2: Editing muttrc

envelope_from_address who@example.com
use_envelope_from true

Qmail

You can forward all your email through mail.gentoo.org using the /var/qmail/control/smtproutes file:

Code Listing 1.3: Editing smtproutes

:mail.gentoo.org USERNAME PASSWORD (Replace with your username/password)

MSMTP

You can do per-account forwarding using msmtp. Configure ~/.msmtp as follows:

Code Listing 1.4: Editing .msmtp

account default
host mail.yourisp.com
user johnsmith (Replace with your username)
password spork (Replace with your password)
tls

Next, configure your mail user agent to use msmtp for sending email. A sample mutt configuration follows:

Code Listing 1.5: Using msmtp with mutt

send2-hook . 'set sendmail="/path/to/msmtp"'
send2-hook '~f gmx' 'set sendmail="/path/to/msmtp -a gmx"'
macro index ,g '<enter-command>set sendmail="/path/to/msmtp -a gmx"<enter>' 'choose gmx smtp profile'

Other user agents

For Thunderbird, Evolution and other MUAs (mail user agents), you can use ssmtp or another mail transfer agent (MTA) as described above to forward your mail through mail.gentoo.org.