0

I want to use ClamAV as part of my file upload process. The snippet below is what I'm using to instantiate nodeClam:

const nodeClam = require('clamscan');
...
const clamScan = new nodeClam().init({  
    debug_mode: true,
    preference: 'clamscan',
    clamdscan: {                
        path: '/usr/bin/clamscan',
        local_fallback: true,
        config_file: '/etc/clamav/clamd.conf',
        scan_archives: true,
        active: true,
        port: 3310
    },
});

I'm getting this msg when I run the code above:

/app/node_modules/clamscan/index.js:241
                            const err = new NodeClamError(
                                        ^

NodeClamError: No valid & active virus scanning binaries are active and available and no host/socket option provided!
    at /app/node_modules/clamscan/index.js:241:41 {
  data: {},
  date: 2023-04-14T18:35:34.764Z
}

I know clamscan is installed properly:

$ clamscan /tmp/eicarcom2.zip
/tmp/eicarcom2.zip: Win.Test.EICAR_HDB-1 FOUND

----------- SCAN SUMMARY -----------
Known viruses: 8661879
Engine version: 0.103.8
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 14.861 sec (0 m 14 s)
Start Date: 2023:04:14 15:08:37
End Date:   2023:04:14 15:08:52

Is there something missing in how I'm instantiating nodeClam? TIA...

goterpsgo
  • 307
  • 2
  • 18

1 Answers1

1

Looks like it was just missing a socket declaration in the clamdscan section: socket: '/var/run/clamav/clamd.ctl'. Of course YMMV.

goterpsgo
  • 307
  • 2
  • 18