TMA-AKS-4.2.2
Minimize the admission of containers wishing to share the host process ID namespace
Opis
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. In practice, this means users, groups, and service accounts with deployment rights should not broadly be able to create or update workloads that use host PID sharing, because Microsoft’s AKS identity guidance is to grant identities only the Kubernetes resources they ... Requires kubectl with cluster-wide read access (KUBECONFIG); system namespaces are excluded and listed resources must be remediated or documented as exceptions.
Kako se proverava
Metod provere: Komanda ljuske
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- Očekivani izlaz
compliant
Kako se ispravlja
Metod ispravke: Smernica ili zakrpa infrastrukture
Add policies to each namespace in the cluster which has user workloads to restrict the admission of hostPID containers. Pod Security Policies and Assignments can be found by searching for Policies in the Azure Portal. A detailed step-by-step guide can be found here: https://learn.microsoft.com/en-us/azure/governance/policy/concepts/policy-for-kubernetes
Svojstva
- Operativni sistemi
- Bilo koji
- Oznake
- akspoliciespod-security
- Referenca
- CIS Azure Kubernetes Service (AKS) Benchmark v2.0.0 - 4.2.2 Minimize the admission of containers wishing to share the host process ID namespace
Proverite ovaj računar
Pokrenite ovo na računaru za koji imate dozvolu za proveru. Skeniranje radi u režimu samo za čitanje.
tmaegis scan --target aks