ClamAV - Updating Version

Revision as of 16:49, 6 May 2007 by Scottnelson (talk | contribs)

Thanks to "Unilogic" AKA: Ben for most of this writeup. Parts have been updated to reflect lastest revision.

If you have no idea how to upgrade or are a little shakey in doing the upgrade yourself, recommend that you wait for the Zimbra official release.

Note: This was done on Fedora Core 4 minimal install. Also, all the following can be done either as root or as the zimbra user. If you do it all as 'root', make sure you change ownership for the resulting clamav-0.90.2 folder in /opt/zimbra to zimbra:zimbra.

When ClamAV releases new version and gets out of date, it will complain in its log files as such.

To update, follow the following: First go grab the latest ClamAV source from http://www.clamav.net/download (Current Stable Version is 0. 90.2 ) Extract it to where ever you please. All this can either be done as root or as the zimbra user. If you do it all as root make sure you change ownership for the resulting clamav folder in /opt/zimbra to zimbra:zimbra.

Next run configure inside of the clamav extract as following:

START CODE

./configure --prefix=/opt/zimbra/clamav-0.90.2 --with-user=zimbra --with-group=zimbra

END CODE

This assumes zimbra is user and group id 'zimbra', change it accordingly to your system to match your zimbra user.

Note: I had to install gmp-devel and bzip2-devel so the configure could find all its header files. Your mileage may very. If you get an error about GNU MP missing install gmp-devel. "yum install gmp-devel", and "yum install bzip2-devel" in Fedora and Red Hat.


If your configure goes well, and make sure it does as you don't really want ClamAV installed without some of its available testing ability being compiled.

Run: make Assume no errors, Run: make check, and then make install. Again assuming no errors, you now have the new version installed into /opt/zimbra/clamav-0.90.2

Run: zmcontrol stop everything.

Delete the symbolic link /opt/zimbra/clamav

Re-link it to the new install:

START CODE

ln -s /opt/zimbra/clamav-0.87.1 /opt/zimbra/clamav

END CODE

Now we need to edit clam and freshclam's conf files. I'm not entirely sure if this is actually necessary, but we didn't configure the default paths and options for a few things at build time so I think it is.

Create directory /opt/zimbra/clamav/db

In /opt/zimbra/clamav/etc/clamd.conf edit these settings:

START CODE

Code:

    1. Example config file for the Clam AV daemon
    2. Please read the clamd.conf(5) manual before editing this file.
  1. Comment or remove the line below.
  2. Example
  1. Uncomment this option to enable logging.
  2. LogFile must be writable for the user running daemon.
  3. A full path is required.
  4. Default: disabled

LogFile /opt/zimbra/log/clamd.log

  1. This option allows you to save a process identifier of the listening
  2. daemon (main thread).
  3. Default: disabled

PidFile /opt/zimbra/log/clamd.pid

  1. Path to the database directory.
  2. Default: hardcoded (depends on installation options)

DatabaseDirectory /opt/zimbra/clamav/db

  1. TCP port address.
  2. Default: disabled

TCPSocket 3310

  1. TCP address.
  2. By default we bind to INADDR_ANY, probably not wise.
  3. Enable the following to provide some degree of protection
  4. from the outside world.
  5. Default: disabled

TCPAddr 127.0.0.1

  1. Run as a selected user (clamd must be started by root).
  2. Default: disabled

User zimbra

END CODE

Note: These are just the settings I changed and are not continous, but are in order from top to bottom referencing the order of the actual clamd.conf file. There are many other parts to the file, but no other settings were changed.

In /opt/zimbra/clamav/etc/freshclam.conf edit these settings: Code:

    1. Example config file for freshclam
    2. Please read the freshclam.conf(5) manual before editing this file.
    3. This file may be optionally merged with clamd.conf.


  1. Comment or remove the line below.
  2. Example
  1. Path to the database directory.
  2. WARNING: It must match clamd.conf's directive!
  3. Default: hardcoded (depends on installation options)

DatabaseDirectory /opt/zimbra/clamav/db

  1. Path to the log file (make sure it has proper permissions)
  2. Default: disabled

UpdateLogFile /opt/zimbra/log/freshclam.log

  1. This option allows you to save the process identifier of the daemon
  2. Default: disabled

PidFile /opt/zimbra/log/freshclam.pid

  1. By default when started freshclam drops privileges and switches to the
  2. "clamav" user. This directive allows you to change the database owner.
  3. Default: clamav (may depend on installation options)

DatabaseOwner zimbra

Note: Again this is just a few of the settings in the freshclam.conf file. They are the ones I changed. The rest are left at default.

Now you should make sure zimbra owns all of clamav. Code:

chown -R zimbra:zimbra /opt/zimbra/clamav-0.87.1

Next we need to update the virus database. Run: /opt/zimbra/clamav/bin/freshclam

Need to start amavis back up. Either run: zmamavisdctl start, or zmcontrol start depending on how you stop before. Run zmcontrol status to make sure antivirus is running. If it is your good to go.

You should check /opt/zimbra/log/clamd.log for errors, as well as freshclam in the same directory. Also /var/log/zimbra.log. To test out ClamAV I would suggest http://www.webmail.us/testvirus to send different variations of the EICAR test virus to one of your email addresses. Depending on if you have "Send notice ot recipient" check in Global Settings of the Admin Web UI, the user should receive around 20 email notifications of the emails being quarantined. Don't worry about the two that got through. Apparently ClamAV doesn't check for the techniques. There are although no virii included in those two emails, so it doesn't worry me. If anyone has any problems let me know.

-Ben

Edit: You can delete the previous install of clamav once you make sure everything is working. Delete the /opt/zimbra/clamav-0.85.1 directory and everythnig it contains. Again make sure you have the other version working well first.

-Ben

Jump to: navigation, search