Clamproxy is a lighweight API on top of ClamAV that allows you to scan files for viruses via HTTP requests.
It was designed to be used as a microservice in containerized environments, making it easy to integrate virus scanning into your applications without the need to directly interact with ClamAV.
- Simple HTTP API for scanning files
- It requires the files to be present on the local filesystem. In containerized environments, this can be achieved using shared volumes.
- Returns JSON responses with scan results
You can download linux statically linked binaries or RPM packages from the releases page.
Start clamproxy, it will start the HTTP server after 10-12 seconds to allow ClamAV to initialize.
$ clamproxy apiIt needs clamav databases, so make sure you have them available. You can use freshclam to download them.
Example:
$ freshclamOptionally it can be configured using -d flag to point to the ClamAV database directory.
$ curl -XPOST -d '{"filename":"/path/to/internal/fixtures/eicar.com"}' http://localhost:3311/api/v1/scan | python3 -mjson.tool
{
"FileName": "eicar.com",
"FileType": "CL_TYPE_TEXT_ASCII",
"FileSize": 68,
"FileMD5": "44d88612fea8a8f36de82e1278abb02f",
"Viruses": [
"Win.Test.EICAR_HDB-1",
"Win.Test.EICAR_HSB-1",
"Eicar-Signature"
],
"Magic": "CLAMJSONv0",
"RootFileType": "CL_TYPE_TEXT_ASCII",
"Status": false
}To build the Clamproxy Docker image, use the following command:
bazel build //...This will create a static linked binary including the HTTP API and the ClamAV engine.
Clamproxy is licensed under the GNU General Public License v2.0. See the LICENSE file for details.