Ensure Authentication Using Client Certificates Is Disabled
More Info:
Disable client certificate authentication for the cluster, as client certs cannot be easily revoked and are a weak long-lived credential. Rely on short-lived IAM-based authentication instead.
Risk Level
Critical
Address
Security
Compliance Standards
- CIS GKE
Triage and Remediation
- Remediation
Remediation
Manual Steps
-
Identify clusters and current client certificate setting
- Run on: any machine with
gcloudaccess - Command:
For each cluster:gcloud container clusters list --project YOUR_PROJECT_ID --format="table(name,location,master_version,endpoint)"Note whetherCLUSTER_NAME="YOUR_CLUSTER_NAME"LOCATION="YOUR_CLUSTER_LOCATION" # e.g. us-central1, us-central1-cPROJECT_ID="YOUR_PROJECT_ID"gcloud container clusters describe "$CLUSTER_NAME" \--location "$LOCATION" \--project "$PROJECT_ID" \--format=json | jq '.masterAuth'
.masterAuth.clientKeyand.masterAuth.clientCertificateare null/empty or contain data.
- Run on: any machine with
-
Determine if client certificates are in active use
- Run on: any machine with
kubectlaccess - For each context using this cluster, inspect user auth type:
Check underkubectl config view --minify --raw
users[].userforclient-certificate/client-keyfields. - On admin workstations or CI/CD configs, search for kubeconfigs with client certs:
Document any automation or users that still rely on client cert auth.grep -R "client-certificate" -n ~/.kube 2>/dev/null || truegrep -R "client-key" -n ~/.kube 2>/dev/null || true
- Run on: any machine with
-
Decide whether the cluster can be recreated without client certificates
- Review:
- Whether you rely exclusively on GKE IAM /
gke-gcloud-auth-plugin(preferred). - Any legacy tooling that cannot use IAM-based auth.
- Whether you rely exclusively on GKE IAM /
- If any critical dependency requires client certificates and cannot be migrated, plan a migration first before proceeding.
- Review:
-
Plan and perform cluster recreation with
--no-issue-client-certificate(if acceptable)- Design a migration: node pools, workloads, storage (PVs), and network settings (VPC, firewall rules, authorized networks).
- Create a new cluster without client certificates:
NEW_CLUSTER_NAME="NEW_CLUSTER_NAME"LOCATION="YOUR_CLUSTER_LOCATION"PROJECT_ID="YOUR_PROJECT_ID"gcloud container clusters create "$NEW_CLUSTER_NAME" \--location "$LOCATION" \--project "$PROJECT_ID" \--no-issue-client-certificate \# add your existing cluster options here (network, subnetwork, master-authorized-networks, release-channel, etc.)
- Recreate node pools, migrate workloads (e.g., via
kubectl applyor GitOps), and rebind IAM and RBAC as needed. - Once validated, decommission the old cluster:
OLD_CLUSTER_NAME="OLD_CLUSTER_NAME"gcloud container clusters delete "$OLD_CLUSTER_NAME" \--location "$LOCATION" \--project "$PROJECT_ID"
-
Update all access methods to use IAM-based authentication
- Ensure
gcloudandgke-gcloud-auth-pluginare installed and enabled on admin/CI machines:gcloud components install gke-gcloud-auth-plugingcloud container clusters get-credentials "$NEW_CLUSTER_NAME" \--location "$LOCATION" \--project "$PROJECT_ID" - Confirm kubeconfig users no longer reference client certificates:
Verify user entries rely onkubectl config view --raw
auth-provider: gcporexecwithgke-gcloud-auth-plugin.
- Ensure
-
Verify remediation
- Run on: any machine with
gcloudaccess - Command for each active cluster:
gcloud container clusters describe "$CLUSTER_NAME" \--location "$LOCATION" \--project "$PROJECT_ID" \--format=json | jq '.masterAuth.clientKey, .masterAuth.clientCertificate'
- The values should be
null(or absent) for clusters where client certificate authentication is disabled.
- Run on: any machine with
Using kubectl
kubectl cannot disable client certificate authentication, because this setting is managed at the GKE control-plane / cloud provider configuration layer (via gcloud, console, or IaC). Refer to the Manual Steps section for guidance on reviewing and recreating the cluster with --no-issue-client-certificate.
Automation
#!/usr/bin/env bash
#
# Report whether GKE clusters are issuing client certificates (CIS GKE 5.8.1)
# Requires: gcloud, jq
#
# Run location: any machine with gcloud access to the projects you want to audit.
set -euo pipefail
# --- CONFIGURATION ---
# Comma-separated list of GCP projects to check
PROJECTS="my-project-1,my-project-2" # <-- EDIT THIS
IFS=',' read -r -a PROJECT_ARR <<< "$PROJECTS"
echo "Checking client certificate issuance on GKE clusters (CIS GKE 5.8.1)"
echo "Problematic state: masterAuth.clientKey != null (client certs enabled)"
echo
for PROJECT in "${PROJECT_ARR[@]}"; do
echo "==== Project: $PROJECT ===="
# List all clusters in the project (all locations)
CLUSTERS_JSON=$(gcloud container clusters list \
--project "$PROJECT" \
--format json 2>/dev/null || echo "[]")
CLUSTER_COUNT=$(echo "$CLUSTERS_JSON" | jq 'length')
if [ "$CLUSTER_COUNT" -eq 0 ]; then
echo " No clusters found."
echo
continue
fi
echo "$CLUSTERS_JSON" | jq -r '.[] | "\(.name) \(.location)"' | while read -r CLUSTER_NAME LOCATION; do
# Describe cluster to get masterAuth.clientKey
DESC=$(gcloud container clusters describe "$CLUSTER_NAME" \
--location "$LOCATION" \
--project "$PROJECT" \
--format json 2>/dev/null || echo "{}")
CLIENT_KEY=$(echo "$DESC" | jq -r '.masterAuth.clientKey // "null"')
if [ "$CLIENT_KEY" != "null" ] && [ "$CLIENT_KEY" != "" ]; then
STATUS="NON-COMPLIANT"
NOTE="(client certificate authentication ENABLED)"
else
STATUS="OK"
NOTE="(client certificate authentication DISABLED)"
fi
echo " Cluster: $CLUSTER_NAME"
echo " Location : $LOCATION"
echo " Status : $STATUS"
echo " clientKey set : $CLIENT_KEY"
echo " Note : $NOTE"
echo
done
done
cat <<'EOF'
Interpretation:
- COMPLIANT / desired:
masterAuth.clientKey == null
In the script output this appears as:
Status : OK
clientKey set : null
Note : (client certificate authentication DISABLED)
- PROBLEM / needs review:
masterAuth.clientKey != null
In the script output this appears as:
Status : NON-COMPLIANT
clientKey set : <base64-encoded key material>
Note : (client certificate authentication ENABLED)
For NON-COMPLIANT clusters, review whether they should be replaced with
new clusters created using:
gcloud container clusters create CLUSTER_NAME --no-issue-client-certificate
EOF