aws-s3-virusscan

Free Antivirus for S3 Buckets

Github星跟踪图

S3 VirusScan

Antivirus for S3 buckets. You can connect as many buckets as you like by using S3 Event Notifications

The S3 VirusScan with additional integrations is available in the AWS Marketplace.

Features

  • Uses ClamAV to scan newly added files on S3 buckets
  • Updates ClamAV database every 3 hours automatically
  • Scales EC2 instance workers to distribute workload
  • Publishes a message to SNS in case of a finding
  • Can optionally delete compromised files automatically
  • Logs to CloudWatch Logs

Commercial Features

  • CloudWatch Integration (Metrics and Dashboard)
  • Security Hub Integration
  • SSM OpsCenter Integration

The S3 VirusScan with additional integrations is available in the AWS Marketplace.

How does it work

A picture is worth a thousand words:

Architecture

  1. S3 VirusScan uses a SQS queue to decouple scan jobs from the ClamAV workers. Each S3 bucket can fire events to that SQS queue in case of new objects. This feature of S3 is called S3 Event Notifications.
  2. The SQS queue is consumed by a fleet of EC2 instances running in an Auto Scaling Group. If the number of outstanding scan jobs reaches a threshold a new ClamAV worker is automatically added. If the queue is mostly empty workers are removed.
  3. The ClamAV workers run a simple ruby script that executes the clamscan command. In the background the virus db is updated every three hours.
  4. If clamscan finds a virus the file is directly deleted (you can configure that) and a SNS notification is published.

Installation

Create the CloudFormation Stack

  1. This templates depends on one of our vpc-*azs.yaml templates. Launch Stack
  2. Launch Stack
  3. Click Next to proceed with the next step of the wizard.
  4. Specify a name and all parameters for the stack.
  5. Click Next to proceed with the next step of the wizard.
  6. Click Next to skip the Options step of the wizard.
  7. Check the I acknowledge that this template might cause AWS CloudFormation to create IAM resources. checkbox.
  8. Click Create to start the creation of the stack.
  9. Wait until the stack reaches the state CREATE_COMPLETE

Configure the buckets

Configure the buckets you want to connect to S3 VirusScan as shown in the next figure:

Configure Event Notifications 1

Configure Event Notifications 2

Make sure you select the -ScanQueue- NOT the -ScanQueueDLQ-!

Configure E-Mail subscription

If you like to receive emails if a virus was found you must subscribe to the SNS topic as shown in the next two figures:

Subscribe Topic: Step 1

Subscribe Topic: Step 2

You will receive a confirmation email.

The S3 VirusScan with additional integrations is available in the AWS Marketplace.

Test

Extensive test

Thanks to Objective-See for providing infected files that we use for testing. Download one of the files upload it to your S3 bucket for testing.
We also have automated tests in place!

Simple test

Create a EICAR Standard Anti-Virus Test File with the following content:

X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

and upload that file to your S3 bucket.

Troubleshooting

  1. Go to CloudWatch Logs in the AWS Management Console
  2. Click on the log group of the s3-virusscan
  3. Click on the blue Search Log Group button
  4. Search for "s3-virusscan["

Known issues / limitations

  • It was reported that the solution does not run on a t2.micro or smaller. Use at least a t2.small instance.
  • An initial scan may also be useful but is not performed at the moment. This could be implemented with a Lambda function that pushes every key to SQS.

主要指标

概览
名称与所有者widdix/aws-s3-virusscan
主编程语言Java
编程语言Java (语言数: 1)
平台
许可证Apache License 2.0
所有者活动
创建于2016-03-23 07:06:23
推送于2023-09-20 08:32:45
最后一次提交2023-09-20 10:32:43
发布数14
最新版本名称v3.1.0 (发布于 )
第一版名称v2.0 (发布于 )
用户参与
星数531
关注者数19
派生数126
提交数177
已启用问题?
问题数74
打开的问题数1
拉请求数18
打开的拉请求数1
关闭的拉请求数5
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?