Skip to content

Commit

Permalink
Update webhook to block escalate
Browse files Browse the repository at this point in the history
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
  • Loading branch information
mikkeloscar committed Jul 26, 2019
1 parent cee8195 commit 015400f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cluster/node-pools/master-default/userdata.clc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ storage:
- mountPath: /etc/kubernetes/ssl
name: ssl-certs-kubernetes
readOnly: true
- image: registry.opensource.zalan.do/teapot/k8s-authnz-webhook:v0.5.6
- image: registry.opensource.zalan.do/teapot/k8s-authnz-webhook:v0.5.7
name: webhook
ports:
- containerPort: 8081
Expand Down
2 changes: 1 addition & 1 deletion cluster/node-pools/master-ubuntu-default/userdata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ write_files:
- mountPath: /etc/kubernetes/ssl
name: ssl-certs-kubernetes
readOnly: true
- image: registry.opensource.zalan.do/teapot/k8s-authnz-webhook:v0.5.6
- image: registry.opensource.zalan.do/teapot/k8s-authnz-webhook:v0.5.7
name: webhook
ports:
- containerPort: 8081
Expand Down
28 changes: 28 additions & 0 deletions test/e2e/authorisation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,34 @@ var _ = framework.KubeDescribe("Authorization tests", func() {
}}`,
},
},
{
msg: "cdp service account can't escalate permissions",
reqBody: `{
"apiVersion": "authorization.k8s.io/v1beta1",
"kind": "SubjectAccessReview",
"spec": {
"resourceAttributes": {
"namespace": "",
"verb": "escalate",
"group": "*",
"resource": "clusterroles"
},
"user": "system:serviceaccount:default:cdp",
"group": []
}
}`,
expect: expect{
status: http.StatusCreated,
body: `{
"apiVersion": "authorization.k8s.io/v1beta1",
"kind": "SubjectAccessReview",
"status": {
"denied": true,
"reason": "no one is allowed to escalate"
}
}}`,
},
},
{
msg: "operator service account cannot create namespaces",
reqBody: `{
Expand Down

0 comments on commit 015400f

Please sign in to comment.