{"id":211,"date":"2011-06-12T02:10:42","date_gmt":"2011-06-12T09:10:42","guid":{"rendered":"http:\/\/blog.networkpresence.co\/?p=211"},"modified":"2011-06-12T03:23:21","modified_gmt":"2011-06-12T10:23:21","slug":"installing-clamav-spamassassin-to-centos-5-with-sendmail","status":"publish","type":"post","link":"http:\/\/blog.networkpresence.co\/?p=211","title":{"rendered":"Installing ClamAV &#038; SpamAssassin to CentOS 5 with Sendmail"},"content":{"rendered":"<p>Installing these Mail Server open-source software sets to CentOS 5 with Sendmail on a 64-bit CentOS 5.4 (or higher) Linux host.<\/p>\n<p>1. Install RPMForge Repo to get access to more Software Packages for CentOS5<\/p>\n<p>Install (using rpm -Uvh) http:\/\/pkgs.repoforge.org\/rpmforge-release\/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm<\/p>\n<p>2. Use yum to install from the previously installed RPMForge Repo the necessary software packages<\/p>\n<p><code>yum -y install spamass-milter clamav-milter<br \/>\nyum -y install perl-Mail-SPF<br \/>\nyum -y install sendmail-cf<\/code><\/p>\n<p>Restart spamd after installing the new SPF package with<br \/>\n<code>\/etc\/init.d\/spamassassin restart<\/code><\/p>\n<p>Install DKIM for Message Signing with<br \/>\n<code>yum -y install perl-Mail-DKIM<\/code><\/p>\n<p>Check DKIM use by sending yourself an email from GMail and saving that message (headers and all) to a local text file, processing that file with<br \/>\n<code>spamassassin -D < \/tmp\/gmail-msg.txt 2>&1 |grep -i dk<\/code><\/p>\n<p>Install GeoIP for regional\/geographic message filtering<br \/>\n<code>yum -y install geoip<\/code><\/p>\n<p>Check that all of ClamAV is installed with<br \/>\n<code>yum -y install clamav clamav-db clamav-milter clamd<\/code><\/p>\n<p>Check then on the settings in \/etc\/sysconfig\/clamav-milter &#038; then set\/check on the following in \/etc\/clamav-milter.conf<br \/>\n<code>MilterSocket unix:\/var\/clamav\/clmilter.socket<br \/>\nUser clamav<br \/>\nAllowSupplementaryGroups yes<br \/>\nClamdSocket unix:\/var\/run\/clamav\/clamd.sock<br \/>\nLogFile \/var\/log\/clamav\/clamav-milter.log<br \/>\nLogFileMaxSize 0<br \/>\nLogTime yes<br \/>\nLogSyslog yes<\/code><\/p>\n<p>Set\/check the following in \/etc\/clamd.conf<br \/>\n<code>LogFile \/var\/log\/clamav\/clamd.log<br \/>\nLogFileMaxSize 0<br \/>\nLogTime yes<br \/>\nLogSyslog yes<br \/>\nPidFile \/var\/run\/clamav\/clamd.pid<br \/>\nTemporaryDirectory \/var\/tmp<br \/>\nDatabaseDirectory \/var\/clamav<br \/>\nLocalSocket \/var\/run\/clamav\/clamd.sock<br \/>\nFixStaleSocket yes<br \/>\nTCPSocket 3310<br \/>\nTCPAddr 127.0.0.1<br \/>\nMaxConnectionQueueLength 30<br \/>\nMaxThreads 50<br \/>\nReadTimeout 300<br \/>\nUser clamav<br \/>\nAllowSupplementaryGroups yes<br \/>\nScanPE yes<br \/>\nScanELF yes<br \/>\nDetectBrokenExecutables yes<br \/>\nScanOLE2 yes<br \/>\nScanMail yes<br \/>\nScanArchive yes<br \/>\nArchiveBlockEncrypted no<\/code><\/p>\n<p>Install SPF capabilities with<br \/>\n<code>yum -y install smf-spf<\/code><\/p>\n<p>3. Start Configuring main software servers<\/p>\n<p>3a. Sendmail for ClamAV &#038; SpamAssassin<\/p>\n<p>Load the following to <code>\/etc\/mail\/sendmail.mc<\/code>, placed above any MAILER definition and I place it after the line &#8220;FEATURE(use_ct_file)dnl&#8221;<\/p>\n<p><code>dnl # LOCAL ADDITIONS before Mailers<br \/>\ndnl # clamav-milter - z README ... dnl<br \/>\nINPUT_MAIL_FILTER(`clamav-milter',`S=local:\/var\/clamav\/clmilter.socket, F=,T=S:4m;R:4m;E:10m')dnl<br \/>\ndnl #<br \/>\ndnl # SPAMASSASSIN dnl<br \/>\ndnl **<br \/>\ndnl ** enable spamassassin-milter to scan for spam using spamassassin **<br \/>\ndnl **<br \/>\nINPUT_MAIL_FILTER(`spamassassin', `S=unix:\/var\/run\/spamass.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl<br \/>\ndefine(`confMILTER_MACROS_CONNECT',`t, b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl<br \/>\ndefine(`confMILTER_MACROS_HELO',`s, {tls_version}, {cipher}, {cipher_bits}, {cert_subject}, {cert_issuer}')dnl<br \/>\ndnl # END LOCAL ADDITIONS<br \/>\ndnl #<\/code><\/p>\n<p>You can test \/ check the newly installed &#038; configured SpamAssassin with the command:<br \/>\n<code>spamassassin -D <  \/usr\/share\/doc\/spamassassin-3.2.5\/sample-spam.txt 2>&1 |grep -i spf<\/code><br \/>\nLooking for lines like:<br \/>\n[1290] dbg: spf: using Mail::SPF for SPF checks<br \/>\n&#038;<br \/>\n[1290] dbg: spf: def_spf_whitelist_from: already checked spf and didn&#8217;t get pass, skipping whitelist check<br \/>\n[1290] dbg: spf: whitelist_from_spf: already checked spf and didn&#8217;t get pass, skipping whitelist check<\/p>\n<p>3b. Now rebuild the sendmail.cf from your updated sendmail.mc in \/etc as root with<\/p>\n<p><code>make<\/code><\/p>\n<p>3c. Ensure all the dependent &#038; requisite servers are running for Clam &#038; SA with<\/p>\n<p><code>chkconfig clamd on<br \/>\nchkconfig clamav-milter on<br \/>\nchkconfig spamass-milter on<br \/>\nchkconfig sendmail on<br \/>\nchkconfig dovecot on<\/code><\/p>\n<p>3d. Then start everything in the same order as per their init.d files, with<\/p>\n<p><code>service clamd start<br \/>\nservice clamav-milter start<br \/>\nservice spamass-milter start<\/code><\/p>\n<p>3e. Then restart Sendmail with<\/p>\n<p><code>service sendmail restart<\/code><\/p>\n<p>3z. SPF config &#038; enabling <- OPTIONAL, NOT YET WORKING!\n\nConfigure for the SMF-SPF support in \/etc\/mail\/sendmail.mc and remake sendmail.cf with\n<code>cd \/etc\/mail<br \/>\ncat >> sendmail.mc < END\ndnl **\ndnl ** enable smf-spf (Sender Policy Framework) **\ndnl **\ndefine(`confMILTER_MACROS_HELO', confMILTER_MACROS_HELO`, {verify}')dnl\nINPUT_MAIL_FILTER(`smf-spf', `S=unix:\/var\/run\/smfs\/smf-spf.sock, T=S:30s;R:1m')dnl\nEND\nmake<\/code><\/p>\n<p>In \/etc\/mail as root run make to generate  the new sendmail.cf &#038; submit.cf Sendmail config files.<\/p>\n<p>Start SPF and restart Sendmail with<br \/>\n<code>\/etc\/init.d\/smf-spf restart<br \/>\n\/etc\/init.d\/sendmail restart<\/code><\/p>\n<p>4. Testing \/ Verifying Setup<\/p>\n<p>4a. Check \/var\/log\/maillog<\/p>\n<p>4b. Test with a manual SMTP dialog using the telnet command to the server from another remote host on the Internet (ie: NOT from the server itself) to port 25 on your Sendmail host.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Installing these Mail Server open-source software sets to CentOS 5 with Sendmail on a 64-bit CentOS 5.4 (or higher) Linux host. 1. Install RPMForge Repo to get access to more Software Packages for CentOS5 Install (using rpm -Uvh) http:\/\/pkgs.repoforge.org\/rpmforge-release\/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm 2. &hellip; <a href=\"http:\/\/blog.networkpresence.co\/?p=211\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[44,18,42,43],"class_list":["post-211","post","type-post","status-publish","format-standard","hentry","category-network-presence","tag-clamav","tag-linux","tag-sendmail","tag-spamassassin"],"_links":{"self":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts\/211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=211"}],"version-history":[{"count":14,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions"}],"predecessor-version":[{"id":222,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions\/222"}],"wp:attachment":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=211"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}