Control: 1.16 Ensure IAM policies are attached only to groups or roles
Description
By default, IAM users, groups, and roles have no access to AWS resources. IAM policies are the means by which privileges are granted to users, groups, or roles. It is recommended that IAM policies be applied directly to groups and roles but not users.
Assigning privileges at the group or role level reduces the complexity of access management as the number of users grow. Reducing access management complexity may in-turn reduce opportunity for a principal to inadvertently receive or retain excessive privileges.
Remediation
Perform the following to create an IAM group and assign a policy to it:
- Sign in to the AWS Management Console and open the IAM console.
- In the navigation pane, click Groups and then click
Create New Group
. - In the
Group Name
box, type the name of the group and then clickNext Step
. - In the list of policies, select the check box for each policy that you want to apply to all members of the group. Then click
Next Step
. - Click
Create Group
.
Perform the following to add a user to a given group:
- Sign in to the AWS Management Console and open the IAM console.
- In the navigation pane, click
Groups
. - Select the group to add a user to.
- Click
Add Users To Group
. - Select the users to be added to the group.
- Click
Add Users
.
Perform the following to remove a direct association between a user and policy:
- Sign in to the AWS Management Console and open the IAM console.
- In the left navigation pane, click on Users.
- For each user:
- Select the user.
- Click on the
Permissions
tab. - Expand
Managed Policies
. - Click
Detach Policy
for each policy. - Expand
Inline Policies
. - Click
Remove Policy
for each policy.
Usage
Run the control in your terminal:
powerpipe control run aws_compliance.control.cis_v120_1_16
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.cis_v120_1_16 --share
SQL
This control uses a named query:
iam_user_no_policies