This rule ensures that all S3 buckets have logging enabled for S3 data events in CloudTrail.
Rule | All S3 buckets should log S3 data events in CloudTrail |
Framework | NIST 800-171 Revision 2 |
Severity | ✔ Medium |
Rule Description
All S3 buckets should have CloudTrail enabled to log S3 data events according to the guidelines specified in the NIST 800-171 Revision 2. This rule ensures that any access or changes made to S3 data within an organization's AWS account are recorded and can be audited for compliance and security purposes.
Troubleshooting Steps
If CloudTrail is not enabled for S3 buckets, follow these troubleshooting steps:
Necessary Codes
There are no specific codes required for this rule. However, enabling CloudTrail for S3 buckets can be achieved using the AWS Command Line Interface (CLI) with the following command:
aws s3api put-bucket-logging --bucket <bucket-name> --bucket-logging-status '{"LoggingEnabled": {"TargetBucket": "<CloudTrail-Bucket-Name>", "TargetPrefix": "<CloudTrail-Log-Prefix>"}}'
Replace
<bucket-name>
with the name of the S3 bucket for which CloudTrail should be enabled. <CloudTrail-Bucket-Name>
should be the name of the bucket where CloudTrail logs will be stored, and <CloudTrail-Log-Prefix>
should be the desired prefix for the CloudTrail log files within the bucket.Step-by-Step Guide for Remediation
Follow these steps to enable CloudTrail logging for an S3 bucket:
Replaceaws s3api put-bucket-logging --bucket <bucket-name> --bucket-logging-status '{"LoggingEnabled": {"TargetBucket": "<CloudTrail-Bucket-Name>", "TargetPrefix": "<CloudTrail-Log-Prefix>"}}'
<bucket-name>
with the name of the S3 bucket for which CloudTrail should be enabled. <CloudTrail-Bucket-Name>
should be the name of the bucket where CloudTrail logs will be stored, and <CloudTrail-Log-Prefix>
should be the desired prefix for the CloudTrail log files within the bucket.