TMAegis
kubernetes 관련 규칙 더 보기

TMA-KUBERNETES-1.2.5

Ensure that the --kubelet-certificate-authority argument is set as appropriate

높음레벨 1자동kubernetes

설명

Verify kubelet's certificate before establishing connection. Audited on control-plane nodes from the running process arguments (falls back to the kubeadm static pod manifest); SKIPs on nodes without that manifest.

점검 방법

감사 방식: 셸 명령

shell
set -f
a=$(ps -eo args 2>/dev/null | grep -E '^([^ ]*/)?kube-apiserver( |$)' | head -n 1)
[ -n "$a" ] || a=$(sed -n 's/^[[:space:]]*-[[:space:]]*"\{0,1\}\(--[^"]*\)"\{0,1\}[[:space:]]*$/\1/p' /etc/kubernetes/manifests/kube-apiserver.yaml | tr '\n' ' ')
[ -n "$a" ] || exit 1
g() { printf '%s\n' "$a" | awk -v k="--$1" '{for(i=1;i<=NF;i++){if($i==k&&i<NF)v=$(i+1); else if(index($i,k"=")==1)v=substr($i,length(k)+2)}} END{if(v!="")print v}'; }
has() { printf '%s\n' "$a" | awk -v k="--$1" '{for(i=1;i<=NF;i++) if($i==k||index($i,k"=")==1) f=1} END{exit !f}'; }
ok=1
v=$(g kubelet-certificate-authority); [ -n "$v" ] || { echo "noncompliant: --kubelet-certificate-authority not set"; ok=0; }
if [ "$ok" -eq 1 ]; then echo compliant; fi
예상 출력
compliant

조치 방법

조치 방식: 가이드 또는 인프라 패치

Follow the Kubernetes documentation and setup the TLS connection between the apiserver and kubelets. Then, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the Control Plane node and set the --kubelet-certificate-authority parameter to the path to the cert file for the certificate authority. --kubelet-certificate-authority=<ca-string>

속성

운영 체제
모두
태그
kubernetesapi-serverkubelet
참고 자료
CIS Kubernetes Benchmark v2.1.0 - 1.2.5 Ensure that the --kubelet-certificate-authority argument is set as appropriate

이 호스트 점검하기

감사 권한이 있는 시스템에서 실행하세요. 스캔은 읽기 전용입니다.

shell
tmaegis scan --target kubernetes