Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

LibClamAV Error: cli_loaddbdir(): No supported database files found in /tmp/clamav_defs #162

Open
yogeshnile opened this issue Apr 9, 2021 · 4 comments

Comments

@yogeshnile
Copy link

Lambda throws the error when using clamav lambda.zip

clamscan output:
LibClamAV Error: cli_loaddbdir(): No supported database files found in /tmp/clamav_defs
ERROR: Can't open file or directory
----------- SCAN SUMMARY -----------
Known viruses: 0
Engine version: 0.103.1
Scanned directories: 0
Scanned files: 0
Infected files: 0
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 0.124 sec (0 m 0 s)
Start Date: 2021:04:09 08:00:31
End Date:   2021:04:09 08:00:32
Unexpected exit code from clamscan: 2.
[ERROR] Exception: Unexpected exit code from clamscan: 2.
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)
@turingbeing
Copy link

@yogeshnile Did you ever resolve this? I am facing the same issue, with the updated Dockerfile, I am using the V2.0.0 Branch if that makes any difference

@danimas
Copy link

danimas commented Mar 9, 2022

This happens because the one that creates and updates the clamav database is the updater. Until that process runs, the scan will fail.

@turingbeing
Copy link

This happens because the one that creates and updates the clamav database is the updater. Until that process runs, the scan will fail.

Not in my case, I actually tracked this down and fixed it in my own version. The code is ignoring custom prefixes, so if I download my definitions to Key: XYZ and run the updated, the definitions end up there.

But when the scanner runs, and tries to grab the definitions, and the XYZ prefix is set in the Environment, this isn't used in the method, it is passed in, but isn't used.

Took me a while to find it, but got there in the end

@miglenp
Copy link

miglenp commented Sep 7, 2022

I edited the common.py that was in lambda.zip to use my s3 bucket as default value

AV_DEFINITION_S3_BUCKET = os.getenv("AV_DEFINITION_S3_BUCKET", "my-s3-bucket")

Added a folder named clamav_defs in my-s3-bucket, uploaded main,daily and bytecode cvd/cld to it and tags those file.

tagged with md5: [checksum of the file].

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants