Skip to main content

Tutorial: Antivirus (ClamAV) Setup

Role: Site Administrator
Time: 30โ€“45 minutes
OJS Version: 3.5+

OJS accepts file uploads from authors, reviewers, and editors. The ClamAV Scanner Plugin scans uploaded files for malware and viruses before they are stored on the server.


Before You Startโ€‹

  • You have root or sudo access to the OJS server.
  • Your server runs Linux (Ubuntu/Debian or CentOS/RHEL).
  • You have Site Administrator access in OJS.

Step 1 โ€” Install ClamAV on the Serverโ€‹

Ubuntu / Debianโ€‹

sudo apt update
sudo apt install clamav clamav-daemon -y

CentOS / RHEL / AlmaLinuxโ€‹

sudo dnf install clamav clamd clamav-update -y

Step 2 โ€” Update Virus Definitionsโ€‹

sudo systemctl stop clamav-freshclam
sudo freshclam
sudo systemctl start clamav-freshclam

Enable the definitions auto-updater:

sudo systemctl enable clamav-freshclam

Step 3 โ€” Start the ClamAV Daemonโ€‹

The OJS plugin uses the ClamAV daemon (clamd) for faster scanning:

sudo systemctl start clamav-daemon
sudo systemctl enable clamav-daemon

Verify it is running:

sudo systemctl status clamav-daemon

The daemon listens on a Unix socket by default at /var/run/clamav/clamd.ctl.


Step 4 โ€” Install the ClamAV Scanner Pluginโ€‹

  1. Log in to OJS as Site Administrator.
  2. Go to Administration โ†’ Plugin Gallery.
  3. Search for ClamAV.
  4. Click Install.

Or download from github.com/pkp/clamav and upload to /plugins/generic/clamav/.


Step 5 โ€” Enable and Configure the Pluginโ€‹

  1. Go to Administration โ†’ Site Settings โ†’ Plugins โ†’ Installed Plugins.
  2. Find ClamAV Scanner and toggle to Enabled.
  3. Click the Settings icon.
  4. Configure:
FieldValue
ClamAV socket path/var/run/clamav/clamd.ctl (default on Ubuntu)
Scan on uploadEnable โ€” scans every uploaded file
Block on detectionEnable โ€” reject infected files
  1. Click Save.

Step 6 โ€” Test the Integrationโ€‹

  1. Download the EICAR test file โ€” a harmless test string that ClamAV detects as a virus:
    https://www.eicar.org/download/eicar.com.txt
  2. Rename the file to eicar-test.pdf (or any supported extension).
  3. Attempt to upload the file as a submission galley or revision in OJS.
  4. OJS should reject the upload with an error message indicating a virus was detected.

Maintaining ClamAVโ€‹

TaskCommand
Update definitions manuallysudo freshclam
Check daemon statussudo systemctl status clamav-daemon
View scan logssudo tail -f /var/log/clamav/clamav.log
Restart daemon after updatessudo systemctl restart clamav-daemon

Troubleshootingโ€‹

ProblemSolution
Plugin cannot connect to daemonCheck socket path matches /var/run/clamav/clamd.ctl; verify clamd is running
EICAR test file not blockedEnsure "Block on detection" is enabled in plugin settings
ClamAV daemon not startingCheck server memory; ClamAV requires at least 512 MB RAM
Freshclam update failsCheck server internet access and DNS resolution
Socket permission deniedAdd the web server user (e.g., www-data) to the clamav group: sudo usermod -aG clamav www-data

Next Stepsโ€‹