I now build ClamAV from the source code and run it under daemontools. This page explains how I set this up on my own server.
In addition, the "crash" repositories for clamav RPM files seems to no longer be working- either that, or he just hasn't had time to update them for the newer versions.
The rest of the page is no longer being actively maintained, however I am leaving it here as a reference for anybody who wants it.
One of the most common questions I see on the qmailrocks mailing list has to do with how to update your clamav packages. The version of clamav which is installed by the "current" version of qmailrocks (the 2.2.0 version) installs a really old version of clamav, a version which has serious enough security holes that a maliciously crafted email message could trick clamav into running arbitrary commands on your machine, as the clamav user.
My own expertise with Linux revolves around "RedHat and friends"- a set of distributions which are based on RedHat's source code, such as Fedora, WhiteBox Enterprise Linux and CentOS (which is currently my "distro of choice".) The directions on this page were developed using CentOS and tested with WhiteBox, RHEL 4, and Fedora Core 2, although they should work with any RPM-based Linux distribution.
Note: The following instructions should be completed by a non-root user, except for a few specific commands as noted in the text.
Download the source RPM file from the "crash" repositories linked from the clamav Binary packages page. If you are using Fedora, use the download link for your specific version of Fedora... for WhiteBox, CentOS, and RHEL, use the Fedora4 link.
Note that there are other packages listed on the page. Each package has its own instructions, as well as its own set of scripts to start and stop the services. The directions on this page are written specifically for the "crash" packages (I call them this because the hostname of the server has the word "crash" in it.) If you choose to download one of the other packages, be aware that their scripting will probably be different, and the directions on this page will have to be changed to match your system.
If you have not already done so, configure your home directory so that you can build RPM files without needing root privileges. This involves two steps:
Create an RPM build directory structure in your home directory. I call mine "rpm", you may want to call yours "rpmbuild" or whatever... but choose a name which doesn't already exist. The example assumes you are using "rpm" as the name:
% mkdir -m 755 rpm
% cd rpm
% mkdir -m 755 BUILD RPMS SOURCES SPECS SRPMS
.rpmmacros file in your home directory
which contains a pointer to the directory structure you just created. I use a
second line which marks any RPM packages I build with my own name and email
address- while not strictly required, it is a good idea. My file looks like
%packager John Simpson <firstname.lastname@example.org>
Obviously you need to substitute the full path to the "rpm" directory within your home directory, as well as your own name and email address.
Use the source RPM to build a set of binary RPM files. This example shows the Fedora5 link- I've never had any problem using the FC5 source RPM on CentOS or RHEL 4. Unless there is a direct match for your distro, I recommend going with the most recent Fedora version.
% wget http://crash.fce.vutbr.cz/crash-hat/5/clamav/clamav-0.88-7.src.rpm
% rpm -i clamav-0.88-7.src.rpm
% cd ~/rpm/SPECS
In some cases you may want to edit the spec file for some reason, to change the options it compiles with for example. For clamav we don't really need to, except that I usually change the "Release:" line from "1" to something like "1.centos4" or "1.fc2" so that I can tell which distro a given binary RPM was built for. In some cases you may need to make larger changes to the spec file- If you are making any changes to the spec file, this is the place in the procedure where those changes would be made.
% rpmbuild -ba --without milter clamav.spec
This should go through the process of configuring and compiling the clamav software. It will then "install" the software to a temporary working directory, and then scan that directory to build a list of the files which were installed. It then compares that list to a checklist in the spec file to make sure you aren't missing anything, and you aren't forgetting to include any files which are installed from the source, and then builds the binary RPM files (and a new source RPM file, which is useful if you made any changes to the spec file.)
If it complains about missing dependencies, read the error message carefully. In many cases the message will tell you the name of the package or library it needs, and a simple "yum install" command as root will be all you need in order to install what it needs (and then try the "rpmbuild" command again.)
Upgrade the clamav software.
|If your current clamav was installed using an earlier "crash" RPM
% su -
# cd ~userid/rpm/RPMS/i386
# rpm -Fvh clamav-*
Yes, that's the whole process.
|If your current clamav was installed using some other method...
The new clamav package will have created its config files so that the clamd process will run as a userid called clamav. If your system is currently set up in some other manner, you may need to edit the config files which control how clamd and freshclam operate. This web page explains the problem and two different solutions to it.
Run "freshclam" to upgrade the virus definition files.
Make sure the clamd and freshclam services are running, and that they will start automatically when the system boots up.
Start your SMTP and other services back up.