ClamAV Signatures Updater#

ClamAV abilities include loading external signatures, which are lists of hashes or fingerprints of viruses organised into so-called signature database, used to recognise a broader range of possible threats sent by e-mail.

There are many signatures provider that ClamAV can use, most of them licenced as Open Source; however using multiple signature databases may not always result in a higher precision of the ClamAV engine. Indeed, using too many signature databases may in some circumstances lead to false positive, therefore marking legitimate e-mails as as virus and send them to the quarantine or deleted. Moreover, since the signatures are loaded in RAM to allow for faster checks, this can lead to high CPU usage and, in case of a DB or a signature is corrupted or not 100% compatible, to the failure of the whole ClamAV engine.

For this reasons, Carbonio receives its signatures by a security partner, which are guaranteed to be 100% compatible with ClamAV and reduce the risk of false positives. In order to keep the signatures updated, Carbonio implements a system service, carbonio-avdb-updater.

To install it (in case it is not already present), login to the Proxy Node then update the list of packages to make sure the latest version is picked up and install the updater

# apt install carbonio-avdb-updater
# dnf install carbonio-avdb-updater

To complete the installation, run

# pending-setups -a

The command will ask for the password stored in the /var/lib/service-discover/password on the Directory Leader Node (i.e., the node on which the Mesh server is installed).

Verify Signature Status#

In order to verify that the service is working and signatures are updated, you can check the service’s log.

# journalctl -u carbonio-avdb-updater.service

If the signatures are updated, you will find in the log a block similar to:

Oct 18 09:28:25 srv2.example.com systemd[1]: Started Carbonio anti-virus updater
..
Oct 18 09:28:28 srv2.example.com carbonio-avdb-updater[2628063]: 09:28:28.028 [AVDB Scheduler_Worker-1] INFO  com.zextras.avdb.jobs.AvdbJob - ********************* S T A R T I N G ********************
Oct 18 09:28:28 srv2.example.com carbonio-avdb-updater[2628063]: 09:28:28.039 [pool-1-thread-1] INFO  c.z.a.client.networking.Downloader - download starting : /md5list.txt
Oct 18 09:28:28 srv2.example.com carbonio-avdb-updater[2628063]: 09:28:28.343 [pool-1-thread-1] INFO  c.z.a.client.networking.Downloader - download finished : /md5list.txt
Oct 18 09:28:28 srv2.example.com carbonio-avdb-updater[2628063]: 09:28:28.361 [ForkJoinPool.commonPool-worker-2] INFO  c.z.a.client.networking.Downloader - download starting : /securiteinfopdf.hdb
Oct 18 09:28:29 srv2.example.com carbonio-avdb-updater[2628063]: 09:28:29.594 [ForkJoinPool.commonPool-worker-2] INFO  c.z.a.client.networking.Downloader - download finished : /securiteinfopdf.hdb
..
Oct 18 09:28:44 srv2.example.com carbonio-avdb-updater[2628063]: 09:28:44.383 [pool-2-thread-1] INFO  c.z.a.client.networking.Downloader - download finished : /javascript.ndb
Oct 18 09:28:51 srv2.example.com carbonio-avdb-updater[2628063]: 09:28:51.582 [AVDB Scheduler_Worker-1] INFO  c.z.a.c.processing.ProcessExecutor - Added entry [/opt/zextras/bin/zmprov mcf +carbonioClamAVDat>
..
Oct 18 09:29:48 srv2.example.com carbonio-avdb-updater[2628063]: 09:29:48.930 [AVDB Scheduler_Worker-1] INFO  com.zextras.avdb.jobs.AvdbJob - ********************* F I N I S H E D ********************

Note

The above snippet it shortened for clarity.

The important information here are the S T A R T I N G and F I N I S H E D messages, which sign the start and successful termination of the signature update process. The same two messages are present if no update is available and downloaded:

Oct 18 09:34:28 srv2.example.com carbonio-avdb-updater[2628063]: 09:34:28.017 [AVDB Scheduler_Worker-1] INFO  com.zextras.avdb.jobs.AvdbJob - ********************* S T A R T I N G ********************
Oct 18 09:34:28 srv2.example.com carbonio-avdb-updater[2628063]: 09:34:28.019 [pool-21-thread-1] INFO  c.z.a.client.networking.Downloader - download starting : /md5list.txt
Oct 18 09:34:28 srv2.example.com carbonio-avdb-updater[2628063]: 09:34:28.035 [pool-21-thread-1] INFO  c.z.a.client.networking.Downloader - download finished : /md5list.txt
Oct 18 09:34:28 srv2.example.com carbonio-avdb-updater[2628063]: 09:34:28.039 [AVDB Scheduler_Worker-1] INFO  com.zextras.avdb.jobs.AvdbJob - ********************* F I N I S H E D ********************
The update process in detail

The signature update service maintains a list of the files/databases it downloads and their md5 checksums (md5sum) in file /opt/zextras/av_signatures/md5list.txt, which is also referenced from the LDAP. All the downloaded databases are stored under the same /opt/zextras/av_signatures/ directory.

The first task that the updater carries out is to download the md5list.txt file and verify the md5sums of the signature databases; a new signature database is downloaded only when the md5sum in the file does not match the one of the local file. This also means that if a signature database is not present (e.g., because it was deleted by mistake), it will be automatically downloaded.

A new database can be added by simply adding a new database and its md5sum in the /opt/zextras/av_signatures/md5list.txt file, while removing an entry from that file will make it unavailable to ClamAV.

Configure Signatures Updater#

When using the carbonio-avdb-updater, a few default configuration values can be customised, by defining them in a separate file, which must be named /opt/zextras/conf/avdb-updater-config.properties.

This file must be created and edited as the zextras user and populated it with one or more of the following values, depending which option you want to configure.

  • pollingSeconds (default value: 3600 seconds). How often the updater will check for new signatures and download them)

  • numberOfThreads (default value: 1). How many threads the services use.

  • virusDefinitionsFolder (default value: /opt/zextras/av_signatures). The folder where the antivirus signatures are stored. If you do not want to use the default directory, a new directory must be created manually as the zextras user and its path specified in the properties file.

    zextras$ mkdir -p /opt/zextras/custom_antivirus_signatures
    

An example of file /opt/zextras/conf/avdb-updater-config.properties is:

pollingSeconds=7200
numberOfThreads=3
virusDefinitionsFolder=/opt/zextras/custom_antivirus_signatures

Once the file has been saved, it is necessary to restart the service,, as the root user.

# systemctl restart carbonio-avdb-updater.service

To check that the new values have been picked up, you can check the systemd logs using the journalctl interface. For example, depending on the values you chose, use any of this commands.

# journalctl -u carbonio-avdb-updater.service|grep pollingSeconds
# journalctl -u carbonio-avdb-updater.service|grep numberOfThreads
# journalctl -u carbonio-avdb-updater.service|grep virusDefinitionsFolder

Their output will be similar to any of the following messages, which must include the new values:

srv01 carbonio-avdb-updater[4007247]: pollingSeconds=7200

srv01 carbonio-avdb-updater[4007247]: numberOfThreads=3

srv01 carbonio-avdb-updater[4007247]: virusDefinitionsFolder=/opt/zextras/custom_antivirus_signatures

Remove Signatures Updater#

In order to remove completely the automatic download of ClamAV’s signatures databases, you can uninstall the package carbonio-avdb-updater from every Proxy Node.

# apt purge carbonio-avdb-updater