Legacy client certificate authentication in GKE

Use recommended GKE authentication and manage access granted to existing legacy client certificates.

Description

In google.cloud.gcp_container_cluster, master_auth.client_certificate_config.issue_client_certificate controls legacy client certificate issuance at cluster creation. The client still verifies the API server’s TLS certificate.

Potential impact

Someone who obtains both a certificate and its private key can use any cluster permissions granted to that identity.

Remediation

Move operators and automation to OAuth and configure the GKE authentication plugin for kubectl. Grant only required IAM and RBAC permissions. On an existing cluster, changing issuance cannot revoke a certificate. Remove its RBAC grants and check for any access still allowed through legacy ABAC. Retest required operations.

Examples

Both examples contain username and password for basic authentication. GKE removed this authentication method in 1.19. For current GKE, use supported authentication, your project and the path to a service account JSON file.

Certificate issuance disabled

yaml
- name: create a cluster3
  google.cloud.gcp_container_cluster:
    name: my-cluster3
    initial_node_count: 2
    master_auth:
      username: cluster_admin
      password: my-secret-password
      client_certificate_config:
        issue_client_certificate: no
    node_config:
      machine_type: n1-standard-4
      disk_size_gb: 500
    location: us-central1-a
    project: test_project
    auth_kind: serviceaccount
    service_account_file: "/tmp/auth.pem"
    state: present

my-cluster3 sets issue_client_certificate: no to skip issuance at creation.

Older configuration with issuance enabled

yaml
- name: create a cluster
  google.cloud.gcp_container_cluster:
    name: my-cluster
    initial_node_count: 2
    master_auth:
      username: cluster_admin
      password: my-secret-password
      client_certificate_config:
        issue_client_certificate: yes
    node_config:
      machine_type: n1-standard-4
      disk_size_gb: 500
    location: us-central1-a
    project: test_project
    auth_kind: serviceaccount
    service_account_file: /tmp/auth.pem
    state: present

A different cluster, my-cluster, sets issue_client_certificate: yes to request the legacy credential.

References