- 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]>
40 lines
1.7 KiB
JSON
40 lines
1.7 KiB
JSON
{
|
|
"id": "cks-network-policy",
|
|
"title": "Default Deny Network Policy",
|
|
"category": "Network Security",
|
|
"difficulty": "Medium",
|
|
"type": "task",
|
|
"weight": 5,
|
|
"description": "## Network Policies\n\nIn a zero-trust architecture, you should deny all traffic by default and explicitly allow what is needed.\n\n**Your task:**\n\nCreate a NetworkPolicy named `default-deny-all` in the `default` namespace that denies all ingress and egress traffic for all pods in the namespace.\n\n```bash\n# Verify your policy:\nkubectl get networkpolicy default-deny-all\n```",
|
|
"hints": [
|
|
{
|
|
"title": "Default Deny YAML",
|
|
"body": "Use a podSelector with an empty matchLabels `{}` to select all pods, and provide empty lists for ingress and egress.",
|
|
"command": "cat <<EOF | kubectl apply -f -\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n name: default-deny-all\n namespace: default\nspec:\n podSelector: {}\n policyTypes:\n - Ingress\n - Egress\nEOF"
|
|
}
|
|
],
|
|
"setup_commands": [],
|
|
"validation": {
|
|
"commands": [
|
|
{
|
|
"description": "NetworkPolicy default-deny-all exists",
|
|
"command": "kubectl get networkpolicy default-deny-all -o jsonpath='{.metadata.name}'",
|
|
"expected_output": "default-deny-all",
|
|
"match": "exact"
|
|
},
|
|
{
|
|
"description": "Policy applies to all pods (empty podSelector)",
|
|
"command": "kubectl get networkpolicy default-deny-all -o jsonpath='{.spec.podSelector.matchLabels}'",
|
|
"expected_output": "",
|
|
"match": "exact"
|
|
}
|
|
]
|
|
},
|
|
"default_namespace": "default",
|
|
"teardown_commands": [
|
|
{
|
|
"command": "kubectl delete networkpolicy default-deny-all --ignore-not-found"
|
|
}
|
|
]
|
|
}
|