π Google IAM Service Account has User-Managed Keys π’
- Contextual name: π Service Account has User-Managed Keys π’
- ID:
/ce/ca/google/iam/service-account-keys
- Located in: π Google IAM
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
SECURITY
Similar Policiesβ
- Cloud Conformity
Logicβ
- π§ prod.logic.yaml π’
Descriptionβ
Descriptionβ
User-managed service accounts should not have user-managed keys.
Rationaleβ
Anyone who has access to the keys will be able to access resources through the service account. GCP-managed keys are used by Cloud Platform services such as App Engine and Compute Engine. These keys cannot be downloaded. Google will keep the keys and automatically rotate them on an approximately weekly basis. User-managed keys are created, downloadable, and managed by users. They expire 10 years from creation.
For user-managed keys, the user has to take ownership of key management activities which include:
β’ Key storage
β’ Key distribution
β’ Key revocation
β’ Key rotation
β’ Protecting the keys from unauthorized users
β’ Key recoveryEven with key owner precautions, keys can be easily leaked by common development malpractices like checking keys into the source code or leaving them in the Downloads directory, or accidentally leaving them on support blogs/channels.
It is recommended to prevent user-managed service account keys.
... see more
Remediationβ
Remediationβ
From Google Cloud Consoleβ
- Go to the IAM page in the GCP Console using https://console.cloud.google.com/iam-admin/iam
- In the left navigation pane, click
Service accounts
. All service accounts and their corresponding keys are listed.- Click the service account.
- Click the
edit
and delete the keys.From Google Cloud CLIβ
To delete a user managed Service Account Key:
gcloud iam service-accounts keys delete --iam-account=<user-managed-service-account-EMAIL> <KEY-ID>