{"id":711,"date":"2011-09-27T19:22:00","date_gmt":"2011-09-27T19:22:00","guid":{"rendered":"https:\/\/www.geekmungus.co.uk\/?p=711"},"modified":"2022-11-05T10:53:42","modified_gmt":"2022-11-05T10:53:42","slug":"postfix-spf-error-postfix-policyd-spf-perl-servfail-workaround","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=711","title":{"rendered":"Postfix SPF Error postfix-policyd-spf-perl SERVFAIL Workaround"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">We had an interesting one with Postfix, we were recieving mail fine from all other domains. Then one domain (in this case domain.co.uk) started not to get through, no changes had been made at our end.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What was happening was that their domain.co.uk nameservers were not reporting TXT records properly, rather than reporting nothing or an SPF record we were getting a &#8220;SERVFAIL&#8221;, the postfix spf script we used then started to block all mail with a temporary error 450.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Obviously they needed to fix their domain, but to workaround I did the below:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Error<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sep 27 09:02:20 oakmail postfix\/policy-spf[6114]: : Policy action=DEFER_IF_PERMIT SPF-Result=domain.co.uk: &#8216;SERVFAIL&#8217; error on DNS &#8216;SPF&#8217; lookup of &#8216;domain.co.uk&#8217;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sep 27 09:02:20 oakmail postfix\/smtpd[6102]: NOQUEUE: reject: RCPT from mail.domain.co.uk[212.212.212.212]: 450 4.7.1<a href=\"mailto:email@theaddress.co.uk\" target=\"_blank\" rel=\"noreferrer noopener\"> <\/a><a href=\"mailto:email@theaddress.co.uk\" target=\"_blank\" rel=\"noreferrer noopener\">email@theaddress.co.uk<\/a>: Recipient address rejected: SPF-Result=domain.co.uk: &#8216;SERVFAIL&#8217; error on DNS &#8216;SPF&#8217; lookup of &#8216;domain.co.uk&#8217;; from=<a href=\"mailto:sender@domain.co.uk\" target=\"_blank\" rel=\"noreferrer noopener\">sender@domain.co.uk<\/a> to=<a href=\"mailto:email@theaddress.co.uk\" target=\"_blank\" rel=\"noreferrer noopener\">email@theaddress.co.uk<\/a> proto=ESMTP helo=&lt;mail.domain.co.uk&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Workaround<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Edited the \/usr\/share\/perl5\/Mail\/SPF\/Server.pm file on the server, and then found this line:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>$packet-&gt;header-&gt;rcode =~ \/^(NOERROR|NXDOMAIN)$\/<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And changed it to:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>$packet-&gt;header-&gt;rcode =~ \/^(NOERROR|NXDOMAIN|SERVFAIL)$\/<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once done restart the postfix service, then when the sender tried again the messages came through fine. Basically it changed the SERVFAIL from a temporary error to a just ignore and pass the mail anyway type issue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We had an interesting one with Postfix, we were recieving mail fine from all other domains. Then one domain (in this case domain.co.uk) started not to get through, no changes had been made at our end. What was happening was that their domain.co.uk nameservers were not reporting TXT records properly, rather than reporting nothing or &#8230; <a title=\"Postfix SPF Error postfix-policyd-spf-perl SERVFAIL Workaround\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=711\" aria-label=\"Read more about Postfix SPF Error postfix-policyd-spf-perl SERVFAIL Workaround\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-711","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=711"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/711\/revisions"}],"predecessor-version":[{"id":1519,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/711\/revisions\/1519"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}