Soru

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

A SysOps Administrator in AWS Account `123456789012` is configuring access to a customer managed KMS key. The administrator wants to grant access to an IAM user named `DataOperator`. The administrator attaches the following IAM policy to the user:

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"kms:Encrypt",
"kms:Decrypt"
],
"Resource": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
]
}

When the `DataOperator` user attempts to encrypt a payload using the AWS CLI, they receive an `AccessDeniedException` error. The administrator checks the KMS key policy and finds it only allows access to a specific administration role.

Which of the following describes the cause of this issue and the correct resolution?

  1. The customer managed KMS key policy does not delegate access control to IAM policies. To resolve this, the administrator must modify the KMS key policy to grant the AWS account root principal permissions to perform KMS actions, or explicitly add the IAM user to the key policy.Cevap
  2. B
    The user's IAM policy is missing the `kms:GenerateDataKey` action. To resolve this, the administrator must update the IAM policy to include `kms:GenerateDataKey`, which is required for direct client-side encryption using the AWS CLI.
  3. C
    The user is missing `iam:PassRole` permissions for the KMS key. To resolve this, the administrator must add the `iam:PassRole` action targeting the KMS key ARN to the user's IAM policy.
  4. D
    KMS keys cannot be accessed using IAM policies. To resolve this, the administrator must create a KMS Grant that references the user's IAM policy and specifies the allowed encryption operations.

Cevap

The customer managed KMS key policy does not delegate access control to IAM policies. To resolve this, the administrator must modify the KMS key policy to grant the AWS account root principal permissions to perform KMS actions, or explicitly add the IAM user to the key policy.
The correct answer is correct because AWS KMS key policies are the primary authorization mechanism for KMS keys. To allow IAM policies to grant access to a key, the key policy must contain a statement that delegates authority to the account's root principal (`arn:aws:iam::account-id:root`). Without this delegation, or direct allowance of the user in the key policy, any permissions granted solely in the user's IAM policy will be ignored.

Adım Adım Çözüm

1
Analyze the IAM policy and KMS key policy permissions.
The user has an IAM policy allowing KMS actions, but the KMS key policy only allows access to a specific administration role.
Identify the overlap and conflict between key policy restrictions and IAM policy grants.
2
Evaluate key policy precedence in AWS KMS.
In AWS KMS, key policies are the primary way to control access. IAM policies are only evaluated if the key policy explicitly delegates permission control to the account's root principal.
Determine why the IAM policy alone did not grant the user access to the KMS key.
3
Apply the resolution to delegate access to IAM.
Update the KMS key policy to include the root principal statement (`arn:aws:iam::123456789012:root`) with `kms:*` permissions, allowing the user's IAM policy to take effect.
Enable IAM delegation so the user's attached policy can successfully grant the encrypt and decrypt permissions.

Anahtar Kavram

AWS KMS Key Policy Precedence and IAM Policy Delegation
Bu soruyu puanla