This rule ensures that each IAM user has only one active access key at a time.
Rule | Ensure there is only one active access key available for any single IAM user |
Framework | cis_v150 |
Severity | ✔ High |
Ensure There is Only One Active Access Key Available for Any Single IAM User (CIS v1.5.0)
Description of the Rule
In AWS Identity and Access Management (IAM), users can have access keys that enable them to make programmatic requests to AWS. These keys are used when interacting with AWS services through the API, CLI, or SDK tools. The Center for Internet Security (CIS) AWS Foundations Benchmark version 1.5.0 recommends that IAM users should have only one active access key at any given time. This reduces the risk of old or unrotated keys being used maliciously if they are forgotten or not deactivated.
Troubleshooting Steps
If an IAM user has more than one active access key, it could pose a security risk. To troubleshoot and resolve this, follow these steps:
Necessary CLI Commands
To enforce this rule, you can use the AWS Command Line Interface (CLI). Below is a step-by-step guide.
Step 1: List All IAM Users
aws iam list-users --output table
Step 2: Get a List of Access Keys for Each User
aws iam list-access-keys --user-name <UserName>
Replace
<UserName>
with the user name you want to check.Step 3: Evaluate Access Key Metadata
For each user, check the
CreateDate
for each access key to determine which key to deactivate or delete.Step 4: Deactivate an Access Key
aws iam update-access-key --access-key-id <AccessKeyId> --user-name <UserName> --status Inactive
Replace
<AccessKeyId>
with the key ID you wish to deactivate, and <UserName>
with the appropriate user name.Step 5: Delete an Access Key
To delete the access key entirely:
aws iam delete-access-key --access-key-id <AccessKeyId> --user-name <UserName>
Again, replace
<AccessKeyId>
with the key ID and <UserName>
with the user's name.Step by Step Guide for Remediation
Please note that this rule does not address access key creation policies, which should be governed by an organization's internal security policies, including the process for key generation, distribution, rotation, and deactivation. It is also important to ensure that you have the necessary permissions to perform these actions and that you communicate any changes with the affected IAM user to avoid disrupting their workflow.