archivematica / Issues

Issues repository for the Archivematica project
GNU Affero General Public License v3.0
16 stars 1 forks source link

Problem: virus scanning fails: clamd.conf settings don't match MCPclient #343

Open mjaddis opened 5 years ago

mjaddis commented 5 years ago

Expected behaviour Virus scanning works for big files.

Current behaviour Virus scan failed for a 40MB file.

Steps to reproduce Settings used by Archivematica are: /usr/lib/archivematica/MCPClient/settings/common.py clamav_pass_by_stream = True clamav_client_timeout = 86400 clamav_client_backend = clamdscanner ; Options: clamdscanner or clamscanner clamav_client_max_file_size = 42 ; MB clamav_client_max_scan_size = 42 ; MB

The defaults for clamd are: /etc/clamav/clamd.conf MaxScanSize 100M MaxFileSize 25M StreamMaxLength 25M

Seems to me that for files 25M<filesize<42M then streaming will fail, which is what happened for my 40MB file (WARNING: INSTREAM: Size limit reached). I changed the clamd.conf settings for stream length and file size to be 50MB, restarted clamd, and then my Transfer worked fine.

Your environment (version of Archivematica, OS version, etc) 1.7.2 on 16.04 LTS


For Artefactual use: Please make sure these steps are taken before moving this issue from Review to Verified in Waffle:

Akdr commented 5 years ago

Having the same problem in 1.8.1 on two different enviroments.

archivematicaclamscan_v0.0: INFO      2019-03-22 09:38:28,112  archivematica.mcp.client.clamscan.scan_file:341  Using scanner ClamAV (clamd) (ClamAV 0.100.2 - 25396/Fri Mar 22 08:52:29 2019)
archivematicaclamscan_v0.0: INFO      2019-03-22 09:38:28,113  archivematica.mcp.client.clamscan.pass_by_stream:176  File contents being streamed to Clamdscan.
archivematicaclamscan_v0.0: ERROR     2019-03-22 09:38:28,251  archivematica.mcp.client.clamscan.clamd_exception_handler:151  Virus scanning failed: [Errno 104] Connection reset by peer
Traceback (most recent call last):
  File "/usr/lib/archivematica/MCPClient/clientScripts/archivematica_clamscan.py", line 118, in scan
    result = getattr(self, method_name)(path)
  File "/usr/lib/archivematica/MCPClient/clientScripts/archivematica_clamscan.py", line 177, in pass_by_stream
    return self.client.instream(open(path))
  File "/usr/share/archivematica/virtualenvs/archivematica-mcp-client/local/lib/python2.7/site-packages/clamd/__init__.py", line 190, in instream
    self.clamd_socket.send(size + chunk)
error: [Errno 104] Connection reset by peer
archivematicaclamscan_v0.0: INFO      2019-03-22 09:38:28,251  archivematica.mcp.client.clamscan.scan_file:354  File /var/archivematica/sharedDirectory/currentlyProcessing/####.file scanned!
archivematicaclamscan_v0.0: INFO      2019-03-22 09:38:28,251  archivematica.mcp.client.clamscan.queue_event:237  Recording new event for file 248299d2-451e-4ad6-b3dd-e9f583a88df7 (outcome: Fail)

Solved by doing the same in /etc/clamav/clamd.conf as mjaddis:

MaxScanSize 2000M
MaxFileSize 2000M
StreamMaxLength 2000M

Your environment (version of Archivematica, OS version, etc) 1.8,1 on 18.04 LTS

Best regards, Daniel Westerling ArkivIT