Issue
The standard Liferay DXP documentation covers integrating with ClamAV. However, developers may need to integrate a different third-party antivirus engine by extending Liferay's built-in BaseFileAntivirusScanner class.
Environment
- DXP 7.3
Resolution
To create a custom antivirus scanner, build an OSGi module that registers your implementation as a service component.
- You need to create a war hook (here's an article on war hooks: https://help.liferay.com/hc/en-us/articles/360018170611-WAR-Hook-Template).
- Don't put any antivirus-specific properties in your portal-ext.properties file (the war-hook module will contain the necessary properties).
- Please find attached such a war hook proof-of-concept, which you can test with these steps:
1. Start your 7.3 fp1 server and wait until it is fully up.
2. Copy the my-war-hook.war app to your deploy folder.
3. Log in to the server and try to upload a file to documents and media.
Result:
The console log should show you:
2021-06-10 18:09:05.396 INFO [fileinstall-directory-watcher][BundleStartStopLogger:46] STARTED my-war-hook_7.3.10.1 [1651] * antivirus scanner works: This is the scan file method *
Additional Information