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 Management24no data