kylefarris / clamscan

A robust ClamAV virus scanning library supporting scanning files, directories, and streams with local sockets, local/remote TCP, and local clamscan/clamdscan binaries (with failover).
MIT License
230 stars 68 forks source link

No response from Docker host from my local machine #127

Closed mihui closed 1 month ago

mihui commented 1 month ago

I used the ClamAV Dockerfile and deployed to my Kubernetes Cluster, it is working perfectly with this library.

However, when I am using the podman with my local nodejs app connected, it returns nothing:

const options = {
  debugMode: true,
  removeInfected: true,
  clamdscan: {
    host: '127.0.0.1',
    port: 3310,
    timeout: 999999,
    localFallback: false
  },
  preference: 'clamdscan',
};
const clamScan = await new NodeClam().init(options);
clamScan.scanFiles(['/path/to/virus.com'], (err, goods, bads, viruses) => {
  console.log(err, goods, bads, viruses);
  // It returns
  // null [] [] {}
});

Logs in console:

node-clam: Scanning a list of 1 passed files. [
  '/path/to/virus.com'
]
node-clam: Provided stream is readable.
node-clam: Attempting to establish socket/TCP connection for "scanStream"
node-clam: using remote server: 127.0.0.1:3310
node-clam: Received final data from stream.
node-clam: The input stream has dried up.
node-clam: ClamAV is done scanning.
node-clam: Raw Response:   
node-clam: Error Response:  
node-clam: File may be INFECTED!
node-clam: Scan Complete!
node-clam: Num Bad Files:  0
node-clam: Num Good Files:  0
node-clam: Num Viruses:  0
null [] [] {}
node-clam: Socket/Host connection closed.
node-clam: ClamAV socket has been closed! false

Logs in Docker:

Mon Jul 15 06:19:49 2024 -> instream(192.168.127.1@54184): Win.Test.EICAR_HDB-1 FOUND

My environment:

kylefarris commented 1 month ago

Sorry, I just got back from a family vacation. I will take a look at your PR shortly.