Skip to content

Commit 12cd06c

Browse files
committed
OCPBUGS-63305: Make SimulatePrincipalPolicy optional
Removing SimulatePrincipalPolicy as a required permission for Mint and Passthrough modes. Instead it will be required when a credential mode is not set.
1 parent 4180662 commit 12cd06c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pkg/asset/installconfig/aws/permissions.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ const (
8484

8585
// PermissionPassthroughCreds is a permission set required when using passthrough credentials.
8686
PermissionPassthroughCreds PermissionGroup = "permission-passthrough-creds"
87+
88+
// PermissionEmptyCreds is a required permission set when a credential mode is not provided.
89+
PermissionEmptyCreds PermissionGroup = "permission-empty-creds"
8790
)
8891

8992
var permissions = map[PermissionGroup][]string{
@@ -173,7 +176,6 @@ var permissions = map[PermissionGroup][]string{
173176
"iam:ListRoles",
174177
"iam:ListUsers",
175178
"iam:PassRole",
176-
"iam:SimulatePrincipalPolicy",
177179
"iam:TagInstanceProfile",
178180
"iam:TagRole",
179181

@@ -370,12 +372,10 @@ var permissions = map[PermissionGroup][]string{
370372
"iam:ListAccessKeys",
371373
"iam:PutUserPolicy",
372374
"iam:TagUser",
373-
"iam:SimulatePrincipalPolicy", // needed so we can verify the above list of course
374375
},
375376
PermissionPassthroughCreds: {
376377
// so we can query whether we have the below list of creds
377378
"iam:GetUser",
378-
"iam:SimulatePrincipalPolicy",
379379

380380
// openshift-ingress
381381
"elasticloadbalancing:DescribeLoadBalancers",
@@ -430,6 +430,10 @@ var permissions = map[PermissionGroup][]string{
430430
"iam:GetUserPolicy",
431431
"iam:ListAccessKeys",
432432
},
433+
PermissionEmptyCreds: {
434+
// needed so we can verify the other required permissions
435+
"iam:SimulatePrincipalPolicy",
436+
},
433437
}
434438

435439
// ValidateCreds will try to create an AWS session, and also verify that the current credentials

pkg/asset/permissions/permissions.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ func (o *Permissions) Generate(ctx context.Context, dependencies asset.Parents)
5454
case types.PassthroughCredentialsMode:
5555
// Include permissions needed by CCO/cluster for passthrough creds mode
5656
reqGroups = append(reqGroups, awsconfig.PermissionPassthroughCreds)
57+
case "":
58+
reqGroups = append(reqGroups, awsconfig.PermissionEmptyCreds)
5759
default:
5860
// Include permissions needed by CCO/cluster for mint creds mode
5961
reqGroups = append(reqGroups, awsconfig.PermissionMintCreds)

0 commit comments

Comments
 (0)