๐ก๏ธ Google GCE Project OS Login is not enabled๐ข
- Contextual name: ๐ก๏ธ Project OS Login is not enabled๐ข
- ID:
/ce/ca/google/compute-engine/instance-oslogin - Tags:
- ๐ข Policy with categories
- ๐ข Policy with type
- ๐ข Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Statsโ
not available
Logicโ
- ๐ง prod.logic.yaml๐ข
Similar Policiesโ
- Cloud Conformity: Enable OS Login for GCP Projects
Descriptionโ
Descriptionโ
This policy checks whether OS Login is enabled at the Google Cloud project level for projects with running Google Compute Engine instances. OS Login links SSH access to Cloud IAM identities and reduces reliance on SSH keys stored in project or instance metadata.
Rationaleโ
Enabling OS Login centralizes SSH access management through IAM. When access is removed from an IAM user, the associated SSH access is also removed. This helps manage SSH access consistently and reduces the operational risk of unmanaged or stale SSH keys.
Project-level OS Login can be overridden by instance metadata. A running instance that sets
enable-oslogintoFALSEdisables the project-level control for that instance.Impactโ
Enabling OS Login at the project level disables metadata-based SSH key configurations for instances in the project. If OS Login is later disabled, SSH keys configured in project or instance metadata are restored.
Auditโ
This policy flags a Google Project as
INCOMPLIANTwhen both of the following conditions are met:... see more
Remediationโ
Remediationโ
From Google Cloud Consoleโ
- Go to the VM compute metadata page by visiting: https://console.cloud.google.com/compute/metadata.
- Click
Edit.- Add a metadata entry where the key is
enable-osloginand the value isTRUE.- Click
Saveto apply the changes.- For every instance that overrides the project setting, go to the
VM Instancespage at https://console.cloud.google.com/compute/instances.- Click the name of the instance on which you want to remove the metadata value.
- At the top of the instance details page, click
Editto edit the instance settings.- Under
Custom metadata, remove any entry with keyenable-osloginand the value isFALSE- At the bottom of the instance details page, click
Saveto apply your changes to the instance.From Google Cloud CLIโ
Configure oslogin on the project:
gcloud compute project-info add-metadata \
--metadata enable-oslogin=TRUERemove instance metadata that overrides the project setting.
gcloud compute instances remove-metadata {{instance-name}} \... see more