Soru

Zorluk: OrtaAWS Key Management Service (KMS) and Data Encryption

A SysOps Administrator is configuring a customer managed KMS key in an AWS account to encrypt sensitive application logs. The administrator attaches an IAM policy to a developer's IAM role that grants `kms:Decrypt` and `kms:GenerateDataKey` permissions for the KMS key. However, when the developer attempts to read the encrypted logs, they receive an 'AccessDenied' error. The administrator inspects the KMS key policy, which contains the following statement:

{
"Version": "2012-10-17",
"Id": "key-default-1",
"Statement": [
{
"Sid": "Allow administration of the key",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:role/AdminRole"
},
"Action": [
"kms:Create*",
"kms:Describe*",
"kms:Enable*",
"kms:List*",
"kms:Put*",
"kms:Update*",
"kms:Revoke*",
"kms:Disable*",
"kms:Get*",
"kms:Delete*",
"kms:TagResource",
"kms:UntagResource",
"kms:ScheduleKeyDeletion",
"kms:CancelKeyDeletion"
],
"Resource": "*"
}
]
}

Which action will resolve this issue and allow the developer to access the logs?

  1. Modify the KMS key policy to grant the AWS account root principal (`arn:aws:iam::123456789012:root`) permissions to perform KMS actions, enabling the IAM policy attached to the developer's role to take effect.Cevap
  2. B
    Add the `kms:Decrypt` and `kms:GenerateDataKey` permissions directly to the log storage resource's bucket policy, which overrides the KMS key policy.
  3. C
    Modify the developer's IAM policy to include the `kms:DescribeKey` permission, as IAM policies automatically override KMS key policies when administrative access is configured.
  4. D
    Create a resource-based IAM policy, attach it directly to the KMS key, and enable automatic key rotation to sync permissions across the account.

Cevap

Modify the KMS key policy to grant the AWS account root principal (`arn:aws:iam::123456789012:root`) permissions to perform KMS actions, enabling the IAM policy attached to the developer's role to take effect.
The correct answer is to modify the KMS key policy to grant the AWS account root principal (`arn:aws:iam::123456789012:root`) permissions to perform KMS actions. This enables IAM policies in the account to delegate permissions. Without this delegation statement in the key policy, IAM policies attached to users or roles have no authority to grant access to the KMS key.

Adım Adım Çözüm

1
Analyze the KMS key policy and identify the missing statement for IAM policy delegation.
The current key policy only grants access to `AdminRole` and does not grant access to the account root principal.
Without delegating permissions to the account root principal, IAM policies attached to users or roles in that account cannot grant key access.
2
Add the root principal statement to the KMS key policy.
The key policy now permits IAM-based access control.
This delegates the evaluation of key access permissions to the account's IAM policies.
3
Verify that the developer's IAM policy has the correct permissions.
The developer's IAM policy already contains `kms:Decrypt` and `kms:GenerateDataKey` permissions.
Once delegation is enabled in the key policy, the existing IAM policy will allow successful decryption of logs.

Anahtar Kavram

KMS key policy delegation to IAM policies via the account root principal
Bu soruyu puanla