{"result":{"depiction_url":null,"edges":{"observes":{"objects":[{"created":"2026-09-09T13:47:45Z","object_id":{"id":1915,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_media_upload_preprocess","title":"observe_media_upload_preprocess\/2","uri":"https:\/\/zotonic.com\/id\/1915"},"seq":1}],"predicate":{"id":2550,"is_a":["meta","predicate"],"name":"observes","title":{"_type":"trans","tr":{"en":"Observes"}},"uri":"https:\/\/zotonic.com\/id\/observes"}},"subject":{"objects":[{"created":"2026-09-09T13:47:46Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-09T13:47:46Z","object_id":{"id":2566,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_operator","title":"Operator","uri":"https:\/\/zotonic.com\/id\/2566"},"seq":2},{"created":"2026-09-09T13:47:46Z","object_id":{"id":2580,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_file_uploads","title":"File uploads","uri":"https:\/\/zotonic.com\/id\/2580"},"seq":3},{"created":"2026-09-09T13:47:46Z","object_id":{"id":2610,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_malware_scanning","title":"Malware scanning","uri":"https:\/\/zotonic.com\/id\/2610"},"seq":4},{"created":"2026-09-09T13:47:46Z","object_id":{"id":2635,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_module","title":"Module","uri":"https:\/\/zotonic.com\/id\/2635"},"seq":5},{"created":"2026-09-09T13:47:46Z","object_id":{"id":2685,"is_a":["categorization","keyword","keyword_quality"],"name":"zotonic_topic_security","title":"Security","uri":"https:\/\/zotonic.com\/id\/2685"},"seq":6}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":1477,"is_a":["text","documentation","reference","module"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1477"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_module_mod_clamav","page_url":{"en":"https:\/\/zotonic.com\/docs\/1477\/mod_clamav","x-default":"https:\/\/zotonic.com\/docs\/1477\/mod_clamav"},"preview_url":null,"resource":{"version":3384,"pivot_location_lat":null,"title":"mod_clamav","is_authoritative":true,"body":"<p>Uses <code>clamd<\/code> to scan all uploaded files for viruses.<\/p>\n<p>The scanning happens after the mime type and access control is checked, but before the sanitization. If a file is\ninfected then the error <code>infected<\/code> will be returned. The admin will display a growl message telling that the file was infected.<\/p>\n<p>Clamd has a maximum size for checks, above that size the error <code>sizelimit<\/code> will be returned.<\/p>\n<p>Configure in the <code>zotonic.config<\/code> file where <code>clamd<\/code> is listening.<\/p>\n<p>The following configs are available:<\/p>\n<p><code>clamav_ip<\/code><\/p>\n<p>Address of <code>clamd<\/code>, default to <code>&quot;127.0.0.1&quot;<\/code>. Set to <code>socket<\/code> to connect only to the Unix domain\nsocket configured by <code>clamav_socket<\/code>, or set it to an absolute socket path to connect only to that\nsocket. Socket-only connections never fall back to TCP.<\/p>\n<p><code>clamav_port<\/code><\/p>\n<p>Port of <code>clamd<\/code>, default to <code>3310<\/code><\/p>\n<p><code>clamav_socket<\/code><\/p>\n<p>Unix domain socket path of <code>clamd<\/code>, default to <code>\/run\/clamav\/clamd.ctl<\/code>. When <code>clamav_ip<\/code> is a network\naddress, the module tries this socket first and falls back to <code>clamav_ip<\/code> and <code>clamav_port<\/code>. Set to\n<code>false<\/code> or an empty string to use TCP only. When <code>clamav_ip<\/code> is <code>socket<\/code>, this is the exclusive socket\npath. The Zotonic process must have permission to connect to it. The path must match <code>LocalSocket<\/code> in\n<code>clamd.conf<\/code>.<\/p>\n<p><code>clamav_max_size<\/code><\/p>\n<p>The <strong>StreamMaxLength<\/strong> of <code>clamd<\/code>, default to <code>26214400<\/code> (25M)<\/p>\n<p><code>clamav_reject_msoffice_external_links<\/code><\/p>\n<p>Reject Microsoft Office documents containing <code>externalLinks<\/code> information. If the Zotonic config is set to <code>false<\/code> then\nrejection can be forced by setting the site’s config key <code>mod_clamav.reject_msoffice_external_links<\/code> to <code>1<\/code>. Defaults\nto <code>true<\/code>.<\/p>\n<p>All clamav results are logged, any infected files or other errors are logged to the error.log.<\/p>\n<p>Every hour the module checks if it can reach <code>clamd<\/code> using the configured settings. It will log an error if <code>clamd<\/code>\ncan’t be reached, and an info message if it can be reached.<\/p>\n<p>The admin dashboard also checks connectivity asynchronously on each page load. If ClamAV cannot\nbe reached, it displays a warning that file uploads are blocked until the scanner is available again.<\/p>\n<h2>Accepted Events<\/h2>\n<p>This module handles the following notifier callbacks:<\/p>\n<ul><li><code>observe_media_upload_preprocess<\/code>: Check the uploaded file with clamav using <code>z_acl:user<\/code>.<\/li><li><code>observe_tick_1h<\/code>: Periodic ping of clamav using the configured socket or TCP endpoint.<\/li><\/ul>","slug":"mod_clamav","doc_module_config":[{"default":"false","description":"Reject MS Office files with external links. Set by the Zotonic config clamav_reject_msoffice_external_links (defaults to true), and if not set, can also be enabled by this config.","has_default":true,"key":"clamav_reject_msoffice_external_links","module":"mod_clamav","type":"boolean"}],"is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"78d66b23cb056107cca216250226320688166324cb6f7987fa87442ef40424f9","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":320,"is_a":["meta","category"],"name":"module","title":"Modules","uri":"https:\/\/test.zotonic.com\/id\/320"},"doc_source_path":"apps\/zotonic_mod_clamav\/src\/mod_clamav.erl","publication_start":"2023-01-30T19:23:55Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_mod_clamav\/src\/mod_clamav.erl","pivot_location_lng":null,"doc_source_kind":"module","name":"doc_module_mod_clamav","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2020-05-30T05:47:23Z","uri":null,"doc_status":"current","is_dependent":false,"erlang_app":"zotonic_mod_clamav","publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"c34f80c7ab6700e5d77ac5730deaae0e4710e159\n","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"modified":"2026-10-19T13:18:14Z","title_slug":"mod_clamav"},"uri":"https:\/\/zotonic.com\/id\/1477","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1477"}},"status":"ok"}