refactor(scenarios): split monolithic configuration into individual files
- Split `scenarios/scenarios.json` into individual JSON files under `scenarios/data/` named `<scenario-id>.json` - Split `scenarios/bundles.json` into individual JSON files under `scenarios/bundles/` named `<bundle-id>.json` - Updated `backend/server.js` to dynamically load scenario and bundle files from their respective directories - Updated documentation in `scenarios/SCHEMA.md` and `README.md` to reflect the new repository layout and contributor workflow Signed-off-by: Abhinav Sinha <[email protected]>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"id": "cks-rbac-least-privilege",
|
||||
"title": "RBAC Least Privilege",
|
||||
"category": "Cluster Security",
|
||||
"difficulty": "Medium",
|
||||
"type": "task",
|
||||
"weight": 4,
|
||||
"description": "## Role-Based Access Control\n\nService Accounts should only be granted the permissions they explicitly need.\n\n**Your task:**\n\nCreate a Role named `pod-reader` in the `default` namespace that only allows the verbs `get`, `list`, and `watch` on the `pods` resource. Then, bind this Role to a ServiceAccount named `read-only-sa` using a RoleBinding named `read-only-binding`.\n\n```bash\n# Verify your RBAC setup:\nkubectl auth can-i list pods --as=system:serviceaccount:default:read-only-sa\n```",
|
||||
"hints": [
|
||||
{
|
||||
"title": "Imperative commands",
|
||||
"body": "You can create all 3 resources using imperative commands: create serviceaccount, create role, create rolebinding.",
|
||||
"command": "kubectl create sa read-only-sa && kubectl create role pod-reader --verb=get,list,watch --resource=pods && kubectl create rolebinding read-only-binding --role=pod-reader --serviceaccount=default:read-only-sa"
|
||||
}
|
||||
],
|
||||
"setup_commands": [],
|
||||
"validation": {
|
||||
"commands": [
|
||||
{
|
||||
"description": "ServiceAccount read-only-sa exists",
|
||||
"command": "kubectl get sa read-only-sa -o jsonpath='{.metadata.name}'",
|
||||
"expected_output": "read-only-sa",
|
||||
"match": "exact"
|
||||
},
|
||||
{
|
||||
"description": "Role allows list pods",
|
||||
"command": "kubectl auth can-i list pods --as=system:serviceaccount:default:read-only-sa",
|
||||
"expected_output": "yes",
|
||||
"match": "exact"
|
||||
},
|
||||
{
|
||||
"description": "Role denies delete pods",
|
||||
"command": "kubectl auth can-i delete pods --as=system:serviceaccount:default:read-only-sa",
|
||||
"expected_output": "no",
|
||||
"match": "exact"
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_namespace": "default",
|
||||
"teardown_commands": [
|
||||
{
|
||||
"command": "kubectl delete sa read-only-sa --ignore-not-found"
|
||||
},
|
||||
{
|
||||
"command": "kubectl delete role pod-reader --ignore-not-found"
|
||||
},
|
||||
{
|
||||
"command": "kubectl delete rolebinding read-only-binding --ignore-not-found"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user