Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added policy to check encryption for cloudtrail #1065

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
13 changes: 13 additions & 0 deletions avd_docs/aws/cloudtrail/AVD-AWS-0187/docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Ensures CloudTrail encryption at rest is enabled for logs

### Impact
<!-- Add Impact here -->

<!-- DO NOT CHANGE -->
{{ remediationActions }}

### Links
- https://docs.aws.amazon.com/awscloudtrail/latest/userguide/encrypting-cloudtrail-log-files-with-aws-kms.html


Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# METADATA
# title: "CloudTrail Encryption"
# description: "Ensures CloudTrail encryption at rest is enabled for logs"
# scope: package
# schemas:
# - input: schema.input
# related_resources:
# - https://docs.aws.amazon.com/awscloudtrail/latest/userguide/encrypting-cloudtrail-log-files-with-aws-kms.html
# custom:
# avd_id: AVD-AWS-0187
# provider: aws
# service: cloudtrail
# severity: HIGH
# short_code: enable-at-rest-encryption
# recommended_action: "Enable CloudTrail log encryption through the CloudTrail console or API"
# input:
# selector:
# - type: cloud
package builtin.aws.cloudtrail.aws0187

deny[res] {
trail := input.aws.cloudtrail.trails[_]
trail.kmskeyid.value == ""
res := result.new("Trail is not encrypted.",trail.kmskeyid)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package builtin.aws.cloudtrail.aws0187

test_detects_when_decrypted {
r := deny with input as {"aws": {"cloudtrail": {"trails": [{"kmskeyid": {"value": ""}}]}}}
count(r) == 1
}

test_when_encrypted {
r := deny with input as {"aws": {"cloudtrail": {"trails": [{"kmskeyid": {"value": "key12"}}]}}}
count(r) == 0
}