bluesentry / bucket-antivirus-function

Serverless antivirus for cloud storage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libbz2.so.1 issue

ankursharma-news opened this issue · comments

After creating project when running the lamda function I'm getting the following error:

Starting clamscan of /tmp/bucket-file-upload/file_example_JPG_1MB copy.jpg

clamscan output:
./bin/clamscan: error while loading shared libraries: libbz2.so.1: cannot open shared object file: No such file or directory

Unexpected exit code from clamscan: 127

[ERROR] Exception: Unexpected exit code from clamscan: 127.

Traceback (most recent call last):
  File "/var/task/scan.py", line 236, in lambda_handler
    scan_result, scan_signature = clamav.scan_file(file_path)
  File "/var/task/clamav.py", line 210, in scan_file
    raise Exception(msg)

Did anybody face this issue recently ? Please suggest.

I could fix the issues by adding few more dependencies:

Download libraries we need to run in lambda

WORKDIR /tmp
RUN yumdownloader -x *i686 --archlist=x86_64 clamav clamav-lib clamav-update json-c pcre2 libprelude gnutls libtasn1 lib64nettle nettle libtool-ltdl bzip2-libs libxml2 xz-libs libgcrypt libgpg-error
RUN rpm2cpio clamav-0*.rpm | cpio -idmv
RUN rpm2cpio clamav-lib*.rpm | cpio -idmv
RUN rpm2cpio clamav-update*.rpm | cpio -idmv
RUN rpm2cpio json-c*.rpm | cpio -idmv
RUN rpm2cpio pcre*.rpm | cpio -idmv
RUN rpm2cpio gnutls*.rpm | cpio -idmv
RUN rpm2cpio nettle*.rpm | cpio -idmv
RUN rpm2cpio libprelude*.rpm | cpio -idmv
RUN rpm2cpio libtasn1*.rpm | cpio -idmv
RUN rpm2cpio libtool-ltdl*.rpm | cpio -idmv
RUN rpm2cpio bzip2-libs*.rpm | cpio -idmv
RUN rpm2cpio libxml2*.rpm | cpio -idmv
RUN rpm2cpio xz-libs*.rpm | cpio -idmv
RUN rpm2cpio libgcrypt*.rpm | cpio -idmv
RUN rpm2cpio libgpg-error*.rpm | cpio -idmv

Copy over the binaries and libraries

RUN cp /tmp/usr/bin/clamscan /tmp/usr/bin/freshclam /tmp/usr/lib64/* /opt/app/bin/

FYI, if you're getting this error, you're probably running in python 3.8 instead of 3.7 as listed in the docs :)

Any ideas how to update python to 3.9 in this function?