Ensure Legacy Authorization (ABAC) Is Disabled
More Info:
Disable legacy ABAC authorization so access is governed by RBAC, which offers finer-grained and safer permission control. ABAC grants broad access and is deprecated.
Risk Level
High
Address
Security
Compliance Standards
- CIS GKE
Triage and Remediation
- Remediation
Remediation
Manual Steps
-
From any machine with
gcloudaccess, confirm the current ABAC setting for the cluster:gcloud container clusters describe CLUSTER_NAME \--location LOCATION \--project PROJECT_ID \--format json | jq '.legacyAbac'Review:
- If the field is
nullor"enabled": false, legacy ABAC is not in use. - If
"enabled": true, ABAC is enabled and should be reviewed/disabled.
- If the field is
-
If ABAC is enabled, identify teams or systems that might depend on it by reviewing existing RBAC configuration from any machine with
kubectlaccess:kubectl get clusterrole,clusterrolebinding,role,rolebinding -A -o wideAssess whether all needed access appears to be represented in RBAC (roles and bindings) rather than undocumented ABAC policies.
-
Still from a machine with
gcloudaccess, capture and review the full cluster configuration for context (e.g., for change review / change ticket):gcloud container clusters describe CLUSTER_NAME \--location LOCATION \--project PROJECT_ID \--format yaml > cluster-config-before-abac-disable.yamlStore this output as evidence and for rollback analysis.
-
If you determine there is no required dependency on ABAC (or you have confirmed equivalent RBAC rules exist), plan a change window because this is a control-plane configuration change. Then, from a machine with
gcloudaccess, disable legacy authorization:gcloud container clusters update CLUSTER_NAME \--location LOCATION \--project PROJECT_ID \--no-enable-legacy-authorization -
After the update completes, verify that ABAC is disabled from a machine with
gcloudaccess:gcloud container clusters describe CLUSTER_NAME \--location LOCATION \--project PROJECT_ID \--format json | jq '.legacyAbac'Confirm the output is
nullor shows"enabled": false. -
From any machine with
kubectlaccess, perform a quick access-validation check for a few representative service accounts / users (to ensure RBAC covers necessary permissions), for example:kubectl auth can-i list pods --as system:serviceaccount:DEFAULT_NAMESPACE:SERVICE_ACCOUNTAdjust RBAC roles and bindings as needed if any required access is now denied.
Using kubectl
kubectl cannot enable or disable Legacy Authorization (ABAC) because this setting is controlled at the managed control-plane / cloud provider configuration level for the GKE cluster. To remediate this finding, follow the guidance in the Manual Steps section using gcloud, the cloud console, or your IaC tooling.
Automation
#!/usr/bin/env bash
#
# Check Legacy Authorization (ABAC) status for all GKE clusters in one or more projects.
#
# Requirements:
# - gcloud
# - jq
#
# Usage examples:
# ./check-gke-abac.sh
# ./check-gke-abac.sh my-project-1 my-project-2
set -euo pipefail
if ! command -v gcloud >/dev/null 2>&1; then
echo "ERROR: gcloud not found in PATH" >&2
exit 1
fi
if ! command -v jq >/dev/null 2>&1; then
echo "ERROR: jq not found in PATH" >&2
exit 1
fi
PROJECTS=("$@")
if [ "${#PROJECTS[@]}" -eq 0 ]; then
# Default to all active projects in the current account
mapfile -t PROJECTS < <(gcloud projects list --format="value(projectId)")
fi
echo "PROJECT,LOCATION,CLUSTER_NAME,ABAC_ENABLED"
for PROJECT in "${PROJECTS[@]}"; do
# List all clusters in the project across all locations
mapfile -t CLUSTERS < <(
gcloud container clusters list \
--project "${PROJECT}" \
--format="value(name,location)" 2>/dev/null || true
)
if [ "${#CLUSTERS[@]}" -eq 0 ]; then
continue
fi
for ENTRY in "${CLUSTERS[@]}"; do
CLUSTER_NAME=$(awk '{print $1}' <<<"${ENTRY}")
LOCATION=$(awk '{print $2}' <<<"${ENTRY}")
# Describe cluster and extract legacyAbac.enabled
DESC_JSON=$(gcloud container clusters describe "${CLUSTER_NAME}" \
--location "${LOCATION}" \
--project "${PROJECT}" \
--format=json 2>/dev/null || echo '{}')
# Some clusters may not have legacyAbac field at all; treat that as disabled
ENABLED=$(jq -r '.legacyAbac.enabled // "false"' <<<"${DESC_JSON}")
echo "${PROJECT},${LOCATION},${CLUSTER_NAME},${ENABLED}"
done
done
How to use and interpret:
-
Run from any machine with
gcloudconfigured and access to the target projects:chmod +x check-gke-abac.sh./check-gke-abac.sh # all projects in your account./check-gke-abac.sh proj-a # specific project(s) -
Output is CSV:
ABAC_ENABLEDis eithertrueorfalse.
-
Problematic state (requires review/remediation):
- Any line where
ABAC_ENABLEDistrueindicates that Legacy Authorization (ABAC) is enabled on that cluster and should be reviewed and typically disabled:my-project,us-central1,prod-cluster,true <-- needs attention
- Any line where
-
Compliant state:
- Lines with
ABAC_ENABLEDequal tofalse(or where the field is absent and treated asfalse) are aligned with the benchmark expectation:my-project,us-central1,prod-cluster,false <-- OK
- Lines with