Skip to main content

πŸ›‘οΈ AWS IAM User has more than one active SSH public key🟒

  • Contextual name: πŸ›‘οΈ User has more than one active SSH public key🟒
  • ID: /ce/ca/aws/iam/user-has-more-than-one-active-ssh-public-key
  • Tags:
  • Policy Type: COMPLIANCE_POLICY
  • Policy Categories: SECURITY

Logic​

Similar Policies​

Description​

Open File

Description​

Identify and deactivate unnecessary IAM SSH public keys used to authenticate access to AWS CodeCommit repositories. AWS allows up to two active SSH public keys per IAM user; however, maintaining two keys should be limited to the key rotation process only. As a security best practice, deactivate the old SSH public key once a new key is created so that only one active key remains for the IAM user.

Rationale​

Similar to IAM access keys, maintaining multiple active SSH public keys for a single IAM user increases security risk if any of the credentials are lost, stolen, or mismanaged. Restricting users to a single active key simplifies auditing and helps ensure that outdated or redundant credentials are not left enabled.

Audit​

This policy flags an AWS IAM User as INCOMPLIANT if more than one related AWS IAM SSH Public Key is in the Active state.

An AWS IAM User is marked as INAPPLICABLE if it has no associated Active AWS IAM SSH Public Key.

Remediation​

Open File

Remediation​

Deactivate Redundant IAM SSH Public Key​

Deactivate any unnecessary or redundant IAM SSH public keys used to authenticate access to AWS CodeCommit repositories.

From Command Line​

Run the update-ssh-public-key command to deactivate a non-operational or redundant SSH public key associated with the specified IAM user:

aws iam update-ssh-public-key \
--region {{region}} \
--user-name {{user-name}} \
--ssh-public-key-id {{ssh-key-id}} \
--status Inactive

After deactivation, confirm that the remaining active SSH public key is functioning correctly and that access to AWS CodeCommit repositories is not disrupted.

policy.yaml​

Open File

Linked Framework Sections​

SectionSub SectionsInternal RulesPoliciesFlagsCompliance
πŸ’Ό AWS Well-Architected β†’ πŸ’Ό SEC03-BP06 Manage access based on lifecycle2no data
πŸ’Ό Cloudaware Framework β†’ πŸ’Ό Credential Lifecycle Management23no data