51 lines
1.4 KiB
YAML
51 lines
1.4 KiB
YAML
id: s3-access-logging
|
|
info:
|
|
name: S3 Bucket - Access Logging Not Enabled
|
|
author: princechaddha
|
|
severity: medium
|
|
description: |
|
|
This template verifies if the Server Access Logging feature is enabled for Amazon S3 buckets, which is essential for tracking access requests for security and audit purposes.
|
|
reference:
|
|
- https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-encryption.html
|
|
metadata:
|
|
max-request: 2
|
|
tags: cloud,devops,aws,amazon,s3,aws-cloud-config
|
|
|
|
flow: |
|
|
code(1)
|
|
for(let bucketName of iterate(template.buckets)){
|
|
set("bucket", bucketName)
|
|
code(2)
|
|
}
|
|
|
|
self-contained: true
|
|
code:
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
aws s3api list-buckets --query 'Buckets[*].Name'
|
|
|
|
extractors:
|
|
- type: json # type of the extractor
|
|
internal: true
|
|
name: buckets
|
|
json:
|
|
- '.[]'
|
|
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
aws s3api get-bucket-logging --bucket $bucket --query 'LoggingEnabled'
|
|
|
|
matchers:
|
|
- type: word
|
|
words:
|
|
- "null"
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- '"The S3 bucket " + bucket +" does not have access logging enabled."'
|
|
# digest: 4a0a00473045022100fd29baed40f4c511911881ff79e5672f4533dfa6b19e717d05a961de2df470d502202eb21cdb29ae73b3bfbeabf3cb447bdfc777887e9e6a85b5cfe7edb82bba6e81:922c64590222798bb761d5b6d8e72950 |