{"id":524,"date":"2018-09-15T17:19:48","date_gmt":"2018-09-15T17:19:48","guid":{"rendered":"http:\/\/www.linuxauthority.com\/wordpress\/?p=524"},"modified":"2018-09-15T17:23:21","modified_gmt":"2018-09-15T17:23:21","slug":"to-be-without-spam-a-spamassassin-story","status":"publish","type":"post","link":"https:\/\/www.linuxauthority.com\/wordpress\/?p=524","title":{"rendered":"To be without spam. A spamassassin story"},"content":{"rendered":"\n<!-- ALL ADSENSE ADS DISABLED -->\n<p>I have used spamassassin for many years with variable levels of success.<\/p>\n<p>I will tighten the rules in one place, the soammers would find a new way to deliver the spam on my server.<\/p>\n<p>Last week my wife, retired her email address because she&#8217;s getting more spam than real mail.<\/p>\n<p>It was the worst of the worst of it was as if my wife were a pornography addict and she never looks at that stuff.<\/p>\n<p>So I analyzed the headers. Turns out spamassasin was not even processing the messages at all. They came in on localhost 127.0.0.1 and were passed straight to the amavisd virus filter.<\/p>\n<p>As it turns out spamassassin treats all emails from local host as a trusted network. Well the spammers changed that fact 4 years back.<\/p>\n<p>So I scoured the forums and came up with this:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-12.42.46-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-523\" src=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-12.42.46-PM.png\" alt=\"\" width=\"1138\" height=\"86\" srcset=\"https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-12.42.46-PM.png 1138w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-12.42.46-PM-300x23.png 300w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-12.42.46-PM-768x58.png 768w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-12.42.46-PM-1024x77.png 1024w\" sizes=\"(max-width: 1138px) 100vw, 1138px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.09.53-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-526\" src=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.09.53-PM.png\" alt=\"\" width=\"1600\" height=\"798\" srcset=\"https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.09.53-PM.png 1600w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.09.53-PM-300x150.png 300w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.09.53-PM-768x383.png 768w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.09.53-PM-1024x511.png 1024w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><\/a><\/p>\n<p>The first statement tells spamassassin to check all headers regardless of what network it came from.<\/p>\n<p>report_safe 1 trusts mail from trusted networks. By default 127.0.0.1 is a trusted network.<\/p>\n<p>clear_trusted_networks makes sure spamassassin does not have any more so called &#8220;trusted&#8221; networks.<\/p>\n<p>Spammers also probe and make lots of mistakes. I have configured postfix to slow them down big time.<\/p>\n<p><a href=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.17.31-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-527\" src=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.17.31-PM.png\" alt=\"\" width=\"852\" height=\"164\" srcset=\"https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.17.31-PM.png 852w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.17.31-PM-300x58.png 300w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-15-at-1.17.31-PM-768x148.png 768w\" sizes=\"(max-width: 852px) 100vw, 852px\" \/><\/a><\/p>\n<p>Any error triggers a 90 second timeout. I plan to crank that up. The spammers probing manually don&#8217;t like to wait. The scripts don&#8217;t know how long to wait. This and the next change are useful in avoiding dos\/denial of service attacks.<\/p>\n<p>You get two errors interacting with my mail server before you disconnect. The default was 10\/20.<\/p>\n<p>After making the first changerun:<\/p>\n<p><strong>systemctl restart spamassasin<\/strong><\/p>\n<p><strong>systemctl status spamassasin -l<\/strong><\/p>\n<p>After the postfix main.cf change:<\/p>\n<p><strong>systemctl restart postfix<\/strong><\/p>\n<p><strong>systemctl status postfix -l<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have used spamassassin for many years with variable levels of success. I will tighten the rules in one place, the soammers would find a new way to deliver the spam on my server. Last week my wife, retired her email address because she&#8217;s getting more spam than real mail. It was the worst of [&hellip;]<\/p>\n<a role=\"link\" class=\"rtp-readmore\" title=\"Read more on To be without spam. A spamassassin story\" href=\"https:\/\/www.linuxauthority.com\/wordpress\/?p=524\" rel=\"nofollow\">Read More &rarr;<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64,21],"tags":[65,66,67,68],"class_list":["post-524","post","type-post","status-publish","format-standard","hentry","category-spamassassin","category-systems-administration","tag-centos7","tag-spam","tag-spamassasin","tag-spammer-lockdown"],"_links":{"self":[{"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/524"}],"collection":[{"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=524"}],"version-history":[{"count":3,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/524\/revisions"}],"predecessor-version":[{"id":530,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/524\/revisions\/530"}],"wp:attachment":[{"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}