From dePoPo.net

Integrating ClamAV-Milter with Sendmail

Posted in: BlueOnyx
By dePoPo
Sep 5, 2009 - 3:54:50 PM

Installing ClamAV-Milter for Sendmail on BlueOnyx
(this should work for any Centos 5 based install)

This milter will allow sendmail to check the content of a mail message and act upon it during acceptance.

Milter support is already built in with the sendmail supplied by Centos 5 on the BlueOnyx installations, so the hard part is already done on this platform.

A complete set of RPM's for centos 5 is attached to this article. Install the clamav files including clamav-milter

start the daemons's

/etc/init.d/clamd start
/etc/init.d/clamav-milter start

You'll note that clamad starts, while clamav milter complains about sendmail.

Starting Clamav Milter Daemon: clamav-milter: socket-addr (local:/var/clamav/clmilter.socket) doesn't agree with sendmail.cf

So, bring up /etc/mail/sendmail.mc and make the following modification to the bottom of the file:

INPUT_MAIL_FILTER(`clamav', `S=local:/var/clamav/clmilter.socket, F=T, T=S:4m;R:4m')


Compile and activate the sendmail changes:

make -C /etc/mail
service sendmail restart

 


[root@hosting mail]# service sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail: WARNING: Xclamav: local socket name /var/clamav/clmilter.socket missing
                                                           [  OK  ]
Starting sm-client:                                        [  OK  ]


Now you should be able to start the clam milter module (/etc/init.d/clamav-milter start);

Starting Clamav Milter Daemon: Your LANG environment variable is set to 'en_US.UTF-8'
This is known to cause problems for some clamav-milter installations.
If you get failures with temporary files, please try again with LANG unset.
LibClamAV Warning: **************************************************
LibClamAV Warning: ***  The virus database is older than 7 days!  ***
LibClamAV Warning: ***   Please update it as soon as possible.    ***
LibClamAV Warning: **************************************************
Loaded ClamAV 0.92.1/5777/Mon Feb 11 19:04:11 2008
ClamAV: Protecting against 208929 viruses
                                                           [  OK  ]

And var/log/messages should output something like:

Sep  5 15:47:32 hosting clamav-milter[1706]: Loaded ClamAV 0.92.1/5777/Mon Feb 11 19:04:11 2008
Sep  5 15:47:32 hosting clamav-milter[1706]: ClamAV: Protecting against 208929 viruses
Sep  5 15:47:32 hosting clamav-milter[1707]: ClamAV-milter started at Sat Sep  5 15:47:32 2009
Sep  5 15:47:32 hosting clamav-milter[1707]: Starting ClamAV version 0.92.1, clamav-milter version 0.92.1


Set up hourly updating by making a link to freshclam from /etc/cron.hourly

cd /etc/cron.hourly
ln -sf /usr/bin/freshclam freshclam


When running freshclam manualy you will notice that it complains about being version 0.92.1, and recommending 0.95.2
To adress this, i will rebuild a new set of rpm files for seemless upgrading anytime soon. 0.95.x also supports the integration

of the google safe browsing database with the clamav milter, so it basicaly is a very nice option to have.

 

 

 

 

 



© Copyright 2010 by dePoPo.net