🛡️ Google GCE Instance OS Login is not enabled🟢
- Contextual name: 🛡️ Instance OS Login is not enabled🟢
- ID:
/ce/ca/google/compute-engine/instance-oslogin - Tags:
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logic
Similar Policies
- Cloud Conformity: Enable OS Login for GCP Projects
Description
Description
OS Login binds SSH certificates to IAM users and facilitates effective SSH certificate management.
Rationale
Enabling OS Login ensures that SSH keys used to connect to instances are mapped with IAM users. Revoking access to an IAM user will revoke all the SSH keys associated with that particular user. It facilitates centralized and automated SSH key pair management which is useful in handling cases like response to compromised SSH key pairs and/or revocation of external/third-party/Vendor users.
Impact
Enabling OS Login on a project disables metadata-based SSH key configurations on all instances from a project. Disabling OS Login restores SSH keys that you have configured in the project or instance metadata.
Audit
From Google Cloud Console
- Go to the VM compute metadata page by visiting https://console.cloud.google.com/compute/metadata.
- Ensure that key
enable-osloginis present with value set toTRUE.- Because instances can override project settings, ensure that no instance has custom metadata with key
enable-osloginand valueFALSE.... 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