Ensure that your Google Compute Engine instances are configured to ignore GCP project-wide (shared) public SSH keys and use instance-level SSH keys instead.
This rule resolution is part of the Conformity Security & Compliance tool for GCP.
Project-wide SSH keys can be used to log in to all the Google Cloud VM instances running inside a GCP project. The project-wide SSH keys can ease the SSH key management but if compromised, they pose a security risk which can impact all the VM instances within the project, therefore it is strongly recommended to use instance specific SSH keys as these keys can limit the attack surface if they are compromised. By default, the "Block Project-Wide SSH Keys" security feature is not enabled for Google Compute Engine instances.
Note: VM Instances created by Google Kubernetes Engine (GKE) are excluded from this recommendation due to differences in the available settings.
Audit
To determine if your virtual machine (VM) instances are using common/shared project-wide SSH keys instead of instance specific SSH keys, perform the following operations:
Note: VM Instances created by Google Kubernetes Engine (GKE) are excluded from this recommendation. Instances provisioned by GKE service have names that start with "gke-" and are labeled "goog-gke-node".Remediation / Resolution
To enable Block Project-Wide SSH Keys security feature and block users with common/shared project-wide SSH keys from connecting to your Google Cloud VM instances, perform the following operations:
References
- Google Cloud Platform (GCP) Documentation
- Choosing an access method
- Managing SSH keys in metadata
- CIS Security Documentation
- Securing Google Cloud Computing Platform
- GCP Command Line Interface (CLI) Documentation
- gcloud projects list
- gcloud compute instances list
- gcloud compute instances describe
- gcloud compute instances add-metadata