TMA-GKE-5.2.1
Use custom least privilege service accounts for GKE node pools
설명
Use a custom, least privilege IAM service account for GKE Standard node pools instead of the Compute Engine default service account. The node service account provides the default Google Cloud identity for nodes and should be limited to the permissions required for node level system tasks such as logging, monitoring, autoscaling metrics, and approved image pulls. Requires gcloud with container.clusters.get; the cluster comes from GKE_CLUSTER and GKE_LOCATION (optional GKE_PROJECT, else the gcloud default project). Every node pool is checked.
점검 방법
감사 방식: 셸 명령
out=$(gcloud container node-pools list --cluster "${GKE_CLUSTER:?set GKE_CLUSTER}" --location "${GKE_LOCATION:?set GKE_LOCATION}" ${GKE_PROJECT:+--project=$GKE_PROJECT} --format='value(name,config.serviceAccount)') || exit 1
bad=$(printf '%s\n' "$out" | awk -F '\t' 'NF && !($2!="" && $2!="default" && $2 !~ /-compute@developer\.gserviceaccount\.com$/) {print $1 ": " $2}')
if [ -z "$bad" ]; then echo compliant; else printf '%s\n' "$bad"; fi- 예상 출력
compliant
조치 방법
조치 방식: 가이드 또는 인프라 패치
Create a dedicated custom IAM service account for GKE Standard node pools that are using the Compute Engine default service account or a service account with excessive permissions. The custom node service account should be used for node level system tasks and should be granted only the permissions required for GKE node operation. gcloud iam service-accounts create $NODE_SA_ACCOUNT \ --project=$PROJECT_ID \ --display-name="GKE Node Service Account" Grant the custom node service account the current baseline GKE node role, roles/container.defaultNodeServiceAccount. This role is intended to provide the required permissions for GKE node operation, replacing the older approach of separately assigning logging and monitoring roles.
속성
- 운영 체제
- 모두
- 태그
- gkemanaged-servicesrbac
- 참고 자료
- CIS Google Kubernetes Engine (GKE) Benchmark v2.0.0 - 5.2.1 Use custom least privilege service accounts for GKE node pools
이 호스트 점검하기
감사 권한이 있는 시스템에서 실행하세요. 스캔은 읽기 전용입니다.
tmaegis scan --target gke