A SysOps Administrator is troubleshooting an issue where a newly configured AWS CloudTrail trail is failing to deliver logs to a centralized Amazon S3 bucket. The trail is configured to encrypt log files using an AWS Key Management Service (AWS KMS) customer managed key. The S3 bucket policy is verified to correctly permit the 'cloudtrail.amazonaws.com' service principal to write objects. However, log delivery is failing, and the CloudTrail console displays an access denied error related to encryption. Which modification will resolve this log delivery issue?
- AModify the S3 bucket policy to include 'kms:GenerateDataKey*' and 'kms:Decrypt' in the list of allowed actions for the 'cloudtrail.amazonaws.com' service principal.
- Modify the KMS key policy to allow the 'cloudtrail.amazonaws.com' service principal to perform 'kms:GenerateDataKey*' and 'kms:DescribeKey' actions, using the 'aws:SourceArn' or encryption context conditions to restrict access to the trail.Cevap
- CCreate an IAM role with a policy allowing the 'kms:GenerateDataKey*' action, attach it to the trail using the 'iam:PassRole' permission, and configure the KMS key to trust this role.
- DUpdate the KMS key policy to delegate key administration to the S3 bucket owner by adding the bucket owner's account root principal to the key's administrator list.
Cevap
Modify the KMS key policy to allow the 'cloudtrail.amazonaws.com' service principal to perform 'kms:GenerateDataKey*' and 'kms:DescribeKey' actions, using the 'aws:SourceArn' or encryption context conditions to restrict access to the trail.
The correct solution is to modify the KMS key policy to grant the 'cloudtrail.amazonaws.com' service principal permissions for 'kms:GenerateDataKey*' and 'kms:DescribeKey'. Because CloudTrail encrypts logs on the client side before delivering them to S3, it must have direct permission to use the customer managed key. Adding conditions like 'aws:SourceArn' or 'kms:EncryptionContext:aws:cloudtrail:arn' prevents unauthorized use of the key by other trails or accounts.
Adım Adım Çözüm
Anahtar Kavram
AWS KMS Key Policies for CloudTrail Encryption