Ensure that the user-managed keys associated with your Google Cloud Platform (GCP) service accounts are regularly rotated. It is recommended to rotate keys every 90 days or less. Each GCP service account is associated with a key pair managed by Google and used for service-to-service authentication within Google Cloud. GCP provides the option to create one or more user-managed (external) key pairs for use outside your cloud account. When a new key pair is created, you have the ability to download the private key (which is not retained by Google), therefore you are responsible for keeping the private key secure and managing the key rotation.
This rule resolution is part of the Conformity Security & Compliance tool for GCP.
Rotating user-managed service account keys will significantly reduce the chance for an access key that is associated with a compromised or terminated account to be used. Google Cloud Platform (GCP) account keys should be rotated to ensure that data can't be accessed with an old key that might have been lost, compromised, or stolen.
Audit
To determine if your GCP user-managed service account keys have been rotated recently (recommended every 90 days), perform the following actions:
Remediation / Resolution
To rotate any external (i.e. user-managed) keys, older than the maximum allowed age (recommended 90 days), associated with your GCP service accounts, perform the following actions:
References
- Google Cloud Platform (GCP) Documentation
- Cloud Identity and Access Management (IAM)
- Service accounts
- Understanding service accounts
- Creating and managing service account keys
- CIS Security Documentation
- Securing Google Cloud Computing Platform
- GCP Command Line Interface (CLI) Documentation
- gcloud projects list
- gcloud iam service-accounts list
- gcloud iam service-accounts keys list
- gcloud iam service-accounts keys create
- gcloud iam service-accounts keys delete