Antivirus configuration
OpenKM can be integrated with an anti virus software which is able to execute an anti virus check from the 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
Section titled “Debian / Ubuntu”Install antivirus:
$ sudo aptitude install clamavGo to Administration > Configuration parameters:
| Field / Property | Type | Description |
|---|---|---|
| system.antivir | String | /usr/bin/clamscan |
| background.antivirus.check | Boolean | true |
| background.antivirus.check.threads | Integer | 20 |
| background.antivirus.check.batch | Integer | 2 |
More information about configuration parameters:
Red Hat / CentOS
Section titled “Red Hat / CentOS”ClamAV is not present by default in the 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):
[dag]name=Dag RPM Repository for Red Hat Enterprise Linuxbaseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag/gpgcheck=1gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txtenabled=1Install the antivirus:
$ yum install clamdStart the daemon:
$ /etc/init.d/clamd startUpdate the virus database:
$ freshclamWindows
Section titled “ Windows”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
-
Download the newest version from: https://www.clamav.net/downloads
-
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 a command terminal: Start->Run
**cmd** -
Go 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.
-
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 a 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#MAKE SYUDatabaseDirectory "C:\Program Files\ClamAV-x64\db\"DatabaseMirror database.clamav.net# Number of times to try each mirror before moving to the next oneMaxAttempts 3#LogFile C:\Program Files\ClamAV-x64\log\freshclam.log#NotifyClamd C:\Program Files\ClamAV-x64\clamd.confLogFileMaxSize 20480000LogTime trueUpdateLogFile C:\Program Files\ClamAV-x64\log\freshclam.logClamd Service Setup
Section titled “Clamd Service Setup”Now to set 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**(the space is required in this command and you may have your resource tools in a different location)
It should give the message: [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
Freshclam Virus Signature Auto Update
Section titled “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 Perform this task daily
- Click Next
- Select a good time to update
- Click Next
- Enter the user credentials to run the update as
- Click Next
- Select open Advance options
- Click Next
- Alter Run to be:
**C\ClamAV\freshclam.exe -c C:\ClamAV\freshclam.conf** - Select the Settings Tab
- Change 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 / Property | Type | Description |
|---|---|---|
| system.antivir | String | **C:\ClamAV\clamscan.exe** |
| background.antivirus.check | Boolean | true |
| background.antivirus.check.threads | Integer | 20 |
| background.antivirus.check.batch | Integer | 2 |
More information about configuration parameters:
If everything was configured correctly, OpenKM will scan every uploaded document in order to check if it’s safe.