{"id":1313,"date":"2018-05-31T15:44:44","date_gmt":"2018-05-31T13:44:44","guid":{"rendered":"https:\/\/bergs.biz\/blog\/?p=1313"},"modified":"2018-05-31T15:44:44","modified_gmt":"2018-05-31T13:44:44","slug":"exim-malware-scanner-issue-after-upgrade-from-jessie-to-stretch","status":"publish","type":"post","link":"https:\/\/bergs.biz\/blog\/2018\/05\/31\/exim-malware-scanner-issue-after-upgrade-from-jessie-to-stretch\/","title":{"rendered":"Exim malware scanner issue after upgrade from Jessie to Stretch"},"content":{"rendered":"<div class=\"searchable\">\n<p>Today I finally upgraded by personal root server from Debian Jessie to Stretch, thereby upgrading Exim from 4.84 to 4.89.<\/p>\n<p>After the upgrade, I observed the following errors in <code>mainlog<\/code>:<\/p>\n<pre class=\"wiki\">2018-05-31 08:02:03 +0000 1fOIX5-0001rg-AM malware acl condition: cmdline  : scanner returned error code: 36096\r\n2018-05-31 08:02:03 +0000 1fOIX5-0001rg-AM H=([IPv6:2a00:6020:1efc:ee20:8857:7824:6a49:8368]) [2a00:6020:1efc:ee20:8857:7824:6a49:8368]:48523 I=[2a01:4f8:141:429::2]:465 Warning: ACL \"warn\" statement skipped: condition test deferred\r\n2018-05-31 08:02:04 +0000 1fOIX5-0001rg-AM malware acl condition: cmdline  : scanner returned error code: 13\r\n2018-05-31 08:02:04 +0000 1fOIX5-0001rg-AM H=([IPv6:2a00:6020:1efc:ee20:8857:7824:6a49:8368]) [2a00:6020:1efc:ee20:8857:7824:6a49:8368]:48523 I=[2a01:4f8:141:429::2]:465 Warning: ACL \"warn\" statement skipped: condition test deferred\r\n2018-05-31 08:02:05 +0000 1fOIX5-0001rg-AM malware acl condition: cmdline  : scanner returned error code: 13\r\n2018-05-31 08:02:05 +0000 1fOIX5-0001rg-AM H=([IPv6:2a00:6020:1efc:ee20:8857:7824:6a49:8368]) [2a00:6020:1efc:ee20:8857:7824:6a49:8368]:48523 I=[2a01:4f8:141:429::2]:465 Warning: ACL \"warn\" statement skipped: condition test deferred\r\n<\/pre>\n<p>Each of the three <code>cmdline<\/code> scanners caused an error, as shown above.<\/p>\n<p>It seems there was a change in Exim from upstream, as <a class=\"ext-link\" href=\"https:\/\/bugs.debian.org\/cgi-bin\/bugreport.cgi?bug=786392\"><span class=\"icon\">\u200b<\/span>reported<\/a> by another user. Somehow it seems that if you define a <code>cmdline<\/code> scanner that uses a chain of commands, when there was an error return code encountered in the middle of the chain, the whole chain is considered failed.<\/p>\n<p>To &#8220;fix&#8221; this issue (or rather work-around it), I changed the three ACL clauses as follows:<\/p>\n<pre class=\"wiki\">   warn  message                = This message contains malware ($malware_name)\r\n         set acl_m0      = cmdline:\\\r\n-                               \/usr\/lib\/AntiVir\/guard\/avscan -s --batch --scan-mode=all %s; \/bin\/echo -e \\N\"\\navira_retval $?\"\\N:\\\r\n+                               \/usr\/local\/bin\/avscan_wrapper %s:\\\r\n                                \\N^avira_retval 1$\\N:\\\r\n                                \\N^.*ALERT::[ \\t]+([^;]*)[ \\t]+;.*$\\N\r\n         malware                = *\r\n<\/pre>\n<p>I created a &#8220;wrapper&#8221; that effectively hides error return codes, and forces a return code of <code>0<\/code>. The above wrapper looks like this:<\/p>\n<pre class=\"wiki\">#!\/bin\/bash\r\n\r\nARG=\"$1\"\r\n\r\n\/usr\/lib\/AntiVir\/guard\/avscan -s --batch --scan-mode=all \"${ARG}\"\r\n\/bin\/echo -e \"\\navira_retval $?\"\r\n\r\nexit 0\r\n<\/pre>\n<p>To make sure I didn&#8217;t break the malware scanning by my changes, I downloaded the <a class=\"ext-link\" href=\"http:\/\/www.eicar.org\/86-0-Intended-use.html\"><span class=\"icon\">\u200b<\/span>EICAR test virus<\/a> and sent it to myself. Exim caught the &#8220;virus&#8221; and ditched it.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>How to fix Exim malware scanner issue after upgrade from Debian Jessie to Stretch.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,122,46],"tags":[281,249,47,282,283],"class_list":["post-1313","post","type-post","status-publish","format-standard","hentry","category-debian","category-english","category-security-computers","tag-debian","tag-email","tag-exim","tag-malware","tag-virus-scanning"],"_links":{"self":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/1313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/comments?post=1313"}],"version-history":[{"count":1,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/1313\/revisions"}],"predecessor-version":[{"id":1314,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/1313\/revisions\/1314"}],"wp:attachment":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/media?parent=1313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/categories?post=1313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/tags?post=1313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}