TMAegis
Više pravila za kubernetes

TMA-KUBERNETES-1.2.6

Ensure that the --authorization-mode argument is not set to AlwaysAllow

KritičnaNivo 1Automatskakubernetes

Opis

Do not always authorize all requests. Audited on control-plane nodes from the running process arguments (falls back to the kubeadm static pod manifest); SKIPs on nodes without that manifest.

Kako se proverava

Metod provere: Komanda ljuske

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
v=$(g authorization-mode); [ -n "$v" ] || { echo "noncompliant: --authorization-mode not set"; ok=0; }
v=$(g authorization-mode); case ",$v," in *,AlwaysAllow,*) echo "noncompliant: --authorization-mode=$v includes AlwaysAllow"; ok=0;; esac
if [ "$ok" -eq 1 ]; then echo compliant; fi
Očekivani izlaz
compliant

Kako se ispravlja

Metod ispravke: Smernica ili zakrpa infrastrukture

Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the Control Plane node and set the --authorization-mode parameter to values other than AlwaysAllow. One such example could be as below. --authorization-mode=RBAC

Svojstva

Operativni sistemi
Bilo koji
Oznake
kubernetesapi-server
Referenca
CIS Kubernetes Benchmark v2.1.0 - 1.2.6 Ensure that the --authorization-mode argument is not set to AlwaysAllow

Proverite ovaj računar

Pokrenite ovo na računaru za koji imate dozvolu za proveru. Skeniranje radi u režimu samo za čitanje.

shell
tmaegis scan --target kubernetes