Review KMS key settings for CloudTrail logs

Distinguish default CloudTrail storage encryption from separate KMS key controls.

Description

CloudTrail encrypts log and digest files with SSE-S3 when SSE-KMS is off. Use a customer managed KMS key if auditors need separate control over who can decrypt the files or how long the key remains available.

Potential impact

An incorrect key policy can stop CloudTrail from delivering logs or prevent auditors from reading them.

Remediation

Set kms_key_id to a symmetric KMS key in the log bucket’s Region. Allow CloudTrail to encrypt and deliver logs to S3, and grant approved readers both S3 read and KMS decrypt permissions. Check the S3 properties of a newly delivered log for the intended KMS key, then open it as an approved reader. Retain the keys and permissions needed to read older files.

Examples

Both examples use the same trail and bucket. Supply your bucket name, delivery policy and key ARN.

Omit the KMS key

hcl
resource "aws_cloudtrail" "example" {
  name           = "trail"
  s3_bucket_name = "bucketlog1"
}

Specify a KMS key

hcl
resource "aws_cloudtrail" "example" {
  name           = "trail"
  s3_bucket_name = "bucketlog1"
  kms_key_id     = "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012"
}

References