linshare icon indicating copy to clipboard operation
linshare copied to clipboard

An error ocurred during upload with ClamAV 1.0.3

Open Flopil opened this issue 3 years ago • 7 comments

Hi, I have an issue with ClamAV remote scan since he was upgraded from 0.103 to 1.0.3 version. I've tested and the remote scan works perfectly with clamdscan command on the linshare server. But on Linshare, when I upload a file, there is an error : An error ocurred during upload

How can I fix that ? Thanks for help.

When I check the log, we can see that:

` [2023-10-05 16:44:59] [info] Démarrage du gestionnaire de protocole ["http-nio-8080"] [2023-10-05 16:44:59] [info] Le démarrage du serveur a pris [25090] millisecondes [2023-10-05 16:45:35] [info] [INFO]:http-nio-8080-exec-2:20231005.164535:org.linagora.linshare.webservice.userv2.FlowDocumentUploaderRestService:testChunk:GET: .../webservice/rest/user/v2/flow.json:59792320-78c8-4b29-9a96-0f6ce43b642c: chunkNumber:1/1 [2023-10-05 16:45:35] [info] [INFO]:http-nio-8080-exec-2:20231005.164535:org.linagora.linshare.webservice.userv2.FlowDocumentUploaderRestService:testChunk:GET: .../webservice/rest/user/v2/flow.json:59792320-78c8-4b29-9a96-0f6ce43b642c: chunkNumber:1/1 [2023-10-05 16:45:35] [info] [INFO]:http-nio-8080-exec-4:20231005.164535:org.linagora.linshare.webservice.userv2.FlowDocumentUploaderRestService:getTransfertDuration:statistics:upload time:23ms. [2023-10-05 16:45:35] [info] [INFO]:http-nio-8080-exec-4:20231005.164535:org.linagora.linshare.webservice.userv2.FlowDocumentUploaderRestService:getTransfertDuration:statistics:upload time:23ms. [2023-10-05 16:45:35] [info] [INFO]:taskExecutor-1:20231005.164535:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:Begin processing async task : 7c2f2644-1a22-4308-83e4-335ea9ab0703 [2023-10-05 16:45:35] [info] [INFO]:taskExecutor-1:20231005.164535:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:Begin processing async task : 7c2f2644-1a22-4308-83e4-335ea9ab0703 [2023-10-05 16:45:36] [warning] org.xerial's sqlite-jdbc is not loaded. [2023-10-05 16:45:36] [info] Please provide the jar on your classpath to parse sqlite files. [2023-10-05 16:45:36] [info] See tika-parsers/pom.xml for the correct version. [2023-10-05 16:45:36] [info] [ERROR]:taskExecutor-1:20231005.164536:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:java.lang.NullPointerException [2023-10-05 16:45:36] [info] [ERROR]:taskExecutor-1:20231005.164536:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:java.lang.NullPointerException [2023-10-05 16:45:36] [info] [ERROR]:taskExecutor-1:20231005.164536:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:Async task '7c2f2644-1a22-4308-83e4-335ea9ab0703' processed with final status : FAILED [2023-10-05 16:45:36] [info] [ERROR]:taskExecutor-1:20231005.164536:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:Async task '7c2f2644-1a22-4308-83e4-335ea9ab0703' processed with final status : FAILED

`

Flopil avatar Oct 05 '23 14:10 Flopil

Hi Did you tried the upload without enabling the antivirus ? If it's the same result, enable the trace log level in log4j and send us logs.

wboudiche avatar Oct 09 '23 20:10 wboudiche

Hi Did you tried the upload without enabling the antivirus ? If it's the same result, enable the trace log level in log4j and send us logs.

wboudiche avatar Oct 09 '23 20:10 wboudiche

Hi, I just update clamav to 1.0.7 from 0.103 and same issue. @Flopil have you find a way to fix it?

Max59C avatar Dec 06 '24 16:12 Max59C

Linshare 6.0.3 Update of my debian 11 installation tonight with an update of clamav

Install: libclamav11:amd64 (1.0.7+dfsg-1~deb11u2, automatic)
Upgrade: clamav-daemon:amd64 (0.103.10+dfsg-0+deb11u1, 1.0.7+dfsg-1~deb11u2), clamav:amd64 (0.103.10+dfsg-0+deb11u1, 1.0.7+dfsg-1~deb11u2), libavahi-common-data:amd64 (0.8-5+deb11u2, 0.8-5+deb11u3), clamav-base:amd64 (0.103.10+dfsg-0+deb11u1, 1.0.7+dfsg-1~deb11u2), clamav-freshclam:amd64 (0.103.10+dfsg-0+deb11u1, 1.0.7+dfsg-1~deb11u2), libavahi-common3:amd64 (0.8-5+deb11u2, 0.8-5+deb11u3), clamdscan:amd64 (0.103.10+dfsg-0+deb11u1, 1.0.7+dfsg-1~deb11u2), libavahi-client3:amd64 (0.8-5+deb11u2, 0.8-5+deb11u3)
Remove: libclamav9:amd64 (0.103.10+dfsg-0+deb11u1), libtfm1:amd64 (0.13-4)

same issue, linshare can't use clamav since that. I correct an issue with the start of clamav on tcpsocket but it still doesn't work (clamscan work when tested). If I disable the AVScan on linshare, files can be uploaded.

in debug I have this in linshare logs:

[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.core.dao.tika.MimeTypeMagicNumberTikaImpl:getMimeType:Mime type : application/zip
[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.core.dao.tika.MimeTypeMagicNumberTikaImpl:getMimeType:Mime type found : application/zip
[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.core.dao.tika.MimeTypeMagicNumberTikaImpl:getMimeType:Mime type found : application/zip
[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.core.service.impl.MimeTypeServiceImpl:checkFileMimeType:2)check the mimetype:application/zip
[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.core.service.impl.MimeTypeServiceImpl:checkFileMimeType:2)check the mimetype:application/zip
[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.core.service.impl.VirusScannerServiceImpl:checkVirus:antivirus activation:true
[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.core.service.impl.VirusScannerServiceImpl:checkVirus:antivirus activation:true
[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.core.service.impl.DocumentEntryServiceImpl:create:deleting temp file : linshare-chunks-154965b8-1323-4c99-a2f2-0ee0a51607cc12765618212204187168.temp
[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.core.service.impl.DocumentEntryServiceImpl:create:deleting temp file : linshare-chunks-154965b8-1323-4c99-a2f2-0ee0a51607cc12765618212204187168.temp
[ERROR]:taskExecutor-5:20241210.150436:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:java.lang.NullPointerException
[ERROR]:taskExecutor-5:20241210.150436:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:java.lang.NullPointerException
[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:Exception :
java.lang.NullPointerException: null
        at org.linagora.linshare.core.business.service.impl.ClamavVirusScannerBusinessServiceImpl.check(ClamavVirusScannerBusinessServiceImpl.java:94) ~[classes/:6.0.3]
        at org.linagora.linshare.core.business.service.impl.ClamavVirusScannerBusinessServiceImpl.check(ClamavVirusScannerBusinessServiceImpl.java:73) ~[classes/:6.0.3]
        at org.linagora.linshare.core.service.impl.VirusScannerServiceImpl.scanVirus(VirusScannerServiceImpl.java:71) ~[classes/:6.0.3]
        at org.linagora.linshare.core.service.impl.VirusScannerServiceImpl.checkVirus(VirusScannerServiceImpl.java:60) ~[classes/:6.0.3]
        at org.linagora.linshare.core.service.impl.DocumentEntryServiceImpl.create(DocumentEntryServiceImpl.java:189) ~[classes/:6.0.3]
        at org.linagora.linshare.core.facade.webservice.user.impl.DocumentAsyncFacadeImpl.upload(DocumentAsyncFacadeImpl.java:53) ~[classes/:6.0.3]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) ~[spring-tx-5.3.22.jar:5.3.22]
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) ~[spring-tx-5.3.22.jar:5.3.22]
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-5.3.22.jar:5.3.22]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) ~[spring-aop-5.3.22.jar:5.3.22]
        at com.sun.proxy.$Proxy217.upload(Unknown Source) ~[?:?]
        at org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask.runMyTask(DocumentUploadAsyncTask.java:35) ~[classes/:6.0.3]
        at org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask.runMyTask(DocumentUploadAsyncTask.java:23) ~[classes/:6.0.3]
        at org.linagora.linshare.webservice.userv1.task.AsyncTask.run(AsyncTask.java:59) ~[classes/:6.0.3]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
        at java.lang.Thread.run(Thread.java:829) ~[?:?]
[DEBUG]:taskExecutor-5:20241210.150436:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:Exception :
java.lang.NullPointerException: null
        at org.linagora.linshare.core.business.service.impl.ClamavVirusScannerBusinessServiceImpl.check(ClamavVirusScannerBusinessServiceImpl.java:94) ~[classes/:6.0.3]
        at org.linagora.linshare.core.business.service.impl.ClamavVirusScannerBusinessServiceImpl.check(ClamavVirusScannerBusinessServiceImpl.java:73) ~[classes/:6.0.3]
        at org.linagora.linshare.core.service.impl.VirusScannerServiceImpl.scanVirus(VirusScannerServiceImpl.java:71) ~[classes/:6.0.3]
        at org.linagora.linshare.core.service.impl.VirusScannerServiceImpl.checkVirus(VirusScannerServiceImpl.java:60) ~[classes/:6.0.3]
        at org.linagora.linshare.core.service.impl.DocumentEntryServiceImpl.create(DocumentEntryServiceImpl.java:189) ~[classes/:6.0.3]
        at org.linagora.linshare.core.facade.webservice.user.impl.DocumentAsyncFacadeImpl.upload(DocumentAsyncFacadeImpl.java:53) ~[classes/:6.0.3]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) ~[spring-tx-5.3.22.jar:5.3.22]
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) ~[spring-tx-5.3.22.jar:5.3.22]
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-5.3.22.jar:5.3.22]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.22.jar:5.3.22]
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) ~[spring-aop-5.3.22.jar:5.3.22]
        at com.sun.proxy.$Proxy217.upload(Unknown Source) ~[?:?]
        at org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask.runMyTask(DocumentUploadAsyncTask.java:35) ~[classes/:6.0.3]
        at org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask.runMyTask(DocumentUploadAsyncTask.java:23) ~[classes/:6.0.3]
        at org.linagora.linshare.webservice.userv1.task.AsyncTask.run(AsyncTask.java:59) ~[classes/:6.0.3]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
        at java.lang.Thread.run(Thread.java:829) ~[?:?]
[ERROR]:taskExecutor-5:20241210.150436:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:Async task '308ea61c-3059-450b-b38c-f8a26b9ae0dd' processed with final status : FAILED
[ERROR]:taskExecutor-5:20241210.150436:org.linagora.linshare.webservice.userv1.task.DocumentUploadAsyncTask:run:Async task '308ea61c-3059-450b-b38c-f8a26b9ae0dd' processed with final status : FAILED

Any idea how to solve that?

matdemb avatar Dec 10 '24 14:12 matdemb

a downgrade of clamav on the previous version solve the problem. But it's not a good solution...

matdemb avatar Dec 10 '24 14:12 matdemb

The issue is because linshare (through net.taldius.clamav.impl.NetworkScanner library) use the "STREAM" command to clamav but this command was deprecated since long time (https://github.com/Cisco-Talos/clamav/commit/ba2cf4405185b99e644be97b9a873741c77ab818#diff-d6a46a940defaa8cfba03e20ba333673668ca0edac4934db4fd446820b19bc9dR50) and is not used anymore ("COMMAND NOT FOUND" responded by clamav on 1.0.7). When Linshare will be updated to use a more recent library that works with more recent clamav version? Thanks.

matdemb avatar Dec 11 '24 11:12 matdemb

Hi, Thanks for those information, we added the task to our backlog

wboudiche avatar Jan 06 '25 13:01 wboudiche