Azure Kubernetes Service (AKS)
TMA-AKS-3.2.2
Ensure that the --authorization-mode argument is not set to AlwaysAllow
Mô tả
This worker-node kubelet setting ensures the --authorization-mode argument is not set to AlwaysAllow, which would permit requests to the kubelet without proper authorization checks. Using a secure mode such as Webhook helps require authorization for access to the kubelet endpoint and reduces the risk of unauthorized node-level access. Reads every node's effective kubelet configuration through the API server (kubectl get --raw /api/v1/nodes/<node>/proxy/configz); requires kubectl with nodes/proxy access.
Cách kiểm tra
Phương pháp kiểm tra: Lệnh shell
nodes=$(kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}') || exit 1
[ -n "$nodes" ] || exit 1
ok=1
for n in $nodes; do
c=$(kubectl get --raw "/api/v1/nodes/$n/proxy/configz") || exit 1
if ! { ! printf '%s' "$c" | grep -Eq '"authorization":\{"mode":"AlwaysAllow"' && printf '%s' "$c" | grep -Eq '"authorization":\{"mode":"'; }; then echo "noncompliant: $n"; ok=0; fi
done
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
If the --authorization-mode parameter is not set to Webhook and manual modification is required, review the following file, which contains the KUBELET_FLAGS values used to build the kubelet command-line parameters. /etc/default/kubelet Before editing anything, enter debug mode and run chroot to verify what your node is actually using: kubectl debug node/$NODE_NAME -it --image=$IMAGE --profile=general chroot /host systemctl cat kubelet If the service shows an EnvironmentFile=/etc/default/kubelet or references KUBELET_FLAGS, that is the file you would edit. If it does not, then the next place to check is the kubelet systemd unit or drop-in, such as: /etc/systemd/system/kubelet.service /etc/systemd/system/kubelet.service.d/*.conf After a changing the kubelet config file, restart the kubelet service and check status.
Thuộc tính
- Hệ điều hành
- Bất kỳ
- Thẻ
- aksworker-node
- Tham chiếu
- CIS Azure Kubernetes Service (AKS) Benchmark v2.0.0 - 3.2.2 Ensure that the --authorization-mode argument is not set to AlwaysAllow
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.
tmaegis scan --target aks