bluesentry / bucket-antivirus-function

Serverless antivirus for cloud storage.
Apache License 2.0
536 stars 389 forks source link

Unexpected exit code from freshclam: 127 #217

Open cmatchett1982 opened 1 year ago

cmatchett1982 commented 1 year ago

If someone could help understand that the issue is here.

Attempting to create directory /tmp/clamav_defs. Starting freshclam with defs in /tmp/clamav_defs. Unexpected exit code from freshclam: 127. File does not exist: main.cld File does not exist: main.cvd File does not exist: daily.cld File does not exist: daily.cvd File does not exist: bytecode.cld

cmatchett1982 commented 1 year ago

Does this mean that the definitions are not in the S3 bucket?

cmatchett1982 commented 1 year ago

START RequestId: 6a9ed9db-148d-4e4b-89cf-6f30688a9228 Version: $LATEST Script starting at 2023/06/16 21:47:50 UTC Attempting to create directory /tmp/clamav_defs. Starting freshclam with defs in /tmp/clamav_defs. freshclam output: ./bin/freshclam: error while loading shared libraries: libclamav.so.9: cannot open shared object file: No such file or directory Unexpected exit code from freshclam: 127. File does not exist: main.cld File does not exist: main.cvd File does not exist: daily.cld File does not exist: daily.cvd File does not exist: bytecode.cld File does not exist: bytecode.cvd Script finished at 2023/06/16 21:47:50 UTC END RequestId: 6a9ed9db-148d-4e4b-89cf-6f30688a9228 REPORT RequestId: 6a9ed9db-148d-4e4b-89cf-6f30688a9228 Duration: 557.54 ms Billed Duration: 558 ms Memory Size: 1024 MB Max Memory Used: 79 MB Init Duration: 344.79 ms

JarmBlueOak commented 1 year ago

You may want to check your S3 permissions for the lambda function role and bucket policy as S3 always responds with does not exist if permission is denied.

cmatchett1982 commented 1 year ago

the iam permissions assigned to the lambda execution role is s3:* and there is no bucket policy. do i need to install libtool-ltdl

cmatchett1982 commented 1 year ago

it appears that the code is skipping

'to_download = clamav.update_defs_from_s3( s3_client, AV_DEFINITION_S3_BUCKET, AV_DEFINITION_S3_PREFIX )

for download in to_download.values():
    s3_path = download["s3_path"]
    local_path = download["local_path"]
    print("Downloading definition file %s from s3://%s" % (local_path, s3_path))
    s3.Bucket(AV_DEFINITION_S3_BUCKET).download_file(s3_path, local_path)
    print("Downloading definition file %s complete!" % (local_path))'
cmatchett1982 commented 1 year ago

i added in a count of 'to_download'

Attempting to create directory /tmp/clamav_defs. files to download: {} Number of objects to download: 0 /var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib:./bin Starting freshclam with defs in /tmp/clamav_defs. freshclam output: ./bin/freshclam: error while loading shared libraries: libltdl.so.7: cannot open shared object file: No such file or directory Unexpected exit code from freshclam: 127. File does not exist: main.cld File does not exist: main.cvd File does not exist: daily.cld File does not exist: daily.cvd File does not exist: bytecode.cld File does not exist: bytecode.cvd Script finished at 2023/06/17 15:00:31 UTC