OS Login is disabled on instance Affecting Compute Engine service in Google


0.0
low
0
10
    Severity Framework Snyk CCSS
    Rule category IAM / Usage

Is your enviroment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
    Frameworks
    CIS-Controls
  • Snyk ID SNYK-CC-00393
  • credit Snyk Research Team

Description

Google Cloud IAM roles cannot be used to manage SSH access to the instance.

How to fix?

Set metadata.enable-oslogin attribute to true.

Example Configuration

resource "google_compute_instance" "allowed_2" {
  name         = "test"
  machine_type = "e2-medium"
  zone         = "us-central1-a"

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-11"
    }
  }

  network_interface {
    network = "default"
  }

  metadata = {
    enable-oslogin = true
  }
}