id: cloudtrail-logs-not-encrypted info: name: CloudTrail Logs Not Encrypted author: princechaddha severity: medium description: | Ensure Amazon CloudTrail logs are encrypted at rest using AWS Key Management Service (KMS) to secure log data. impact: | Non-encrypted CloudTrail logs pose a risk of unauthorized access, compromising the integrity and confidentiality of log data. remediation: | Enable Server-Side Encryption (SSE) for CloudTrail logs using an AWS KMS key through the CloudTrail console or AWS CLI. reference: - https://docs.aws.amazon.com/awscloudtrail/latest/userguide/encrypting-cloudtrail-log-files-with-aws-kms.html tags: cloud,devops,aws,amazon,cloudtrail,aws-cloud-config variables: region: "us-east-1" flow: | code(1) for(let CloudTrail of iterate(template.cloudtrailname)){ set("trail", CloudTrail) set("region", template.trailregion) code(2) } self-contained: true code: - engine: - sh - bash source: | aws cloudtrail list-trails --region $region --query 'Trails[*].[Name, HomeRegion]' --output json extractors: - type: json name: cloudtrailname internal: true json: - '.[] | .[0]' - type: json name: trailregion internal: true json: - '.[] | .[1]' - engine: - sh - bash source: | aws cloudtrail describe-trails --region $region --trail-name-list $trail --query 'trailList[*].KmsKeyId' matchers: - type: word words: - "[]" extractors: - type: dsl dsl: - '"CloudTrail trail " + trail + " is not configured to encrypt log files using SSE-KMS encryption"' # digest: 4b0a00483046022100b39586900f3cb7a7ce2582be709c7b3d1b25bceaf0f6d35887c3a3d62bfff8d80221009aa3a72ddade09b522655349a54b6cb7e6e0ebd3b36d85b30899b283e77dc90d:922c64590222798bb761d5b6d8e72950