ClamAV - Updating Version

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

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.87.1 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 (Current Stable Version is 0.87.1) 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: Code:

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

This assumes zimbra is user and group id 501, 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.87.1

You can do all the following without restart zimbra as a whole if you wish, or you can restart the whole suite.

Stop Amavis from running, note mail service will be stopped and mail will be potentially lost if amavis isn't running and postfix gets mail.

Run: zmamavisctl stop or zmcontrol stop to stop amavis.

Delete the symbolic link /opt/zimbra/clamav

Re-link it to the new install: Code:

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

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:




    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/

  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


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

User zimbra



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/

  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 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.


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.


Jump to: navigation, search