This project was forked from dit-clamav-rest and changed to fit my needs.
The initial introduction still stands:
This is a python-based REST interface to ClamD
inspired by https://github.com/solita/clamav-rest
I needed a solution to check files for infections which could easily be deployed to kubernetes.
Other solutions and my reasons for not using them:
- solita was too old (Springboot+JDK from somewhere in 2016) and based on the JVM.
- uktrade has a mandatory basic auth.
Check the docker-compose.yml for a working example with mk0x/docker-clamav:alpine as clamd backend.
A container image is available at dockerhub.
If you want to secure the virus scanning endpoint (POST
on /
) via basic
auth, you'll have to provide both AUTH_USERNAME
and AUTH_PASSWORD
to make
this work.
If only one of them is set, basic auth is still disabled!
Requirements:
- python3
- pipenv
- docker
Run the following to get up and running:
docker-compose up -d
After changing code, run the following command to renew the clamav-rest container:
docker-compose up -d --remove-orphans --build clamav_rest
To run the tests, do the following:
pipenv shell
pipenv install -d
pipenv run pytest
Environment variable | Required | Default | Purpose |
---|---|---|---|
LOGLEVEL | false | INFO | Loglevel |
CLAMD_HOST | false | clamav | Hostname where to reach clamav container |
CLAMD_PORT | false | 3310 | Port where to reach clamav container |
LISTEN_HOST | false | 0.0.0.0 | IP to listen on inside container |
LISTEN_PORT | false | 8080 | Port to listen on inside container |
AUTH_USERNAME | false | Username for optional basic auth | |
AUTH_PASSWORD | false | Password for optional basic auth |