Sign inSign up

temal/clamav-rest

By temal

Updated over 5 years ago

A minimal ClamAV REST interface built with containers in mind

Image
0

9.4K

temal/clamav-rest repository overview

Container ready ClamAV REST interface

Acknowledgment

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

Intention

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.

Running with docker-compose

Check the docker-compose.yml for a working example with mk0x/docker-clamav:alpine as clamd backend.

A container image is available at dockerhub.

Optional basic auth

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!

Development

Requirements:

  • python3
  • pipenv
  • docker
Starting service via docker

Run the following to get up and running:

docker-compose up -d
Rebuild container after change

After changing code, run the following command to renew the clamav-rest container:

docker-compose up -d --remove-orphans --build clamav_rest
Run tests locally

To run the tests, do the following:

pipenv shell
pipenv install -d
pipenv run pytest

Environment variables

Environment variableRequiredDefaultPurpose
LOGLEVELfalseINFOLoglevel
CLAMD_HOSTfalseclamavHostname where to reach clamav container
CLAMD_PORTfalse3310Port where to reach clamav container
LISTEN_HOSTfalse0.0.0.0IP to listen on inside container
LISTEN_PORTfalse8080Port to listen on inside container
AUTH_USERNAMEfalseUsername for optional basic auth
AUTH_PASSWORDfalsePassword for optional basic auth

Tag summary

Content type

Image

Digest

Size

18.8 MB

Last updated

over 5 years ago

docker pull temal/clamav-rest