spf

Plesk and SPF records

The Plesk DNS zone template for TXT record does not include the servers hostname by default. If the host IP is different from the domains being hosted, may want to update the default template as below:

<domain>. TXT v=spf1 +a +mx a:host.domain.tld -all

Sender Policy Framework (SPF)

Sender Policy Framework (SPF) is an extension to the Simple Mail Transfer Protocol (SMTP). SPF allows software to identify and reject forged addresses in the SMTP MAIL FROM (Return-Path), a typical nuisance in e-mail spam.

The two direct benefits of SPF I found are:

  1. ensuring a spammer/virus/trojan cannot send emails using your email address in the FROM field of the email.
  2. get legitimate emails to go through hotmail (and others of course) junk filter, and not be detected as spam.

Setting up a SPF record

Here is an SPF record template for strict checking. For softfail, use "~all" instead.

v=spf1 a mx ptr ip4:<DomainIP> -all

Where 'DomainIP' is replaced with the IP address for what you're setting this record up for. It can also include a range in CIDR format.
You can read more about other SPF Record Syntax at OpenSPF.org .

So now when people receiving emails from your domain have their SPF checking rule to deny all emails that don't match with this SPF record they should only receive genuine emails from your domain.

If you are a Plesk user, "Switch on SPF spam protection" and next to 'SPF checking mode' select 'Reject mails when SPF resolves to "fail" (deny)'.

To check the SPF record for a particular domain:

$ dig domain.tld txt

Can't locate Sys/Hostname/Long.pm (Resolved)

I was getting the below error in my mail error log files:

spamd[10632]: Can't locate Sys/Hostname/Long.pm in @INC (@
INC contains: ../lib /usr/share/perl5 /etc/perl /usr/local/lib/perl/5.8.7 /usr/l
ocal/share/perl/5.8.7 /usr/lib/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/
local/lib/site_perl) at /usr/share/perl5/Mail/SPF/Query.pm

Apparently a bug in ubuntu dapper, where libmail-spf-query-perl depends on libsys-hostname-long-perl.

Doing an `apt-get install libsys-hostname-long-perl` resolved the issue.

Comment