TMA-KUBERNETES-1.2.2
Ensure that the --token-auth-file parameter is not set
Nghiêm trọngCấp 1Tự độngkubernetes
Mô tả
Do not use token based authentication. Audited on control-plane nodes from the running process arguments (falls back to the kubeadm static pod manifest); SKIPs on nodes without that manifest.
Cách kiểm tra
Phương pháp kiểm tra: Lệnh shell
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
if has token-auth-file; then echo "noncompliant: --token-auth-file is set"; ok=0; fi
if [ "$ok" -eq 1 ]; then echo compliant; fi- Đầu ra mong đợi
compliant
Cách khắc phục
Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng
Follow the documentation and configure alternate mechanisms for authentication. Then, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the master node and remove the --token-auth-file=<filename> parameter.
Thuộc tính
- Hệ điều hành
- Bất kỳ
- Thẻ
- kubernetesapi-server
- Tham chiếu
- CIS Kubernetes Benchmark v2.1.0 - 1.2.2 Ensure that the --token-auth-file parameter is not set
Kiểm tra máy này
Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.
shell
tmaegis scan --target kubernetes