Control: 1.16 Ensure RAM policies are attached only to groups or roles
Description
By default, RAM users, groups, and roles have no access to Alibaba Cloud resources. RAM policies are the means by which privileges are granted to users, groups, or roles. It is recommended that RAM policies be applied directly to groups and roles but not users.
Remediation
Perform the following to create a RAM user group and assign a policy to it:
From Console
- Log on to RAM console.
- Choose
Identities > Users
. - Click
Create Group
, and enter the group name, display name, and description. - Click
OK
. - In the
Group Name/Display Name
column, find the target RAM user group and clickAdd Permissions
. - In the
Select Policy
section, select the target policy or policies and clickOK
.
From Command Line
- Run the following command to create a RAM user group:
aliyun ram CreateGroup –GroupName <ram_user_group>
- Run the following command to attach a policy to the group:
aliyun ram AttachPolicyToGroup --GroupName <ram_user_group> --PolicyName <policy_name> --PolicyType <System|Custom>
Perform the following to add a user to a given group:
From Console
- Log on to RAM console.
- Choose
Identities > Groups
. - In the
Group Name/Display Name
column, find the target RAM user group and click AddGroup Members
. - In the
User
section, select the target RAM user and clickOK
.
From Command Line
Run the following command to add a RAM user to a user group:
aliyun ram AddUserToGroup --GroupName <ram_user_group> --UserName <ram_user>
Perform the following to remove a direct association between a user and policy:
From Console
- Logon to RAM console.
- Choose
Permissions > Grants
. - In the
Principal
column, find the target RAM user and clickRevoke Permission
. - Click
OK
.
From Command Line
Run the following command to remove a policy from a RAM user:
aliyun ram DetachPolicyFromUser --PolicyName <policy_name> --PolicyType <System|Custom> --UserName <ram_user>
Usage
Run the control in your terminal:
powerpipe control run alicloud_compliance.control.cis_v100_1_16
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run alicloud_compliance.control.cis_v100_1_16 --share
SQL
This control uses a named query:
ram_user_no_policies