{"id":1080,"date":"2020-01-16T13:18:09","date_gmt":"2020-01-16T00:18:09","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1080"},"modified":"2020-09-14T14:11:14","modified_gmt":"2020-09-14T02:11:14","slug":"mailscanner-with-postfix","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1080","title":{"rendered":"MailScanner with Postfix"},"content":{"rendered":"<h1>Prerequisite<\/h1>\n<ul>\n<li>Installed <a href=\"https:\/\/www.mailscanner.info\/\">MailScanner<\/a><\/li>\n<\/ul>\n<h1>Resolving MailScanner Dependencies<\/h1>\n<ol>\n<li><strong>Run<\/strong> the following <strong>cpan<\/strong> commands <strong>one at a time <\/strong><em>(i.e. to see if they are successfully installed)<\/em>:\n<pre style=\"white-space: pre;\">sudo cpan -i Filesys::Df<\/pre>\n<pre style=\"white-space: pre;\">sudo cpan -i IO::Stringy<\/pre>\n<pre style=\"white-space: pre;\">sudo cpan -i DBI<\/pre>\n<pre style=\"white-space: pre;\">sudo cpan -i Net::CID<\/pre>\n<pre style=\"white-space: pre;\">sudo cpan -i Sys::SigAction<\/pre>\n<pre style=\"white-space: pre;\">sudo cpan -i MIME::Parser<\/pre>\n<pre style=\"white-space: pre;\">sudo cpan -i Archive::Zip<\/pre>\n<pre style=\"white-space: pre;\">sudo cpan -i OLE::Storage_Lite<\/pre>\n<pre style=\"white-space: pre;\">sudo cpan -i DBD::SQLite<\/pre>\n<\/li>\n<li><strong>Install<\/strong> the following <strong>packages<\/strong>:\n<pre style=\"white-space: pre;\">sudo apt-get install unrar\r\nsudo apt-get install sqlite<\/pre>\n<\/li>\n<\/ol>\n<h1>Installing Clamav Antivirus<\/h1>\n<p>Run the following command:<\/p>\n<pre style=\"white-space: pre;\">sudo apt-get install clamav clamav-daemon<\/pre>\n<h1>Integrating Clamav to MailScanner<\/h1>\n<ol>\n<li><strong>Update<\/strong> the <strong>\/etc\/MailScanner\/MailScanner.conf<\/strong> to have the fields <strong>Virus Scanner<\/strong> and <strong>Clamd Socket<\/strong> to become as follows:\n<pre style=\"white-space: pre;\">Virus Scanner = clamd\r\nClamd Socket = \/var\/run\/clamav\/clamd.ctl<\/pre>\n<\/li>\n<li><strong>Restart<\/strong> the <strong>mailscanner service<\/strong> with the following command:\n<pre style=\"white-space: pre;\">sudo service mailscanner restart<\/pre>\n<\/li>\n<li><strong>Update<\/strong> the file <strong>\/etc\/apparmor.d\/usr.sbin.clamd<\/strong> to have the following entries:\n<pre style=\"white-space: pre;\">  \/var\/spool\/MailScanner\/** rw,\r\n  \/var\/spool\/MailScanner\/incoming\/** rw,<\/pre>\n<\/li>\n<li><strong>Restart<\/strong> the <strong>apparmor service<\/strong> with the following command:\n<pre style=\"white-space: pre;\">sudo systemctl restart apparmor.service<\/pre>\n<\/li>\n<\/ol>\n<h1>Installing and Updating Spamassassin<\/h1>\n<p>Run the following commands:<\/p>\n<pre style=\"white-space: pre;\">sudo apt-get install spamassassin\r\nsudo sa-update\r\nsudo service spamassassin start<\/pre>\n<h1>Integrating MailScanner to Postfix<\/h1>\n<ol>\n<li>Open the file <strong>\/etc\/postfix\/main.cf<\/strong> for <strong>editing<\/strong> and\u00a0<strong>add<\/strong> the following line and <strong>save<\/strong>:\n<pre style=\"white-space: pre;\">header_checks = regexp:\/etc\/postfix\/header_checks<\/pre>\n<\/li>\n<li><strong>Create<\/strong> the file <strong>\/etc\/postfix\/header_checks<\/strong> with the following:\n<pre style=\"white-space: pre;\">\/^Received:\/ HOLD<\/pre>\n<\/li>\n<li>Open the file <strong>\/etc\/MailScanner\/MailScanner.conf<\/strong> for <strong>editing<\/strong> and <strong>update<\/strong> with the following if necessary:\n<pre style=\"white-space: pre;\">Run As User = postfix\r\nRun As Group = postfix\r\nIncoming Queue Dir = \/var\/spool\/postfix\/hold\r\nOutgoing Queue Dir = \/var\/spool\/postfix\/incoming\r\nMTA = postfix<\/pre>\n<\/li>\n<li><strong>Open<\/strong> the file <strong>\/etc\/MailScanner\/defaults<\/strong> for <strong>editing<\/strong> and <strong>update<\/strong> with the following if necessary:\n<pre style=\"white-space: pre;\">run_mailscanner=1<\/pre>\n<\/li>\n<li><strong>Update<\/strong> the <strong>group<\/strong> of <strong>\/var\/spool\/MailScanner<\/strong> to <strong>mtagroup<\/strong> and allow the it <strong>write permission<\/strong> as follows:\n<pre style=\"white-space: pre;\">sudo chown :mtagroup \/var\/spool\/MailScanner\r\nsudo chmod 775 MailScanner<\/pre>\n<\/li>\n<li><strong>Prepare spamassassin's directory<\/strong> using the following commands:\n<pre style=\"white-space: pre;\">sudo mkdir \/var\/spool\/MailScanner\/spamassassin\r\nsudo chown postfix \/var\/spool\/MailScanner\/spamassassin<\/pre>\n<\/li>\n<li><strong>Update<\/strong> the <strong>permission<\/strong> of the MailScanner's incoming and quarantine folders with the following commands:\n<pre style=\"white-space: pre;\">sudo chown postfix.mtagroup \/var\/spool\/MailScanner\/incoming\r\nsudo chmod 770 \/var\/spool\/MailScanner\/incoming\r\nsudo chown postfix.mtagroup \/var\/spool\/MailScanner\/quarantine<\/pre>\n<\/li>\n<li><strong>Restart<\/strong> the <strong>mailscanner service<\/strong> with the following command:\n<pre style=\"white-space: pre;\">sudo service mailscanner restart<\/pre>\n<\/li>\n<\/ol>\n<p><em><strong>Related Post<\/strong><\/em><br \/>\n<em><a href=\"https:\/\/www.ronella.xyz\/?p=1066\" target=\"_blank\" rel=\"noopener noreferrer\">Configuring Email Server with Postfix and Dovecot:<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prerequisite Installed MailScanner Resolving MailScanner Dependencies Run the following cpan commands one at a time (i.e. to see if they are successfully installed): sudo cpan -i Filesys::Df sudo cpan -i IO::Stringy sudo cpan -i DBI sudo cpan -i Net::CID sudo cpan -i Sys::SigAction sudo cpan -i MIME::Parser sudo cpan -i Archive::Zip sudo cpan -i OLE::Storage_Lite [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[55,28,12],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1080"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1080"}],"version-history":[{"count":14,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1080\/revisions"}],"predecessor-version":[{"id":1284,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1080\/revisions\/1284"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}