You can configure FileCloud to scan uploaded files using ClamAV, an open source antivirus software that is included with FileCloud.
ClamAV is available for:
When a virus is detected in an uploaded file, the following actions occur:
- The incoming file is deleted.
- An alert will be displayed in the Admin Portal.
- A toast will be displayed in the User Portal.
- An entry will be added in the audit log about virus detection in the file and subsequent deletion of the file.
To Use ClamAV
In the following section, to display more information, click on a step.
To install ClamAV in Ubuntu:
Install the ClamAV package
You might need to run 'freshclam' to update the antivirus database files
Update the ClamAV-Daemon mode to use TCP, by running the sudo dpkg-reconfigure clamav-base
In the reconfigure wizard, choose Socket Type TCP and Interface as localhost to listen to.
After reconfigure finishes, verify the clamd.conf file is setup correctly (/etc/clamav/clamd.conf)
NOTE: TCPAddr localhost may not work. You can enter the filecloud URL in place of TCPAddr to make it work
Additional commands for Ubuntu 16
To install ClamAV on Windows:
- Download and Install ClamWin Free Antivirus. Use this path when installing: C:\ClamAV\ClamWin
- Download ClamAV for Windows from this link http://oss.netfarm.it/clamav/. Download the Win64 build (it will be something like clamav-amd64-<someversion>.7z).
- To extract the downloaded .7z file, Use 7z extractor from http://www.7-zip.org/download.html .
- Extract the clamav-amd64-<someversion>.7z file to C:\ClamAV location. All the files must be extracted and saved in C:\ClamAV location
*Note: After extracting it, make sure that the files clamd.exe are in c:\ClamAV (If it extracted it inside a subfolder, move all the files from that subfolder back in to c:\ClamAV). Mandatory Step
Create these extra folders:
Modify the Antivirus Database download folder in ClamWin Free Antivirus to point it to C:\ClamAV\db and update the DB.
Open C:\ClamAV\ClamWin\bin and run ClamWin Application.
Tap on Tools -> Preference -> File Locations
You’ll need the Windows Server 2003 Resource kit (It works on 2012 R2). Get it here : http://www.microsoft.com/en-us/download/confirmation.aspx?id=17657 and copy / move instsrv.exe and srvany.exe in the same directory as ClamAV (C:\ClamAV).
Go to DOS prompt (cmd) with elevated rights and go to C:\ClamAV. Enter: instsrv.exe ClamD c:\ClamAV\srvany.exe
Now edit the registry to let clamd.exe run using it’s clamd.conf file when started as a service.
NOTE: It is dangerous to edit the registry, follow carefully
§ Navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ClamD
§ Right click on Clamd and create a new Key called Parameters
§ Right click on Parameters and create a new String Value called Application
§ Edit the new Application REG_SZ and add c:\ClamAV\clamd.exe -c c:\ClamAV\clamd.conf
§ Right click on CalmD and create a new String Value called Description
§ Edit the new Description REG_SZ and add ClamAV Antivirus For FileCloud
Then you can start and stop ClamD in Services or manually:
You can check if clamav is listening on the right port:
Follow the FileCloud instructions to connect to the hostname of the local machine.
Below is a sample of clamd.conf
Once ClamAV is setup and started, the next step is to add details of the ClamAV service to FileCloud server.
To integrate ClamAV with FileCloud:
- Open a browser, log in to the Admin Portal, and from the left navigation panel, click Settings.
- On the Manage Settings screen, select the Third Party Integrations tab.
- On the Third Party Integrations tab, select the Anti-Virus sub-tab.
- On the Anti-Virus sub-tab, in Anti-Virus Type, select Clam AV.
- Select the Clam AV sub-tab.
- On the Clam AV tab, select the checkbox for Enable ClamAV Scan.
Enter the following information:
Setting Description Enable ClamAV Scan Check this setting to enable AV scanning ClamAV Host
Enter the URL or IP of the system where Clam AV is running. This can be local or remote system.
ClamAV Port The port used by ClamAV (This is set when ClamAV is installed in the previous section) Skip scanning for files greater than This is the file limit in bytes that will be scanned. For example, very large files can be excluded from scanning. Default value is 25MB Stream Chunk Size This is a advanced setting used to stream the file content to ClamAV for scanning. Default is 8KB.
To verify connectivity, click the ClamAV Test button.
- If a file fails AV check (i.e. a virus detected) then the file will be deleted and an entry will be added to the Audit log with the details of the file.
If scanning fails
If scanning fails because the ClamAV server is down, a message appears on your screen, and your Manage Alerts page displays the warning:
Unable to communicate with ClamAV Server. Check immediately.
By default, if ClamAV fails to scan a file because the ClamAV server is down, the file is not deleted.
To automatically delete files if ClamAV scan fails because the ClamAV server is unavailable:
- Open the configuration file:
Windows: XAMPP DIRECTORY/htdocs/config/cloudconfig.php
Add the line:
Now, when scan fails, the file is deleted, and the audit log displays the message: ClamAV removed [FILE_PATH] due to scan fail.
If TONIDOCLOUD_CLAMAV_DELETE_ON_SCAN_FAIL is enabled and the CLAMAV server is not available, FileCloud does not allow files to be uploaded.