LoginSignup
0
0

More than 1 year has passed since last update.

AWS KMS への IAM ポリシーによるアクセス許可の回避

Posted at

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"
        }
    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0