Permission Boundary とは
IAMユーザーやロールに設定できる「許可の上限」を定義するマネージドポリシー
出典: Permissions boundaries for IAM entities - AWS Identity and Access Management
A permissions boundary is an advanced feature for using a managed policy to set the maximum permissions that an identity-based policy can grant to an IAM entity. An entity’s permissions boundary allows it to perform only the actions that are allowed by both its identity-based policies and its permissions boundaries.
仕組み
有効な権限は、アイデンティティベースポリシーとPermission Boundaryの交差部分のみになる
出典: Permissions boundaries for IAM entities - AWS Identity and Access Management
Identity-based policies are inline or managed policies that are attached to a user, group of users, or role. Identity-based policies grant permission to the entity, and permissions boundaries limit those permissions. The effective permissions are the intersection of both policy types. An explicit deny in either of these policies overrides the allow.
有効な権限 = アイデンティティベースポリシー ∩ Permission Boundary
具体例: 開発者 Shirley のケース
シナリオ
Shirley という開発者に対して、S3・CloudWatch・EC2 のみ操作を許可したい
構成図
┌─────────────────────────────────────────────────────────────────────┐
│ Shirley (開発者) │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────┐ ┌─────────────────────────┐ │
│ │ Identity Policy │ │ Permission Boundary │ │
│ │ (付与された権限) │ │ (許可の上限) │ │
│ ├─────────────────────────┤ ├─────────────────────────┤ │
│ │ │ │ ● S3:* │ │
│ │ ● IAM:CreateUser │ │ ● CloudWatch:* │ │
│ │ ● EC2:StartInstances │ │ ● EC2:* │ │
│ │ │ │ │ │
│ └───────────┬─────────────┘ └───────────┬─────────────┘ │
│ │ │ │
│ └──────────┬──────────────────┘ │
│ ▼ │
│ ┌─────────────────────────┐ │
│ │ 有効な権限 (交差部分) │ │
│ ├─────────────────────────┤ │
│ │ ✓ EC2:StartInstances │ ← 両方で許可 │
│ │ ✗ IAM:CreateUser │ ← 境界で未許可 │
│ │ ✗ S3:* │ ← ポリシーで未付与 │
│ └─────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
評価フロー
Shirley が IAM:CreateUser を実行
│
▼
┌───────────────────────────┐
│ Identity Policy を確認 │
│ IAM:CreateUser → 許可 ✓ │
└─────────────┬─────────────┘
│
▼
┌───────────────────────────┐
│ Permission Boundary を確認│
│ IAM:CreateUser → 未許可 ✗ │
└─────────────┬─────────────┘
│
▼
┌───────────────────────────┐
│ 結果: 拒否 │
│ (境界で許可されていない) │
└───────────────────────────┘
Step 1: Permission Boundary を設定
以下のポリシーを Permission Boundary として Shirley に設定する
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*",
"cloudwatch:*",
"ec2:*"
],
"Resource": "*"
}
]
}出典: Permissions boundaries for IAM entities - AWS Identity and Access Management
For example, assume that the IAM user named Shirley should be allowed to manage only Amazon S3, Amazon CloudWatch, and Amazon EC2. To enforce this rule, you can use the following policy to set the permissions boundary for the Shirley user.
Step 2: アイデンティティベースポリシーを付与
Shirley に IAM ユーザー作成権限を付与するポリシーをアタッチする
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "iam:CreateUser",
"Resource": "*"
}
}Step 3: 結果
Shirley が iam:CreateUser を実行しようとすると、失敗する
出典: Permissions boundaries for IAM entities - AWS Identity and Access Management
If you attach this permissions policy to the Shirley user, and Shirley tries to create a user, the operation fails. It fails because the permissions boundary does not allow the iam:CreateUser operation.
評価結果まとめ
| アクション | アイデンティティポリシー | Permission Boundary | 結果 |
|---|---|---|---|
| s3:GetObject | - | ✓ 許可 | ✗ 拒否(ポリシーで未付与) |
| iam:CreateUser | ✓ 許可 | ✗ 未許可 | ✗ 拒否(境界外) |
| ec2:StartInstances | ✓ 許可 | ✓ 許可 | ✓ 許可(両方で許可) |
出典: Permissions boundaries for IAM entities - AWS Identity and Access Management
When you use a policy to set the permissions boundary for a user, it limits the user’s permissions but does not provide permissions on its own.
ユースケース
権限昇格の防止
開発者にロール作成を許可しつつ、作成されるロールの権限上限を制限できる
出典: AWS CDK aws_iam README - Permissions Boundaries
Permissions Boundaries can be used as a mechanism to prevent privilege escalation by creating new Roles. Permissions Boundaries are a Managed Policy, attached to Roles or Users, that represent the maximum set of permissions they can have.
権限委譲
管理者が開発者にIAMリソース作成を委任する際、上限を設定できる
出典: Permissions boundaries for IAM entities - AWS Identity and Access Management
You can use permissions boundaries to delegate permissions management tasks to IAM users in your account.
他のポリシータイプとの関係
Permission Boundary は SCP やアイデンティティベースポリシーと組み合わせて評価される。すべてのポリシータイプで許可されている場合のみ、リクエストが許可される
出典: Permissions boundaries for IAM entities - AWS Identity and Access Management
An IAM entity (user or role) can make a request that is affected by an SCP, a permissions boundary, and an identity-based policy. In this case, the request is allowed only if all three policy types allow it. The effective permissions are the intersection of all three policy types. An explicit deny in any of these policies overrides the allow.
有効な権限 = SCP ∩ Permission Boundary ∩ アイデンティティベースポリシー