ClamAV is a very good open source virus detector. It can detect virus’ from the command line but the best part of it is that you can plug it into Sendmail or most other MTA’s and use it to check your emails for virus’.
This documentation was done and tested using FreeBSD 6.2 and ClamAV version 0.90.2 from the FreeBSD ports tree.
Checking your Sendmail
ClamAV connects into Sendmail through it’s MILTER interface. A MILTER is a standard API to allow external programs to functions as mail filters. FreeBSD’s version of Sendmail has MILLTER support built into it by default. Use the following command to check your version of Sendmail to make sure it has MILTER support built it.
# sendmail -d0.1 -bt < /dev/null | grep MILTER
You should see a line with the work MILTER in it. If you do not see the line then you will have to recompile your version of Sendmail with MILTER support. How to do this is beyond the scope of this how-to.
Building the ClanAV port.
ClamAV is in the FreeBSD ports tree and needs to be built with the MILTER support turned in.
# cd /usr/ports/security/clamav
# make WITH_MILTER=yes install
# make clean
Be sure to use the WITH_MILTER=yes command line option (or turn on MILTER support from the ports option screen).