Ensure CloudTrail logs are encrypted at rest using KMS CMKs
AWS CloudTrail is a web service that records AWS API calls for an account and makes those logs available to users and resources in accordance with IAM policies. AWS Key Management Service (KMS) is a managed service that helps create and control the encryption keys used to encrypt account data, and uses Hardware Security Modules (HSMs) to protect the security of encryption keys. CloudTrail logs can be configured to leverage server side encryption (SSE) and KMS customer created master keys (CMK) to further protect CloudTrail logs. It is recommended that CloudTrail be configured to use SSE-KMS.
Risk Level: Low
Cloud Entity: CloudTrail
CloudGuard Rule ID: D9.AWS.LOG.06
Covered by Spectral: Yes
Category: Management Tools
GSL LOGIC
CloudTrail should have kmsKeyId
REMEDIATION
From Portal
- Sign in to the AWS Management Console and navigate to CloudTrail.
- In the left navigation, select Trails.
- Click on a Trail you want to update.
- Under General details, click Edit.
- Under log file SSE-KMS encryption, select Enabled.
- In Customer managed AWS KMS key, either use a new or existing key.
- Enter the AWS KMS alias and click Save changes.
From TF
resource "aws_cloudtrail" "test" {
name = "example1"
s3_bucket_name = "example2"
+ kms_key_id = "CMK_KEY_ID"
}
Note: kms_key_id field (includes the KMS key ARN) is used to encrypt the logs delivered by CloudTrail.
From Command Line
- Use below put-key-policy command to provide the necessary permissions through updating the KMS key policy.
aws kms put-key-policy --key-id KMS_KEY --policy CLOUDTRAIL_KMS_KEY_POLICY
- Use below command to update the trail configuration with the KMS key ID.
aws cloudtrail update-trail --name TRAIL_NAME --kms-id KMS_KEY
References
- https://docs.aws.amazon.com/awscloudtrail/latest/userguide/encrypting-cloudtrail-log-files-with-aws-kms.html
- https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html
- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudtrail
- https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudtrail/update-trail.html
- https://awscli.amazonaws.com/v2/documentation/api/latest/reference/kms/put-key-policy.html
CloudTrail
AWS CloudTrail is a service that enables governance, compliance, operational auditing, and risk auditing of your AWS account. With CloudTrail, you can log, continuously monitor, and retain account activity related to actions across your AWS infrastructure. CloudTrail provides event history of your AWS account activity, including actions taken through the AWS Management Console, AWS SDKs, command line tools, and other AWS services. This event history simplifies security analysis, resource change tracking, and troubleshooting.
Compliance Frameworks
- AWS CCPA Framework
- AWS CIS Foundations v. 1.0.0
- AWS CIS Foundations v. 1.1.0
- AWS CIS Foundations v. 1.2.0
- AWS CIS Foundations v. 1.3.0
- AWS CIS Foundations v. 1.4.0
- AWS CIS Foundations v. 1.5.0
- AWS CIS Foundations v. 2.0.0
- AWS CSA CCM v.3.0.1
- AWS CSA CCM v.4.0.1
- AWS CloudGuard Best Practices
- AWS CloudGuard SOC2 based on AICPA TSC 2017
- AWS CloudGuard Well Architected Framework
- AWS GDPR Readiness
- AWS HIPAA
- AWS HITRUST
- AWS HITRUST v11.0.0
- AWS ISO 27001:2013
- AWS ISO27001:2022
- AWS ITSG-33
- AWS LGPD regulation
- AWS MAS TRM Framework
- AWS MITRE ATT&CK Framework v10
- AWS MITRE ATT&CK Framework v11.3
- AWS NIST 800-171
- AWS NIST 800-53 Rev 4
- AWS NIST 800-53 Rev 5
- AWS NIST CSF v1.1
- AWS PCI-DSS 3.2
- AWS PCI-DSS 4.0
- CloudGuard AWS All Rules Ruleset
Updated over 1 year ago