The Dashboard is a great resource to monitor your environment while you are using the console. For all the times you are not in front of the console, it is critically important you are made aware of any system notifications such as problem file scan results. Scan Results which could identify infected or unscannable files is the most critical, but other system messages may be important enough for you to follow as well. The other types of information we notify on is: public / private status of buckets, newly discovered buckets, protection turned on / off for buckets, availability of system updates, trial expiration and low prepaid data counts. With this in mind, a Notifications SNS Topic is provided where Antivirus for Amazon S3 publishes these useful messages. You can simply subscribe to the Topic with the protocol (HTTP, HTTPS, Email, Email-JSON, Amazon SQS, AWS Lambda, Platform Application Endpoint, SMS) of your choice.
All notification messages we generate will have a Notification Type attribute as well as possible secondary attributes. These attributes along with their values can be leveraged for filtering the messages down. Along with the notification type attribute, there are other message attributes such as scanResult, bucket and account. AWS SNS subscription filtering works in an and fashion with additional attributes. Or functionality is supported within attribute values, but as soon as you have more than one attribute those behave as and. This is critical to be aware of as you may add combinations that will never occur and therefore never receive the messages you are expecting.
We have made our wizard so you cannot make these unusable combinations. The filtering that is allowed:
notificationType - on its own this is the highest level (generic) filter
You can get all scan results but just setting this attribute to scanResult, but you may truly not want all scan results, just infected
scanResult - allows you to filter by the result itself
You can filter by one or more values - [Clean, Infected, Unscannable, Error, InfectedAllowed]
bucket - filter by a particular bucket name
Useful if you want different subscriptions/notifications for different buckets to have different outcomes or go to different teams
account - filter by account number
For multi-account environments this allows you to filter at the account level
Similar to bucket, you could have different processes or teams responsible at the account level and so need separate subscriptions to notify those particular teams
Message Types
All possible message information:
Key Name
Description
notificationType
You can get all scan results but just setting this attribute to scanResult, but you may truly not want all scan results, just infected
Possible values:
scanResult
largeFileScan
bucketsDiscovered
bucketProtection
bucketCrawling
bucketsPublicAccess
bucketAutoProtectionFailed
updatesAvailable
lowPrepaidData
trialExpiring
scanResult
Secondary attribute to allow filtering by the scan result itself
Possible values:
Infected
Error
Unscannable
Clean
InfectedAllowed
bucket
Secondary attribute to provide filtering by bucket name. Useful if you want different subscriptions/notifications for different buckets to have different outcomes or go to different teams. You can provide more than 1 bucket name if desired in a comma separate list.
Possible values: your_bucket_name(s)
accountID
For multi-account environments this allows you to filter at the account level. Similar to bucket, you could have different processes or teams responsible at the account level and so need separate subscriptions to notify those particular teams. Can be used with scanResult, bucketsDiscovered, bucketProtection, bucketCrawling, bucketPublicAccess
notificationType[any but updatesAvailable|lowPrepaidData|trialExpiring] + account['< account-number(s) >'],
Example
You may want your Support/IR team to be informed of infected files only so you setup a subscription that filters down to classsificatonResult = Matching and gets sent to their emails or distribution list.
While classsificaton results of error and unclassifiable may get filtered down and sent to your infrastructure team since both of those results typically relate to access issues (either KMS related or cross account permissions).
You may want yet another subscription that either captures all classificatonResult messages or just the clean ones so you capture your own audit log of those files. So the endpoint could be an email not responded to or an application that gathers all this data.
Here is a sample message so you can see the format that gets sent. More samples for the other notification types below.
Follow the steps below to set up your Topic Subscription utilizing an AWS provided protocol like email.
Create Subscription - Email Example
Subscribing to the real-time notifications sent out via our Notifications SNS Topic has been simplified by the wizard provided. You can still manually set this up if desired, read below these instructions. Creating through the form still requires you to confirm the subscription.
Click the Add Subscription button
The Add Proactive Notifications Subscription popup will appear
Specify the Notification Type of choice - for our example we will choose ScanResu
Choose Email as the protocol and enter your email address
Specify Scan Results values to limit emails sent
Click the Add Subscription button
You will now see a new entry in the table list showing as Pending under status
Check your email so you can confirm the subscription
Open the email and click the Confirm subscription link
This action will open a browser window showing subscription confirmation
Refresh the page list by clicking the little Refresh button and you will see your new subscription confirmed
You are all set now! Feel free to create more as needed for the different notifications needed.
Warning
AWS does not allow the same email address to be used for multiple subscriptions to the same topic. So you can leverage multiple addresses or you can use the "+" option most modern email providers (Gmail, O365, Exchange) support.
For example, instead of using support@cloudstoragesec.com as I did in the example steps I could do the following:
support+scanresult@cloudstoragesec.com for all scan results
support+updates@cloudstoragesec.com for system upgrade updates
support+config@cloudstoragesec.com for notifications regarding new buckets or public buckets found
etc.
If you'd like to perform these steps manually or see what is going on behind the scenes on the AWS side, expand the section below and read on. If the GUI was enough for you, then skip it.
Manual Setup - Email
Login to the AWS console and navigate to the region where the console is deployed
If you are unsure of which region the console is deployed in, you can view the Console Settings page to find it.
Navigate to the Simple Notification Service (SNS) service
You can search for the service or find it under Application Integration
You'll land at the SNS Dashboard. You may have different numbers of existing Topics and Subscriptions
Click on Topics as indicated above and then click on the Notifications Topic
The Topic will be named CloudStorageSecNotifications-<appID>. You can find your appID in the Console Settings as the value after the - of the Service Name.Note: I have more than one deployment in my account so I see more than one standard topic and more than one notifications topic.
You will land on the details page for the Topic
Click the Create Subscription button to be taken to the Create Subscription page
Pick a Protocol of your choice
We'll use Email for this example
Pick a Protocol of your choice
We'll use Email for this example
Note:You will have to confirm your subscription as AWS indicates. Go to the email address you specified and click the link within it after you finish creating the subscription.
Setup a Filter Policy (optional)
You can be done at this point, but without a filter policy you will get notified of every scan result. Look back above for scenarios where filtering makes sense
You can copy and paste that JSON directly into the filter and it will work. Remember to pick which scan results you are filtering on and remove the others from the list.
Copy the JSON and paste it into the filter policy JSON editor as seen below and edit as you see fit
You can read more about SNS Topic Subscription attribute matching in the AWS Documentation on the subject.
Click the Create Subscription button and you are done!
Technically, you will now need to go confirm your subscription.
Manual Setup - SQS
This is how you subscribe an SQS queue to an SNS topic from a linked account (SQS-LinkedAccount) -> (SNS-Primary)
The way to manage the SQS-SNS, is by subscribing to the SQS from SNS, but not the other way around for some unknown reason, is the only way it works with AWS.
Add:
"sqs:GetQueueAttributes", "sqs:SetQueueAttributes" permissions to the CloudStorageSecConsolePolicy in the Primary account
Create an SQS queue in the Linked account with the following SQS Access policy:
Go to the SQSqueue in the Linked account and hit Send and Receive Messages you will see one Message available -> hit Poll for messages, and you will see:
Enter the message, and copy the SubscribeURL value
Go to the SNS Topic in the Primary account, choose the subscription, hit Confirm Subscription and paste the SubscribeURL value.
Sample Email Protocol Messages
Once you have confirmed your subscription as objects get scanned you will see in your Inbox as follows.
And here are the details of an infected email message received.
EventBridge Notifications
To send notifications to EventBridge, just go to Configuration > Console Settings > AWS EventBridge Proactive Notifications. Enable the toggle, specify an Event Bus (or leave the default) and click Save.
Send ScanResults notifications to CloudWatch logs:
Setup Event Bus
Go to AWS EventBridge and Create a Rule for the Event Bus
Create Rule:
Step 1: Define rule detail
Step 2. Build Event Pattern
Leave the first options as they are and scroll down to the Event Pattern:
Just review that everything is setup as expected, and Submit the rule.
If you have already setup a Scan Result notification, you are good to go, otherwise setup a subscription for it as explained at the beggining of this page.
Scan a file, and check the Event Bridge log setup in CloudWatch:
Slack Integration Setup
It is a simple process (that may sound more complicated than it is) that took under 10 minutes to setup. Simply follow the process laid out in the AWS blogpost talking about how to leverage webhooks seen here: AWS SNS + Slack / Teams / Chime setup
{"Type":"Notification","MessageId":"32373388-32b3-5303-a28e-6b3394954bc4","TopicArn":"arn:aws:sns:us-east-1:<account-number>:CloudStorageSecNotificationsTopic-y6uajej","Subject":"Discovered 1 new Buckets in Account 'Primary'","Message":"The following bucket(s) were discovered and are likely unprotected: css-webinar-new-bucket","Timestamp":"2021-03-05T03:22:14.713Z","SignatureVersion":"1","Signature":"UWQDpcdt82PEQw5B95rCh74gau0Nie8PITkDowLveGflTn7/LshJQ/854jL3gNKY9gpHVWh1deSWxHduI773gQdi4AbRMkJ68tum6PDg7/eYjcCS85RiJ4EeK7HH2xEsEdjTBFsXIs9W5rnXcnOB8wweYZ0IdaKrG4npYng0Qhnr6APFwq5uM4RoSOrwBhhS9iF6gHK++Ir8UNotq52K3RRIHBndYMXQIJL9t0vtcHpf3aAYgcjg+/+3PcjOH/fY974i1TD0h/EabmmKgxAnsggQ4rhGEintKrm/6vV1zFfGM+ehlRwRA5WG5KssyBYY2RxMLHbWCpfeakefmU0gjA==","SigningCertURL":"https://sns.us-east-1.amazonaws.com/SimpleNotificationService-010a507c1833636cd94bdb98bd93083a.pem","UnsubscribeURL":"https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:<account-number>:CloudStorageSecNotificationsTopic-y6uajej:1c22fb20-0d29-42a9-b7dd-1964d77dd99d","MessageAttributes": {"accountId": {"Type":"String","Value":"<account-number>"},"notificationType": {"Type":"String","Value":"bucketsDiscovered"} }}
Public Bucket Found
{"Type":"Notification","MessageId":"861b8ed9-116c-5eef-b906-d662b742f907","TopicArn":"arn:aws:sns:us-east-1:<account-number>:CloudStorageSecNotificationsTopic-y6uajej","Subject":"Discovered PUBLIC bucket 'css-demo-eu-north-1' in account 'Primary'","Message":"The console has discovered bucket 'css-demo-eu-north-1' with public access. ","Timestamp":"2021-03-05T03:22:22.053Z","SignatureVersion":"1","Signature":"b1pYOKS3FJKl3DSelsVoL6ORzcDoPUfuMu72MIrK05sbGZB6eP5xkeZc3QScLSkAMjAzUum5bQAYtq30CbOxgrl9uClvKhvrOwst9Ia0fJ0sCXE4gj59Etnx3j7jrx3x1mR87UhiOjvqNTDJvcJyMKcALCpyf4JUPs7GNzmA5TjMh2xRSsntPuATdMlSlgIi5ApBr4tZUZBAUfxfSI9eGPt9oi44ix0rB8ghlbMNo1ZA5L9ynuC4fyMbPjritTNF7o8hQzQyC4397GC5kBuAn4kdiGMTRLy+UIO/SBGr8iKsb6+3PiUN1g6qyooWilIeAKQ8eJMjo8OVlvLU0+LzVg==","SigningCertURL":"https://sns.us-east-1.amazonaws.com/SimpleNotificationService-010a507c1833636cd94bdb98bd93083a.pem","UnsubscribeURL":"https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:<account-number>:CloudStorageSecNotificationsTopic-y6uajej:1c22fb20-0d29-42a9-b7dd-1964d77dd99d","MessageAttributes": {"accountId": {"Type":"String","Value":"<account-number>"},"notificationType": {"Type":"String","Value":"bucketsPublicAccess"} }}
Bucket Protection Turned Off
{"Type":"Notification","MessageId":"2c547302-6e33-563d-b986-2aa07c26762a","TopicArn":"arn:aws:sns:eu-west-1:<account-number>:CloudStorageSecNotificationsTopic-pxlhbmh","Subject":"Protection turned OFF for 1 buckets in account 'Primary'","Message":"Protection has been turned OFF for the following buckets: css-apsoutheast1-01","Timestamp":"2021-08-26T22:04:05.844Z","SignatureVersion":"1","Signature":"eF0dA/AGVgMp+S85UugidY+9FZ0UryqCGluWRHTtLEHXWM2L+o8AXO+2ipV5u0Jykd9fKEs0SAapDoNAM08X01aakpATR/Bg+1xglY1YGiB4xhhtD64gAGikfYxPDk3BbPS5qamfssXyu8YqJHRpn3xjc+VoYaJajOB1UAm3r0wkcjmapVzEVdvQF8fMx/hfA4sne3IJC5Szm/6g5KTQZ7RYHgrv3O1wB4GPAfNHM061Z5RbdSnKvjuUM8umEfcwOVa40fHIVz68Y1f8lNdPxDWUuY7fQwed8sx8DdRj3iqi1tSbLwYG72JDAiUPDTwEQDPldrQGac17M7aFlms0qA==","SigningCertURL":"https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-010a507c1833636cd94bdb98bd93083a.pem","UnsubscribeURL":"https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-1:<account-number>:CloudStorageSecNotificationsTopic-pxlhbmh:32f7008b-bf69-48c0-84fd-872b708f0037","MessageAttributes": {"accountId": {"Type":"String","Value":"<account-number>"},"notificationType": {"Type":"String","Value":"bucketProtection"} }}
Product Upgrade Available
{"Type":"Notification","MessageId":"7b11beaf-0ca6-5c7c-b7d1-e73fbad71b86","TopicArn":"arn:aws:sns:eu-west-1:<account-number>:CloudStorageSecNotificationsTopic-pxlhbmh","Subject":"Antivirus for Amazon S3 - Update(s) are available","Message":"Update(s) are available for the Antivirus of Amazon S3 product. Visit the console to apply them from the updates menu in the upper right of the page.","Timestamp":"2021-08-13T18:04:33.826Z","SignatureVersion":"1","Signature":"urNgfMcXt76qCsFrSMMhzeXQ3rEA6I3FYWBw+kOeDLgOdGW1vFcFFgii9XIytsdgI71fnCqkOdPe+sBcx1CpnDmdpG5F8oS6S5+bSVgnwp4f3srpghdR34gSMl8xeWZjqWCjcQd4zlcv7HcT4Jg1l1xDB3xD5KPUBhkEzwuvcQIVtpbXXhOJPbVjbUAMUqaI/lkq0x55Mh2D5ALN+1s9loQOC5R1/z/WFE043S037sQjea72rIs1zRouUUo1u+n4Jqo+GHARX51fJcDArcsEAA5INnxxVB5H6xoMAsYYv2LinpLIYRN8Vk/xlL7lfZXH2bYMsX/dJhlZ8crO1axZDA==","SigningCertURL":"https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-010a507c1833636cd94bdb98bd93083a.pem","UnsubscribeURL":"https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-1:<account-number>:CloudStorageSecNotificationsTopic-pxlhbmh:32f7008b-bf69-48c0-84fd-872b708f0037","MessageAttributes": {"notificationType": {"Type":"String","Value":"updatesAvailable"} }}
Proactive Notifications
The Dashboard is a great resource to monitor your environment while you are using the console. For all the times you are not in front of the console, it is critically important you are made aware of any system notifications such as matching classification results. Classification Results which could identify classified data is the most critical, but other system messages may be important enough for you to follow as well. The other types of information we notify on is: public / private status of buckets, newly discovered buckets, protection turned on / off for buckets, availability of system updates, trial expiration and low prepaid data counts. With this in mind, a Notifications SNS Topic is provided where Classification for Amazon S3 publishes these useful messages. You can simply subscribe to the Topic with the protocol (HTTP, HTTPS, Email, Email-JSON, Amazon SQS, AWS Lambda, Platform Application Endpoint, SMS) of your choice.
All notification messages we generate will have a Notification Type attribute as well as possible secondary attributes. These attributes along with their values can be leveraged for filtering the messages down. Along with the notification type attribute, there are other message attributes such as classificationResult, bucket and account. AWS SNS subscription filtering works in an and fashion with additional attributes. Or functionality is supported within attribute values, but as soon as you have more than one attribute those behave as and. This is critical to be aware of as you may add combinations that will never occur and therefore never receive the messages you are expecting.
We have made our wizard so you cannot make these unusable combinations. The filtering that is allowed:
NotificationType - on its own this is the highest level (generic) filter
You can get all classsification results by just setting this attribute to ClassificationResult, but you may truly not want all classification results, just matching
Possible values - [ClassificationResult, BucketsDiscovered, BucketsPublicAccess, LowPrepaidData, TrialExpiring, UpdatesAvailable]
ClassificationResult - allows you to filter by the result itself
You can filter by one or more values - [Matching, NonMatching, Unclassifiable, Error]
Buckets - filter by a particular bucket name
Useful if you want different subscriptions/notifications for different buckets to have different outcomes or go to different teams
Accounts - filter by account number
For multi-account environments this allows you to filter at the account level
Similar to bucket, you could have different processes or teams responsible at the account level and so need separate subscriptions to notify those particular teams
Message Types
All possible message information:
Key Name
Description
NotificationType
You can get all classification results but just setting this attribute to ClassificationResult, but you may truly not want all classification results, just matching
Possible values:
BucketsDiscovered
BucketProtection
BucketsPublicAccess
BucketAutoProtectionFailed
LowPrepaidData
TrialExpiring
UpdatesAvailable
ClassificationResult
Secondary attribute to allow filtering by the scan result itself
Possible values:
Matching
NonMatching
Unclassifiable
Error
Buckets
Secondary attribute to provide filtering by bucket name. Useful if you want different subscriptions/notifications for different buckets to have different outcomes or go to different teams. You can provide more than 1 bucket name if desired in a comma separate list.
Possible values: your_bucket_name(s)
Accounts
For multi-account environments this allows you to filter at the account level. Similar to bucket, you could have different processes or teams responsible at the account level and so need separate subscriptions to notify those particular teams. Can be used with ClassificationResults, BucketsDiscovered, BucketProtection, BucketCrawling, BucketPublicAccess
notificationType[any but updatesAvailable|lowPrepaidData|trialExpiring] + account['< account-number(s) >'],
Example
You may want your Support/IR team to be informed of infected files only so you setup a subscription that filters down to classsificatonResult = Matching and gets sent to their emails or distribution list.
While scan results of error and unscannable may get filtered down and sent to your infrastructure team since both of those results typically relate to access issues (either KMS related or cross account permissions).
You may want yet another subscription that either captures all scanResult messages or just the clean ones so you capture your own audit log of those files. So the endpoint could be an email not responded to or an application that gathers all this data.
Here is a sample message so you can see the format that gets sent. More samples for the other notification types below.
Follow the steps below to set up your Topic Subscription utilizing an AWS provided protocol like email.
Create Subscription - Email Example
Click the Add Subscription button
The Add Proactive Notifications Subscription popup will appear
Specify the Notification Type of choice - for our example we will choose ClassificationResult
Choose Email as the protocol and enter your email address
Click the Add Subscription button
You will now see a new entry in the table list showing as Pending under status
Check your email so you can confirm the subscription
Open the email and click the Confirm subscription link
This action will open a browser window showing subscription confirmation
Refresh the page list by clicking the little Refresh button and you will see your new subscription confirmed
You are all set now! Feel free to create more as needed for the different notifications needed.
Warning
AWS does not allow the same email address to be used for multiple subscriptions to the same topic. So you can leverage multiple addresses or you can use the "+" option most modern email providers (Gmail, O365, Exchange) support.
For example, instead of using support@cloudstoragesec.com as I did in the example steps I could do the following:
support+scanresult@cloudstoragesec.com for all scan results
support+updates@cloudstoragesec.com for system upgrade updates
support+config@cloudstoragesec.com for notifications regarding new buckets or public buckets found
etc.
If you'd like to perform these steps manually or see what is going on behind the scenes on the AWS side, expand the section below and read on. If the GUI was enough for you, then skip it.
Manual Setup - Email
Login to the AWS console and navigate to the region where the console is deployed
If you are unsure of which region the console is deployed in, you can view the Console Settings page to find it.
Navigate to the Simple Notification Service (SNS) service
You can search for the service or find it under Application Integration
Click on Topics as indicated above and then click on the Notifications Topic
The Topic will be named CloudStorageSecNotifications-<appID>. You can find your appID in the Console Settings as the value after the - of the Service Name.Note: I have more than one deployment in my account so I see more than one standard topic and more than one notifications topic.
Click the Create Subscription button to be taken to the Create Subscription page
Pick a Protocol of your choice
We'll use Email for this example
Pick a Protocol of your choice
We'll use Email for this example
Setup a Filter Policy (optional)
You can be done at this point, but without a filter policy you will get notified of every scan result. Look back above for scenarios where filtering makes sense
8. Click the Create Subscription button and you are done!
Technically, you will now need to go confirm your subscription.
You can copy and paste that JSON directly into the filter and it will work. Remember to pick which scan results you are filtering on and remove the others from the list.
Copy the JSON and paste it into the filter policy JSON editor as seen below and edit as you see fit
Manage Subscription
Sample Email Protocol Messages
Once you have confirmed your subscription as objects get scanned you will see in your Inbox as follows:
Slack Integration Setup
It is a simple process (that may sound more complicated than it is) that took under 10 minutes to setup. Simply follow the process laid out in the AWS blogpost talking about how to leverage webhooks seen here: AWS SNS + Slack / Teams / Chime setup
Managing an existing subscription is easy. Simply click the action button () to either Edit or Delete the subscription. Editing will allow you to make changes as are permitted to the subscription. Deleting will remove the subscription.
Specify Classification Results values to limit emails sent
Note
Managing an existing subscription is easy. Simply click the action button () to either Edit or Delete the subscription. Editing will allow you to make changes as are permitted to the subscription. Deleting will remove the subscription.
And here are the details of an email message notification about discovering content in an object that is Matching one searched for by the chosen Classification rules.