1

I can't get started with dockerized clamav app

I know it is not a bug, but overviewed docs, googled dozen times and still get the same output.

I built a nodejs app with a muter-based upload. There is a function that takes uploded file path and gets NodeClam() instance to work:

import NodeClam from 'clamscan'

// clamscan module configs
const ClamScan = new NodeClam().init({
    clamdscan: {
        socket: '/var/run/clamav/clamd.sock',
        host: '127.0.0.1',
        port: 3310,
    }
});

// Scan file using clamscan module
export function scanFile(filePath) {
  return ClamScan.then(async clamscan => {
    const { is_infected, viruses } = await clamscan.scan_file(filePath);


    if (is_infected) {
      console.log(`The file is INFECTED with ${viruses}`);
      throw new Error('ERR_FILE_SCAN_INFECTED');
    } else {

      return 'CLEAN';
    }
  }).catch(err => {
    console.log(err)
    throw new Error(err);
  });
}

And than I get this output in node console (printing an error):

[server] Error: connect ENOENT /var/run/clamav/clamd.sock
[server]     at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1142:16) {
[server]   errno: -4058,
[server]   code: 'ENOENT',
[server]   syscall: 'connect',
[server]   address: '/var/run/clamav/clamd.sock'
[server] }
[server] (node:24904) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
[server] (Use `node --trace-warnings ...` to show where the warning was created)

I checked for directory in docker (via bash) and a file directory seems to be fine:

/run/clamav $ ls -la
total 20
drwxr-x---    1 clamav   clamav        4096 Apr  3 19:16 .
drwxr-xr-x    1 root     root          4096 Feb 24 16:02 ..
-rw-rw-r--    1 clamav   clamav           2 Apr  3 19:16 clamd.pid
srw-rw-rw-    1 clamav   clamav           0 Apr  3 19:16 clamd.sock
-rw-rw----    1 clamav   clamav           3 Apr  3 19:16 freshclam.pid
/run/clamav $ pwd
/var/run/clamav

Host:

  • OS: windows/WSL
  • Version 10

Image:

  • Tag: mkodockx/docker-clamav:alpine
  • Configuration:
  clamAV:
    image:  mkodockx/docker-clamav:alpine
    restart: always
    ports:
      - 3310:3310
    volumes:
      - ./data/clamav:/var/lib/clamav

What am I missing to do?

  • This example might be helpful: https://github.com/malykhin/s3-antivirus You can find dockerized clamav. Also, it was build to use with s3 and SQS notifications. – Denis Malykhin Oct 14 '21 at 00:04

1 Answers1

0

remove the socket path. See this issue: https://github.com/mko-x/docker-clamav/issues/111

Zoe
  • 27,060
  • 21
  • 118
  • 148
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 14 '21 at 01:36
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/30072815) – Tapan Hegde Oct 14 '21 at 05:17