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=TRUE -
Remove instance metadata that overrides the project setting.
gcloud compute instances remove-metadata <INSTANCE_NAME> --keys=enable-oslogin
Optionally, you can enable two factor authentication for OS login. For more information, see: https://cloud.google.com/compute/docs/oslogin/setup-two-factor-authentication.