{"id":840,"date":"2014-01-26T21:41:52","date_gmt":"2014-01-27T02:41:52","guid":{"rendered":"http:\/\/littlesvr.ca\/grumble\/?p=840"},"modified":"2017-03-21T16:25:38","modified_gmt":"2017-03-21T21:25:38","slug":"setting-up-sendmail-on-a-dynamic-ip-part2-spf","status":"publish","type":"post","link":"http:\/\/littlesvr.ca\/grumble\/2014\/01\/26\/setting-up-sendmail-on-a-dynamic-ip-part2-spf\/","title":{"rendered":"Setting up Sendmail on a dynamic IP, part2: SPF"},"content":{"rendered":"<p>Even though I had a decent mail server set up and running, other people&#8217;s stupid spam filters are starting to cause me headaches, so after looking around for solutions I found two things that may alleviate (and perhaps completely solve) that problem. The first is SPF.<\/p>\n<p>The idea is that the receiving mail server will verify the sending mail server&#8217;s IP address to ensure it actually matches the &#8220;From:&#8221; header, to prevent email address spoofing.<\/p>\n<p>That&#8217;s awesome, except that I&#8217;m on a dynamic IP and I immediately imagined a time when my IP would be changed while my outbound mail was sitting in someone&#8217;s queue. After researching it for a while I decided that&#8217;s not a major issue though, since you&#8217;re supposed to get a bounce message in case of rejection.<\/p>\n<p>Unfortunately it turned out that my previous spam solution (see <a href=\"http:\/\/littlesvr.ca\/grumble\/2014\/01\/26\/setting-up-sendmail-on-a-dynamic-ip-part1-go-through-isps-smtp\/\">part1: ISP&#8217;s SMTP<\/a>) was causing an issue. Since my ISP is sending my email, I can&#8217;t get the receiving server to verify it&#8217;s coming from my server!<\/p>\n<p>Except that I can. The solution is to use combine the SPF &#8220;A&#8221; with the &#8220;include&#8221; mechanism. So my SPF record looks like this:<\/p>\n<p><code>littlesvr.ca. 600 IN TXT \"v=spf1 +a +include:mnsi.net -all\"<\/code><\/p>\n<p>Which I happily added to my DNS server records. I didn&#8217;t need to make any changes to my ddclient configuration since this doesn&#8217;t need to be updated with my IP. Neat!<\/p>\n<p>Looks simple, but it took me a while to figure out. You see <a href=\"http:\/\/www.openspf.org\/SPF_Record_Syntax#include\">openspf.org says<\/a> the forwarding server must itself have an SPF record, which out.mnsi.net doesn&#8217;t. But mnsi.net does, and somehow at some point something decided to check the SPF record for mnsi.net even though my messages are going through out.mnsi.net. Don&#8217;t know why, but it works.<\/p>\n<p>Of course now anyone sending email via the same ISP as me can still spoof the sender address which annoyed me greatly until I realised that before this setup anyone on the internet could do the same, which reduces the potential spoofers&#8217; pool by 99.somethingridiculous percent.<\/p>\n<p>Now to testing. openspf.org provides a completely useless tester &#8211; you can send an email to spf-test@openspf.net and they will send back a bounce message with the results of the SPF check. I sent two emails and didn&#8217;t get a bounce back. Got me worried a little and then I realised they are probably sending the bounce to my ISP&#8217;s server which doesn&#8217;t forward it back to me. Interesting discovery!<\/p>\n<p>Anyway, they also mentioned another service, check-auth@verifier.port25.com which worked beautifully, sent me a reply email with info not only on SPF but also on DomainKeys, DKIM, Sender-ID, and SpamAssasin. DomainKeys and Sender-ID I don&#8217;t intend to use, but <a href=\"http:\/\/littlesvr.ca\/grumble\/2014\/02\/04\/setting-up-sendmail-on-a-dynamic-ip-part3-dkim\/\">DKIM is the next part of the series<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Even though I had a decent mail server set up and running, other people&#8217;s stupid spam filters are starting to cause me headaches, so after looking around for solutions I found two things that may alleviate (and perhaps completely solve) that problem. The first is SPF. The idea is that the receiving mail server will &hellip; <\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-andrew","4":"post-840","6":"format-standard","7":"category-opensource"},"_links":{"self":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts\/840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/comments?post=840"}],"version-history":[{"count":8,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts\/840\/revisions"}],"predecessor-version":[{"id":1254,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts\/840\/revisions\/1254"}],"wp:attachment":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/media?parent=840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/categories?post=840"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/tags?post=840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}