Antivirus configuration

OpenKM can be integrated with an anti virus software which is be able to execute anti virus check from command line.

The example below is based on ClamAV, an Open Source anti virus engine which detects trojans, viruses, malware & other malicious programs.


Debian / Ubuntu

Install antivirus:

$ sudo aptitude install clamav

Go to Administration > Configuration parameters:

Field / PropertyTypeDescription
system.antivir String


Red Hat / CentOS

ClamAV is not present by default in default repositories, so you must install it from a non default one.

Repository valid for Centos 5.2 ( for other versions it may be different ):

name=Dag RPM Repository for Red Hat Enterprise Linux

Install antivirus:

$ yum install clamd

Start the daemon:

$ /etc/init.d/clamd start

Update the virus database:

$ freshclam


To Install and configure ClamAV on Windows:

Note: GREEN Text like this denotes commands run in a command console/terminal

BLACK Text like this denotes code changes

  • Unpack the ZIP archive and move it to: C:\ so that it appears in your path as: C:\ClamAV
  • Copy the example conf files from C:\ClamAV\conf_examples to C:\ClamAV
  • Open up a command terminal: Start->Run cmd
  • Change to the ClamAV directory: cd C:\ClamAV
  • Run clamconf.exe, it should inform that you need to edit the example config file. (I included this just so you can check that the files are in the right location)

For DEFAULT MINIMAL configuration (Probably not suitable and you should configure the parameters for your situation) Edit freshclam.conf, clamav-milter.conf and comment Example. In addition to commenting Example in clamd.conf; to enable the local server you will need to change line 80 to: LocalSocket C:\CLAMAV\clamd.socket

  • Run clamconf.exe again, you will get an output of all your configurations.

At the beginning you will get a message about being unable to open database, this is because it has not yet been created.

  • Run mkdir database. If you run clamconf again you will see that the database error is gone and that you have 0 signatures
  • Run freshclam.exe, this will start the initial signature download for ClamAV and may take a few minutes.

At this point you can run clamd.exe to check that the server can run manually. (If you decide to test run at this point, you will have to kill the process for the next section)

In case you need to create a freshclam.conf file use this as base:

# URL of server where database updates are to be downloaded from
# If this option is given multiple times, each will be tried in
# the order given until an update is successfully downloaded
DatabaseDirectory "C:\Program Files\ClamAV-x64\db\"
# Number of times to try each mirror before moving to the next one
MaxAttempts 3
#LogFile C:\Program Files\ClamAV-x64\log\freshclam.log
#NotifyClamd C:\Program Files\ClamAV-x64\clamd.conf
LogFileMaxSize 20480000
LogTime true
UpdateLogFile C:\Program Files\ClamAV-x64\log\freshclam.log

ClamdServiceSetup">Clamd Service Setup

Now to setup it up so it starts automatically:

Details for the screen capture are below:

  • Run sc create ClamD binPath= C:\Program Files\Windows Resource Kits\Tools\srvany.exe (yes the space is required in this command and you may have your resource tools in a different location)

It should tell you: [SC] CreateService SUCCESS

  • Run Regedit. Find: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ClamD
    • Right click on ClamD and create a new Key
    • Name the key Parameters
    • Click on the new Parameters Key, in the right pane create a new String Value
    • Name the String Value Application
    • Right click and Modify Application to: C:\ClamAV\clamd.exe -c C:\ClamAV\clamd.conf
    • Close Regedit
  • Run services.msc
    • Find ClamD in the list
    • Right click -> Properties
    • Change Startup type to: Automatic
    • Select the recovery tab and change all three failures to: Restart the Service
    • Select the General tab and Apply

FreshclamVirusSignatureAutoUpdate">Freshclam Virus Signature Auto Update

Almost done!

  • Navigate to: Start->All Programs->Accessories->System Tools->Scheduled Tasks
  • Add Scheduled Task
  • Next->Browse to C:\ClamAV\freshclam.exe
  • Select to Perform this task daily
  • Next
  • Select a good time to update
  • Next
  • Enter the user credentials to run as
  • Next
  • Select open Advance options
  • Next
  • Alter Run to be: C\ClamAV\freshclam.exe -c C:\ClamAV\freshclam.conf
  • Select the Settings Tab
  • Change the Stop Task to 30 minutes
  • Apply
  • Ok

Right click and run the freshclam task to make sure you do not have any errors.

Go to Administration > Configuration parameters:

Field / PropertyTypeDescription
system.antivir String


If everything was configured correctly, OpenKM will scan every uploaded document in order to check if it's safe.