Skip to main content

Check upload resources for viruses

Project description

Tests

ckanext-clamav

This is a basic example that helps to scan uploaded resources for malwares with clamd library.

Installation

Clamd library uses clamav tool, and you must install it into your environment, to make this extension work.

For example, to install ClamAV on Ubuntu:

  1. Install ClamAV with APT

    apt-get update
    apt-get install clamav clamav-daemon -y
    
  2. Update the ClamAV signature database

    systemctl stop clamav-freshclam
    freshclam
    systemctl start clamav-freshclam
    

To install ckanext-clamav:

  1. Activate your CKAN virtual environment, for example:

    . /usr/lib/ckan/default/bin/activate

  2. Clone the source and install it on the virtualenv

    git clone https://github.com/mutantsan/ckanext-clamav.git
    cd ckanext-clamav
    pip install -e .
    pip install -r requirements.txt
    
  3. Add clamav to the ckan.plugins setting in your CKAN config file (by default the config file is located at /etc/ckan/default/ckan.ini).

  4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:

    sudo service apache2 reload

Config settings

# If your socket file is in different folder, you can specify it
# (optional, default: /var/run/clamav/clamd.ctl).
ckanext.clamav.socket_path = /your/path/to/socket.file

# You can decide to upload unscanned files or not.
# For example, if clamav is disabled, you won't be able to scan a file
# (optional, default: True).
ckanext.clamav.upload_unscanned = False

# ClamAV connection mechanism. There are two options: `tcp` or `unix`.
# If `tcp` selected, you must provide host:port (check next options).
# ( optional, default: unix)
ckanext.clamav.socket_type = unix

# TCP/IP hostname
ckanext.clamav.tcp.host = your.hostname.address

# TCP/IP port
ckanext.clamav.tcp.port = 3310

# ClamAV connection timeout. Either `tcp` or `unix`
# By default, there is no timeout.
# ( optional, default: 60)
ckanext.clamav.timeout = 120

Developer installation

To install ckanext-clamav for development, activate your CKAN virtualenv and do:

git clone https://github.com/mutantsan/ckanext-clamav.git
cd ckanext-clamav
python setup.py develop
pip install -r dev-requirements.txt

Tests

To run the tests, do:

pytest --ckan-ini=test.ini

License

AGPL

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ckanext_clamav-1.0.31.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

ckanext_clamav-1.0.31-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file ckanext_clamav-1.0.31.tar.gz.

File metadata

  • Download URL: ckanext_clamav-1.0.31.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for ckanext_clamav-1.0.31.tar.gz
Algorithm Hash digest
SHA256 89f6f6b64abc90420b565c2942b4c436a313e40935fa8e31e5bac93f3a09db98
MD5 70cdf75a0fb8b0d028b4eb780e442f80
BLAKE2b-256 0d5faab4681811a92397fa8a311104daeb6f78c82cae9b96056279238615c91f

See more details on using hashes here.

File details

Details for the file ckanext_clamav-1.0.31-py3-none-any.whl.

File metadata

File hashes

Hashes for ckanext_clamav-1.0.31-py3-none-any.whl
Algorithm Hash digest
SHA256 14584c64f86eacf84b48c2b492229c9b9817645d27211161285d1f62a4f848b4
MD5 bb2f683c658acdd8244c844ac841b1ca
BLAKE2b-256 67f572db3f5a3288a09cbc2e003f7b7ea5ee863e7c56e36912a7a4049987e550

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page