Skip to content

Commit

Permalink
Update current feature
Browse files Browse the repository at this point in the history
  • Loading branch information
fjammes committed Dec 18, 2024
1 parent f9960df commit cd02d90
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions labs/2_authorization/sec-issue.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Inject a security issue inside a k8s cluster

set -euxo pipefail

NS="monitor"

kubectl create namespace "$NS"
kubectl create clusterrolebinding cluster-monitoring --clusterrole=cluster-admin --serviceaccount=monitor:default

# To find it use "rbac-tool analysis", and then
# Same command than "kubens monitoring"
kubectl config set-context $(kubectl config current-context) --namespace="$NS"
SERVICE_ACCOUNT_NAME="default"
kubectl get rolebinding,clusterrolebinding --all-namespaces -o jsonpath="{range .items[?(@.subjects[0].name=='$SERVICE_ACCOUNT_NAME')]}[role: {.roleRef.kind},{.roleRef.name}, binding: {.metadata.name}]{end}"

0 comments on commit cd02d90

Please sign in to comment.