
CVE-2022-0811の悪用をブロックするシンプルなWebhook
これは、悪意のあるsysctl値が設定されている場合にPodの作成をブロックする非常にシンプルなwebhookです。
go test
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build
minikubeを起動:
minikube start
minikube addons enable registry
ビルド:
podman build -t localhost:5000/webhook-cve-2022-0811:latest .
podman push --tls-verify=false "$(minikube ip):5000/webhook-cve-2022-0811:latest"
デプロイ:
cd kustomize/
kustomize build | kubectl apply -f -
次のPodを作成:
apiVersion: v1
kind: Pod
metadata:
name: sysctl-set
namespace: default
spec:
securityContext:
sysctls:
- name: kernel.shm_rmid_forced
value: "1+kernel.core_pattern"
containers:
- name: test
image: k8s.gcr.io/pause:3.2