Legacy Knowledge Base
Published Jul. 2, 2025

Setting Up ClamAV With the Liferay Platform on Windows

Written By

Brian Larson

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

This article documents how to set up Clam Antivirus with the Liferay platform on Windows for testing purposes. The goal is to scan documents for viruses when they are being uploaded.

Resolution

  1. Download ClamWin for Windows. You can update to a more recent version after installation. For other operating systems, try http://www.clamav.net/ 
  2. Run the ClamWin installer with default settings.
  3. Once installation completes and the database updates, copy the directory C:\ProgramData\.clamwin\db into C:\Program Files (x86)\ClamWin\bin\.
  4. Update the PATH variable to include C:\Program Files (x86)\ClamWin\bin\.
  5. Verify that ClamAV is functioning properly by scanning a file. Download a test eicar file and run: clamscan --stdout --no-summary [path to test file]. You will likely need to modify your machine's antivirus to allow the file to be downloaded.

    You should see this output:

    C:\Users\liferay>clamscan --stdout --no-summary C:\Users\liferay\Downloads\eicar.com.txt
    Loading virus signature database, please wait... done
    C:\Users\liferay\Downloads\eicar.com.txt: Eicar-Test-Signature FOUND
  6. Now, configure the Liferay platform's implementation of ClamAV. Add the following properties to the portal-ext.properties file: 
    # Set this property to true to enable execution of antivirus check when
    # files are submitted into a store. Setting this value to true will prevent
    # any potential virus files from entering the store but will not allow for
    # file quarantines.
    #
    dl.store.antivirus.enabled=true
    
    #
    # Set the name of a class that implements
    # com.liferay.portlet.documentlibrary.antivirus.AntivirusScanner. The
    # document library server will use this to scan documents for viruses.
    #
    #dl.store.antivirus.impl=com.liferay.portlet.documentlibrary.antivirus.DummyAntivirusScannerImpl
    dl.store.antivirus.impl=com.liferay.portlet.documentlibrary.antivirus.ClamAntivirusScannerImpl
  7. Start the platform and login as the admin.
  8. Add a documents and media portlet to a page and upload the eicar file.

Expected Result

The documents and media portlet says Your request failed to complete and A virus was detected in the file

The upload has been successfully blocked. 

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base