NERUDO
Sign in
kcirtapfromspace/clamav-restPublicForked from ajilach/clamav-restReplayed from github.com/kcirtapfromspace/clamav-rest
Loading community…

Files

Trunk
Browse repository

22 entries

README.md

318bffe

Table of Contents

Introduction

This is two in one docker image so it runs open source virus scanner ClamAV (https://www.clamav.net/), automatic virus definition updates as background process and REST API interface to interact with ClamAV process.

Prerequisites

This container doesn't do much on it's own unless you use an additional service or communicator to talk to it!

Installation

Automated builds of the image are available on Registry and is the recommended method of installation.

bash
docker pull hub.docker.com/ajilaag/clamav-rest:(imagetag)

The following image tags are available:

  • latest - Most recent release of ClamAV with REST API

Quick Start

Run clamav-rest docker image:

bash
docker run -p 9000:9000 -p 9443:9443 -itd --name clamav-rest ajilaag/clamav-rest

Test that service detects common test virus signature:

HTTP

bash
$ curl -i -F "file=@eicar.com.txt" http://localhost:9000/scanHTTP/1.1 100 Continue​HTTP/1.1 406 Not AcceptableContent-Type: application/json; charset=utf-8Date: Mon, 28 Aug 2017 20:22:34 GMTContent-Length: 56​{ "Status": "FOUND", "Description": "Eicar-Test-Signature" }

HTTPS

bash
$ curl -i -k -F "file=@eicar.com.txt" https://localhost:9443/scanHTTP/1.1 100 Continue​HTTP/1.1 406 Not AcceptableContent-Type: application/json; charset=utf-8Date: Mon, 28 Aug 2017 20:22:34 GMTContent-Length: 56​{ "Status": "FOUND", "Description": "Eicar-Test-Signature" }

Test that service returns 200 for clean file:

HTTP

bash
$ curl -i -F "file=@clamrest.go" http://localhost:9000/scan​HTTP/1.1 100 Continue​HTTP/1.1 200 OKContent-Type: application/json; charset=utf-8Date: Mon, 28 Aug 2017 20:23:16 GMTContent-Length: 33​{ "Status": "OK", "Description": "" }

HTTPS

bash
$ curl -i -k -F "file=@clamrest.go" https://localhost:9443/scan​HTTP/1.1 100 Continue​HTTP/1.1 200 OKContent-Type: application/json; charset=utf-8Date: Mon, 28 Aug 2017 20:23:16 GMTContent-Length: 33​{ "Status": "OK", "Description": "" }

Status Codes

  • 200 - clean file = no KNOWN infections
  • 400 - ClamAV returned general error for file
  • 406 - INFECTED
  • 412 - unable to parse file
  • 501 - unknown request

Configuration

Environment Variables

Below is the complete list of available options that can be used to customize your installation.

ParameterDescription
MAX_SCAN_SIZEAmount of data scanned for each file - Default 100M
MAX_FILE_SIZEDon't scan files larger than this size - Default 25M
MAX_RECURSIONHow many nested archives to scan - Default 16
MAX_FILESNumber of files to scan withn archive - Default 10000
MAX_EMBEDDEDPEMaximum file size for embedded PE - Default 10M
MAX_HTMLNORMALIZEMaximum size of HTML to normalize - Default 10M
MAX_HTMLNOTAGSMaximum size of Normlized HTML File to scan- Default 2M
MAX_SCRIPTNORMALIZEMaximum size of a Script to normalize - Default 5M
MAX_ZIPTYPERCGMaximum size of ZIP to reanalyze type recognition - Default 1M
MAX_PARTITIONSHow many partitions per Raw disk to scan - Default 50
MAX_ICONSPEHow many Icons in PE to scan - Default 100
PCRE_MATCHLIMITMaximum PCRE Match Calls - Default 100000
PCRE_RECMATCHLIMITMaximum Recursive Match Calls to PCRE - Default 2000
SIGNATURE_CHECKSCheck times per day for a new database signature. Must be between 1 and 50. - Default 2

Networking

PortDescription
3310ClamD Listening Port

Maintenance / Monitoring

Shell Access

For debugging and maintenance purposes you may want access the containers shell.

bash
docker exec -it (whatever your container name is e.g. clamav-rest) /bin/sh

Prometheus

Prometheus metrics were implemented, which can be retrieved as follows

HTTP: curl http://localhost:9000/metrics

HTTPS: curl https://localhost:9443/metrics

Developing

Source Code can be found here: https://github.com/ajilach/clamav-rest

Build golang (linux) binary and docker image:

bash
# env GOOS=linux GOARCH=amd64 go builddocker build . -t clamav-go-restdocker run -p 9000:9000 -p 9443:9443 -itd --name clamav-rest clamav-go-rest

References

Work history & code evidence

Code ecosystem

Explore repos →
Observed in repos on this profile

File and dependency evidence from up to six visible repos. Repository associations do not establish personal expertise or preference. Security tags describe tools and policies, without rating security.

Reading repo evidence…

Contribution activity

Filters

Commits, completed tasks and releases, grouped by recorded task or batch. Dates use UTC.

Loading recorded history…