Template for whitelisting selected IAM roles
See original GitHub issueWe would like to have a template which allows only selected roles for given users. All other IAM bindings should be reported as violations. So instead of blacklisting all other roles, we would like to whitelist only few of them.
Example:
apiVersion: constraints.gatekeeper.sh/v1alpha1
kind: GCPIAMAllowedRolesConstraintV1
metadata:
name: whitelist_roles
annotations:
description: Only test.com groups can have appengine.appViewer and logging.viewer roles. All others bindings are not allowed.
spec:
severity: high
match:
target: ["organization/*"]
exclude: [] # optional, default is no exclusions
parameters:
role:
- roles/appengine.appViewer
- roles/logging.viewer
members:
- "group:*@test.com"
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Template for whitelisting selected IAM roles #115 - GitHub
We would like to have a template which allows only selected roles for given users. All other IAM bindings should be reported as...
Read more >How to Create a Policy That Whitelists Access to Sensitive ...
The Principal element specifies the user, account, service, or other entity that is allowed or denied access to a resource. It is used...
Read more >Configure AWS Policy Templates
Select an AWS policy template and then select Next. ... Use the templates in this folder to create policies on IAM User and...
Read more >Bucket policy to whitelist a specific IAM role - Stack Overflow
Grant access to the IAM Role. This can be broken down into two components: A Bucket Policy that grants access to non-INFECTED objects;...
Read more >aws.iam resources — Cloud Custodian documentation
Filter IAM roles that do not have a specific policy attached ... For example if you want to have a whitelist of valid...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree with morgante. Use
iam_restrict_role
constraint for each whitelisted role. They can detect any member that is not allowed to have such roles. Then you can either modify an existing template to whitelist the given roles, or you can write the template yourself. For example, the rego code for the template can be like this:And the constraint can be like this:
Closing as this is likely resolved now.