Identity & Zero Trust for Platform Engineers›Human and application identity · Cheat sheet & self-check

Human and application identity · wrap-up

Cheat sheet & self-check

Every command from this section on one page.

07 · OAuth 2.0, OIDC, SAML and SCIM

Explore an OIDC provider

curl -s https://issuer.example.com/.well-known/openid-configuration | jqDiscovery: endpoints, supported flows, JWKS URL
curl -s <jwks_uri> | jq '.keys[] | {kid, alg, kty}'The public keys used to verify tokens
cut -d. -f2 <<< "$TOKEN" | tr '_-' '/+' | base64 -d 2>/dev/null | jqRead a JWT's claims (reading is not validating)

Get tokens (test IdP)

curl -s -d grant_type=client_credentials -d client_id=svc -d client_secret=… <token_endpoint>Client Credentials: a service gets a token for itself
kubectl oidc-login get-token --oidc-issuer-url=<issuer> --oidc-client-id=kubectlkubelogin: browser login, token for kubectl

08 · Validating tokens and propagating identity

Gateway / mesh token checks (Istio)

kubectl apply -f requestauthentication.yamlValidate JWTs from an issuer (signature, iss, aud) at the proxy
kubectl get requestauthentication,authorizationpolicy -n shopWhich token rules apply in a namespace

Debugging tokens

cut -d. -f1 <<< "$TOKEN" | base64 -d 2>/dev/nullHeader: alg and kid
cut -d. -f2 <<< "$TOKEN" | tr '_-' '/+' | base64 -d 2>/dev/null | jq '{iss,aud,sub,exp,scope}'Claims that every check uses
date -d @<exp>Human-readable expiry

09 · Human access: least privilege, JIT and reviews

Who can do what

kubectl auth can-i --list --as=alice@example.com --as-group=team-shopEffective permissions of a user and group
kubectl get clusterrolebindings,rolebindings -A -o wide | grep -i <group>Where a group is bound
kubectl get clusterrolebindings -o json | jq -r '.items[] | select(.roleRef.name=="cluster-admin") | .metadata.name, .subjects'Everyone with cluster-admin

Audit

jq 'select(.verb=="create" and .objectRef.subresource=="exec")' audit.logWho exec'd into pods
jq 'select(.objectRef.resource=="secrets" and .user.username | test("@"))' audit.logHumans reading Secrets