IAM ユーザのポリシーによっては (例えばAWSKeyManagementServicePowerUser
が付与されている場合など)、
AWS KMS のキーポリシー上、「キー管理者」や「キーユーザー」に該当のIAM ユーザが含まれていない場合でも
アクセスできてします。
これは、以下の通り、"AWS": "arn:aws:iam::111122223333:root"
の設定によるもの。
{
"Sid": "Enable IAM User Permissions",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:root"
},
"Action": "kms:*",
"Resource": "*"
}
この場合、上記を以下のようにCondition
を設定することで回避できるらしい。
※AWSKeyManagementServicePowerUser
が付与されていてもアクセス不可能になる
{
"Sid": "EnableRootAccessAndPreventPermissionDelegation",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:root"
},
"Action": "kms:*",
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:PrincipalType": "Account"
}
}
}