Download the PHP package masilia/clamav-bundle without Composer
On this page you can find all versions of the php package masilia/clamav-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download masilia/clamav-bundle
More information about masilia/clamav-bundle
Files in masilia/clamav-bundle
Package clamav-bundle
Short Description This bundle provides easy scanning virus with clamAv antivirus for Symfony and eZ Platform
License
Informations about the package clamav-bundle
Masilia ClamAv Bundle
This bundle provides an antivirus scan with clamAv for Symfony and eZ Platform formBuilder
Requirements
- eZ Platform 2.5+
Install instructions
-
Add the project repository:
In the main
composer.json
, add: -
Install the bundle via Composer (initial installation):
2.1 Update the bundle via Composer if needed
-
Activate the bundle in your
app/AppKernel.php
: -
install the clamAv modules in your server
4.1 Under Debian distribution, run the following commands (adapt according to the distribution used):
4.2 To update the database, we stop the
clamav-freshclam
service and then run the corresponding command as follows:4.3 Config the ClamAv service:
- 4.3.1 run the clamAv with TCP|IP protocol.
-- Under the file/etc/clamav/clamd.conf
Add these lines to the config:
-- Under the file
/etc/systemd/system/clamav-daemon.service.d/extend.conf
Add the line:-
4.3.2 or run the clamAv with UNIX socket protocol.
-- Under the file /etc/clamav/clamd.conf Add the line : -
4.3.3 After these configs you can restart your service :
-
4.3.4 Add the
clamav
user to the groupwww-data
: -
To make sure, execute the command :
- Output :
- 4.3.1 run the clamAv with TCP|IP protocol.
-
To make sure that our clamav-daemon service is running under the socket ip:port configured or the unix local socket , we execute the command :
-
Output if the clamAv is lessening to the configured unix local socket :
-
Output if the clamAv is lessening to the configured TCP|IP socket :
- Output if we configured both protocols:
- Configuration of app/config/config.yml file
-
Usage
5.1 Antivirus constraint
-
In symfony object form To enable Antivirus constraint on your form Type for the input file add the following lines .
- In eZ Platform form builder you can just pass the parameter to
true
then add validation with Antivirus in the config file panel on the BO while editing your form. - In BO to active scan with ezbinaryfile FiledType you can just pass the parameter to
true
5.4 Customize error message
- To customize server error message add this message error key "antivirus_constraint_message" in messages translation file Resources/translations/messages.{locale}.{yml|php|xliff}
- Override the antivirus service
*To do, you implement the interface
Masilia\ClamavBundle\Services\AntivirusInterface
and the value to return from your service is an array with keys[status => Ok|KO]
and[reason => ' your statment ... ']
- Override the antivirus service
*To do, you implement the interface
- then declare your service as following:
Troubleshooting
if you get in your logs the message like :
The connexion with the antivirus server is failed, make sure that is the correct socket root path socket_root
There is an issue with file path ,first check the root_path
param , if the issue steel occurring in that case the stream scan is privileged , you can enable it in parameters, it may resolve yur issue.
Check the param root_path
probably you've put the wrong path where the file is uploaded by PHP