TMA-AKS-AUTOMATIC-4.2.2
Minimize the admission of containers wishing to share the host process ID namespace
说明
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.
检查方式
审计方法: 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- 预期输出
compliant
修复方式
修复方法: 操作指南或基础设施补丁
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.
属性
- 操作系统
- 任意
- 标签
- aks-automaticpoliciespod-security
- 参考
- 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
检查本机
请在您有权审计的机器上运行此命令。扫描为只读操作。
tmaegis scan --target aks-automatic