Install ClamAV on your system first (Ubuntu example for Unix Socket):
Update and install ClamAV
apt-get update
apt-get install clamav clamav-daemon -y
Update ClamAV signature database
systemctl stop clamav-freshclam
freshclam
systemctl start clamav-freshclam
Install the extension:
Activate CKAN virtualenv
. /usr/lib/ckan/default/bin/activate
Clone and install
git clone https://github.com/DataShades/ckanext-clamav.git
cd ckanext-clamav
pip install -e .
pip install -r requirements.txt
Enable the plugin in your CKAN config file:
ckan.plugins = clamav
IMPORTANT: If using custom uploaders (like ckanext-s3filestore), clamav must come BEFORE them in plugin order:
ckan.plugins = clamav s3filestore
Configuration options:
Socket file path (default: /var/run/clamav/clamd.ctl)
ckanext.clamav.socket_path = /your/path/to/socket.file
Allow unscanned files upload (default: True)
Set to False to block uploads if ClamAV is unavailable
ckanext.clamav.upload_unscanned = False
Connection mechanism: unix or tcp (default: unix)
ckanext.clamav.socket_type = unix
For TCP connection, provide host and port:
ckanext.clamav.socket_type = tcp
ckanext.clamav.tcp.host = your.hostname.address
ckanext.clamav.tcp.port = 3310
Connection timeout in seconds (default: 60)
ckanext.clamav.timeout = 120
Restart CKAN:
sudo service apache2 reload
Note: CKAN 2.9 support only in v1.1.0 (requires “pip install setuptools>=44.1.0,<71”). CKAN 2.7-2.8 no longer supported.