You can automatically scan any file uploaded to Liferay for viruses. When you enable the antivirus scanner, it checks files on upload to Liferay applications, such as Documents and Media, Message Boards, and more. Virus-infected files are reported for users to reject.
Liferay DXP 7.1 Fix Pack 20+ (and Service Pack 5+) integrates with the ClamAV Daemon (Clamd) running on a separate server.
Note: Prior to DXP 7.1 Fix Pack 20, the ClamAV antivirus scanner ran locally. Now DXP delegates antivirus scanning to a separate server.
Here’s how to enable the Clamd antivirus scanner:
-
On a separate server, configure and start Clamd.
Important: Load your ClamAV database before starting Clamd.
-
Enable antivirus for your File Store (Document Library) by setting the following portal property or Docker Environment variable.
Portal property:
dl.store.antivirus.enabled=true
Environment variable:
-e LIFERAY_DL_PERIOD_STORE_PERIOD_ANTIVIRUS_PERIOD_ENABLED=true
-
Start your DXP server.
-
Go to Control Panel → System Settings, and select Antivirus in the Security category.
-
Select Antivirus Clamd Scanner in the menu.
-
Enter the Clamd server’s hostname or IP address, port, and a connection timeout time (milliseconds).
-
Click Save.
Now files are scanned on upload to Liferay applications. If a virus is detected in a file you’re uploading, the scanner reports the infected file–decline saving the file.
Important: Never save a virus-infected file. Reject the file by canceling the current operation.