51 lines
1.4 KiB
YAML
51 lines
1.4 KiB
YAML
id: s3-mfa-delete-check
|
|
info:
|
|
name: S3 Bucket MFA Delete Configuration Check
|
|
author: princechaddha
|
|
severity: low
|
|
description: |
|
|
This template verifies that Amazon S3 buckets are configured with Multi-Factor Authentication (MFA) Delete feature, ensuring enhanced protection against unauthorized deletion of versioned objects
|
|
reference:
|
|
- https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-versioning.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-versioning --bucket $bucket --query 'MFADelete'
|
|
|
|
matchers:
|
|
- type: word
|
|
words:
|
|
- "null"
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- '"The S3 bucket " + bucket +" is not configured to use MFA Delete feature"'
|
|
# digest: 4a0a0047304502206258e96a2294f4871ad68d7abdd1564bcb2de1c6696b48b399eb483f48b80f6102210083bc2afe82afaa0825a8360e89b22f988e7e989ac57c9f4a1d9f8169a5e6f0bc:922c64590222798bb761d5b6d8e72950 |