| name | cis-gcp-foundations-4.4 |
| description | Ensure Oslogin Is Enabled for a Project |
| category | cis-gcp-foundations |
| version | 4.0.0 |
| author | cyberstrike-official |
| tags | ["cis","gcp","compute","virtual-machines","oslogin"] |
| cis_id | 4.4 |
| cis_benchmark | CIS Google Cloud Platform Foundation Benchmark v4.0.0 |
| tech_stack | ["gcp"] |
| cwe_ids | [] |
| chains_with | [] |
| prerequisites | [] |
| severity_boost | {} |
4.4 Ensure Oslogin Is Enabled for a Project (Automated)
Profile Applicability
Description
Enabling OS login binds SSH certificates to IAM users and facilitates effective SSH certificate management.
Rationale
Enabling osLogin ensures that SSH keys used to connect to instances are mapped with IAM users. Revoking access to 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 project disables metadata-based SSH key configurations on all instances from a project. Disabling OS Login restores SSH keys that you have configured in project or instance meta-data.
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-oslogin is present with value set to TRUE.
- Because instances can override project settings, ensure that no instance has custom metadata with key
enable-oslogin and value FALSE.
From Google Cloud CLI
- List the instances in your project and get details on each instance:
gcloud compute instances list --format=json
- Verify that the section
commonInstanceMetadata has a key enable-oslogin set to value TRUE.
Exception
VMs created by GKE should be excluded. These VMs have names that start with gke- and are labeled goog-gke-node.
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-oslogin and the value is TRUE.
- Click
Save to apply the changes.
- For every instance that overrides the project setting, go to the
VM Instances page at https://console.cloud.google.com/compute/instances.