in assets/lambda/code/download_defs/lambda.py [0:0]
def download_s3_defs(download_path, defs_bucket):
"""download CVD and conf files from definitions bucket (if they exist)
to compare against ClamAV database. Respect their hosting costs!"""
try:
# Downloading ClamAV definitions and exceeds Lambda's tmp directory max size
# https://github.com/awslabs/cdk-serverless-clamscan/issues/118
# file_regex = [r"\w+.c[vl]d", r"freshclam.conf"]
file_regex = [r"freshclam.conf"]
file_pattern = r"||".join(file_regex)
for file in defs_bucket.objects.all():
filename = file.key
if re.match(file_pattern, filename):
defs_bucket.download_file(
filename, f"{download_path}/{filename}"
)
except botocore.exceptions.ClientError:
pass