TMA-AKS-AUTOMATIC-4.2.2
Minimize the admission of containers wishing to share the host process ID namespace
Mô tả
Minimize the admission of Pods that request spec.hostPID=true so that only tightly controlled, explicitly approved platform workloads can share the host process ID namespace in AKS. Users, groups, and service accounts with deployment rights should not be able to create or update workloads that use host PID sharing without an approved exception. Requires kubectl with cluster-wide read access (KUBECONFIG); system namespaces are excluded and listed resources must be remediated or documented as exceptions.
Cách kiểm tra
Phương pháp kiểm tra: Lệnh shell
out=$(kubectl get pods -A -o go-template='{{range .items}}{{.metadata.namespace}} {{.metadata.name}} {{.spec.hostPID}}{{"\n"}}{{end}}') || exit 1
bad=$(printf '%s\n' "$out" | awk -v ex='^(kube-system|kube-public|kube-node-lease|gatekeeper-system|azure-arc)$' 'NF && $1 !~ ex && ($3=="true")')
if [ -z "$bad" ]; then echo compliant; else printf '%s\n' "$bad" | head -n 25; 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
AKS Automatic already enforces baseline Pod Security Standards and Deployment Safeguards. Remove spec.hostPID: true from user workloads that do not have an approved exception. Where an exception is required, use an approved namespace exclusion and limit who can manage it. Deployment Safeguards are already enabled in Enforce mode. Use Azure Policy only when additional centralized policy requirements are needed. Validate required workloads after making changes.
Thuộc tính
- Hệ điều hành
- Bất kỳ
- Thẻ
- aks-automaticpoliciespod-security
- Tham chiếu
- CIS Azure Kubernetes Service Automatic (AKS Automatic) Benchmark v1.0.0 - 4.2.2 Minimize the admission of containers wishing to share the host process ID namespace
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-automatic