mod_clamav
Uses clamd to scan all uploaded files for viruses.
The scanning happens after the mime type and access control is checked, but before the sanitization. If a file is
infected then the error infected will be returned. The admin will display a growl message telling that the file was infected.
Clamd has a maximum size for checks, above that size the error sizelimit will be returned.
Configure in the zotonic.config file where clamd is listening.
The following configs are available:
clamav_socket
Unix domain socket path of clamd, default to /run/clamav/clamd.ctl. Before every scan or ping,
the module tries to connect to this socket. If the connection fails, it falls back to clamav_ip
and clamav_port. Set to false or an empty string to use TCP only. The Zotonic process must have
permission to connect to the socket. Set this path to the LocalSocket value in clamd.conf.
clamav_ip
IP address of clamd, default to "127.0.0.1"
clamav_port
Port of clamd, default to 3310
clamav_max_size
The StreamMaxLength of clamd, default to 26214400 (25M)
clamav_reject_msoffice_external_links
Reject Microsoft Office documents containing externalLinks information. If the Zotonic config is set to false then
rejection can be forced by setting the site’s config key mod_clamav.reject_msoffice_external_links to 1. Defaults
to true.
All clamav results are logged, any infected files or other errors are logged to the error.log.
Every hour the module checks if it can reach clamd using the configured settings. It will log an error if clamd
can’t be reached, and an info message if it can be reached.
The admin dashboard also checks connectivity asynchronously on each page load. If ClamAV cannot be reached, it displays a warning that file uploads are blocked until the scanner is available again.
Accepted Events
This module handles the following notifier callbacks:
observe_media_upload_preprocess: Check the uploaded file with clamav usingz_acl:user.observe_tick_1h: Periodic ping of clamav using the configured socket or TCP endpoint.