Check compliance for denying HTTP requests in S3 Bucket Policy.
Rule | Ensure S3 Bucket Policy is set to deny HTTP requests |
Framework | cis_v140 |
Severity | ✔ Critical |
Rule: Ensure S3 Bucket Policy is set to deny HTTP requests for cis_v140
Description: This rule is designed to ensure that the S3 bucket policy for the bucket named "cis_v140" does not allow the use of HTTP requests. By only allowing HTTPS requests, the security of the bucket and its sensitive data will be strengthened.
Troubleshooting Steps: If any issues arise with the S3 bucket policy denying HTTP requests for "cis_v140", please follow these troubleshooting steps:
Review the output to identify any potential issues.aws s3api get-bucket-policy --bucket cis_v140
Code: If the bucket policy for "cis_v140" does not already exist, you can use the following AWS CLI command to create and enforce a policy that denies HTTP requests for the bucket:
aws s3api put-bucket-policy --bucket cis_v140 --policy "{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Sid\": \"DenyHTTP\", \"Effect\": \"Deny\", \"Principal\": \"*\", \"Action\": \"s3:GetObject\", \"Resource\": \"arn:aws:s3:::cis_v140/*\", \"Condition\": { \"Bool\": { \"aws:SecureTransport\": \"false\" } } } ] }"
Please note that running this command will create and enforce the bucket policy that denies HTTP requests for "cis_v140".
Remediation Steps: To ensure that the S3 bucket policy for "cis_v140" denies HTTP requests, follow these step-by-step remediation instructions:
{ "Sid": "DenyHTTP", "Effect": "Deny", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::cis_v140/*", "Condition": { "Bool": { "aws:SecureTransport": "false" } } }
By following these remediation steps, you will enforce the bucket policy to deny HTTP requests for the "cis_v140" bucket and verify its effectiveness.