{"id":34,"date":"2016-10-03T10:33:46","date_gmt":"2016-10-03T10:33:46","guid":{"rendered":"http:\/\/blog.warbel.net\/?p=34"},"modified":"2016-10-03T10:36:45","modified_gmt":"2016-10-03T10:36:45","slug":"enabling-filtering-with-dovecot-and-roundcube","status":"publish","type":"post","link":"https:\/\/blog.warbel.net\/index.php\/2016\/10\/03\/enabling-filtering-with-dovecot-and-roundcube\/","title":{"rendered":"Enabling Filtering with Dovecot and Roundcube"},"content":{"rendered":"<p>After establishing my new mail server I wanted to enable a critical component: mail filtering. I also wanted to test the spam filters to see if they actually worked!<\/p>\n<p>Spam filtering was easy. Using <a href=\"http:\/\/spamassassin.apache.org\/gtube\/\">this<\/a> resource, I sent an email to myself from gmail while monitoring the system logs with:<\/p>\n<p style=\"padding-left: 30px;\">root@mail:\/var\/log# watch -n .5 tail -50 syslog<\/p>\n<p style=\"text-align: left;\">This is the critical line to show that the spam was blocked:<\/p>\n<p style=\"text-align: left; padding-left: 30px;\">mail amavis[18399]: (18399-06) Blocked SPAM {DiscardedInbound,Quarantined}, [209.85.217.170]:36018 [209.85.217.170] &lt;xxxxxxx@gmail.com&gt; -&gt; &lt;warren@warbel.net&gt;, quarantine: z\/spam-z0c8jTW67Lm4.gz, Queue-ID: 6E6E1429C4, Message-ID: &lt;CADwHEq4-8TcFwpPmVw8V2hDWTXHd4jNBP2JAPsvPuG_KgmKEPg@mail.gmail.com&gt;, mail_id: z0c8jTW67Lm4, Hits: 999.9, size: 2180, dkim_sd=20120113:gmail.com, 4444 ms<\/p>\n<p>The mail did not appear in my spam folder.<\/p>\n<p>The second challenge was to enable custom rules. I wanted this mainly to deal with the alerts I was getting from Zabbix.\u00a0There is a significant amount written about this issue online. I have found the following resources useful, however incomplete. They do not apply to Ubuntu 16.04 as far as I can see.<br \/>\n<a href=\"https:\/\/forum.vestacp.com\/viewtopic.php?t=11363\">Link 1<br \/>\n<\/a><a href=\"http:\/\/www.smartdomotik.com\/2015\/09\/04\/how-to-set-filters-in-roundcube-with-sieve\/\">Link 2<br \/>\n<\/a><a href=\"https:\/\/easyengine.io\/tutorials\/mail\/server\/sieve-filtering\/\">Link 3<\/a><br \/>\n<a href=\"https:\/\/www.njae.me.uk\/Dovecot_server_setup\">Link 4<\/a><br \/>\nAnd when, after trying to comprehend and implement all these ideas, resorted to troubleshooting where I found this useful:<\/p>\n<p><a href=\"https:\/\/www.njae.me.uk\/Dovecot_server_setup\">Link 5<\/a><\/p>\n<p>The critical step that is missed in the above is that sieve must be enabled in \/etc\/dovecot\/15-lda.conf. Where LDA stands for\u00a0<em>Local Delivery Agent<\/em>, which is where we want filtering.<\/p>\n<p>The code is:<\/p>\n<p>protocol lda {<br \/>\n# Space separated list of plugins to load (default is global mail_plugins).<br \/>\nmail_plugins = $mail_plugins sieve<br \/>\n}<\/p>\n<p>Again, watching the system logs and after recreating a rule, and testing it, could see managesieve apply the rules.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After establishing my new mail server I wanted to enable a critical component: mail filtering. I also wanted to test the spam filters to see if they actually worked! Spam filtering was easy. Using this resource, I sent an email &hellip; <a href=\"https:\/\/blog.warbel.net\/index.php\/2016\/10\/03\/enabling-filtering-with-dovecot-and-roundcube\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":3,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":37,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/34\/revisions\/37"}],"wp:attachment":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/categories?post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/tags?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}