Skip to content

Commit b592364

Browse files
committed
Prevent poweruser read secret at cluster role level
Signed-off-by: Mikkel Oscar Lyderik Larsen <[email protected]>
1 parent 392fcbf commit b592364

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

cluster/manifests/deletions.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ post_apply:
308308
- name: role-sync-controller
309309
kind: ServiceAccount
310310
namespace: kube-system
311+
# secret-read role/bindings
312+
- name: cdp-deployer-poweruser-secret-read
313+
kind: ClusterRoleBinding
314+
- name: deployment-service-executor-poweruser-secret-read
315+
kind: ClusterRoleBinding
311316
{{- end }}
312317
{{- if ne .Cluster.ConfigItems.kube_janitor_enabled "true" }}
313318
- name: kube-janitor

cluster/manifests/deployment-service/controller-rbac.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,29 @@ subjects:
123123
name: "deployment-service-controller"
124124
namespace: "kube-system"
125125
# {{ end }}
126+
# {{ if eq .Cluster.ConfigItems.role_sync_controller_enabled "true" }}
127+
---
128+
kind: ClusterRoleBinding
129+
apiVersion: rbac.authorization.k8s.io/v1
130+
metadata:
131+
name: "deployment-service-executor-poweruser-secret-read"
132+
labels:
133+
application: "deployment-service"
134+
component: "controller"
135+
roleRef:
136+
kind: ClusterRole
137+
name: poweruser-secret-read
138+
apiGroup: rbac.authorization.k8s.io
139+
subjects:
140+
- apiGroup: rbac.authorization.k8s.io
141+
kind: User
142+
name: zalando-iam:zalando:service:k8sapi-local_deployment-service-executor
143+
# {{ if eq .Cluster.Provider "zalando-eks" }}
144+
- kind: ServiceAccount
145+
name: "deployment-service-controller"
146+
namespace: "kube-system"
147+
# {{ end }}
148+
# {{ end }}
126149
---
127150
kind: ClusterRoleBinding
128151
apiVersion: rbac.authorization.k8s.io/v1

cluster/manifests/roles/cdp-deployer-binding.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,18 @@ subjects:
1010
- kind: ServiceAccount
1111
name: cdp
1212
namespace: default
13+
# {{ if eq .Cluster.ConfigItems.role_sync_controller_enabled "true" }}
14+
---
15+
kind: ClusterRoleBinding
16+
apiVersion: rbac.authorization.k8s.io/v1
17+
metadata:
18+
name: cdp-deployer-poweruser-secret-read
19+
roleRef:
20+
apiGroup: rbac.authorization.k8s.io
21+
kind: ClusterRole
22+
name: poweruser-secret-read
23+
subjects:
24+
- kind: ServiceAccount
25+
name: cdp
26+
namespace: default
27+
# {{ end }}

cluster/manifests/roles/poweruser-role.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ rules:
5858
- services/proxy
5959
verbs:
6060
- get
61+
# {{ if ne .Cluster.ConfigItems.role_sync_controller_enabled "true" }}
6162
- apiGroups:
6263
- ''
6364
resources:
@@ -66,6 +67,7 @@ rules:
6667
- get
6768
- list
6869
- watch
70+
# {{ end }}
6971
- apiGroups:
7072
- ''
7173
- extensions
@@ -248,3 +250,19 @@ rules:
248250
- update
249251
- patch
250252
- delete
253+
# {{ if eq .Cluster.ConfigItems.role_sync_controller_enabled "true" }}
254+
---
255+
apiVersion: rbac.authorization.k8s.io/v1
256+
kind: ClusterRole
257+
metadata:
258+
name: poweruser-secret-read
259+
rules:
260+
- apiGroups:
261+
- ''
262+
resources:
263+
- secrets
264+
verbs:
265+
- get
266+
- list
267+
- watch
268+
# {{ end }}

0 commit comments

Comments
 (0)