4
4
- " @smarterclayton"
5
5
- " @liggitt"
6
6
- " @mikedanese"
7
+ - " @zshihang"
7
8
owning-sig : sig-storage
8
9
participating-sigs :
9
10
- sig-auth
@@ -14,7 +15,7 @@ approvers:
14
15
- " @saad-ali"
15
16
editor : " @zshihang"
16
17
creation-date : 2018-05-15
17
- last-updated : 2020-03-09
18
+ last-updated : 2020-03-27
18
19
status : implemented
19
20
see-also :
20
21
- " https://github.com/kubernetes/community/blob/e3a6b8172fec9506b15520549e52be683e30cbfb/contributors/design-proposals/storage/svcacct-token-volume-source.md"
@@ -29,6 +30,9 @@ see-also:
29
30
- [ Motivation] ( #motivation )
30
31
- [ Proposal] ( #proposal )
31
32
- [ Token Volume Projection] ( #token-volume-projection )
33
+ - [ File Permission] ( #file-permission )
34
+ - [ Proposed heuristics] ( #proposed-heuristics )
35
+ - [ Alternatives considered] ( #alternatives-considered )
32
36
- [ Alternatives] ( #alternatives )
33
37
- [ Graduation Criteria] ( #graduation-criteria )
34
38
<!-- /toc -->
@@ -65,7 +69,6 @@ With this feature, we hope to provide a backwards compatible replacement for
65
69
service account tokens that strengthens the security and improves the
66
70
scalability of the platform.
67
71
68
-
69
72
## Proposal
70
73
71
74
Kubernetes should implement a ServiceAccountToken volume projection that
@@ -142,7 +145,6 @@ sources:
142
145
fieldRef : metadata.namespace
143
146
` ` `
144
147
145
-
146
148
This fixes one scalability issue with the current service account token
147
149
deployment model where secret GETs are a large portion of overall apiserver
148
150
traffic.
@@ -159,6 +161,55 @@ sources:
159
161
audience : ca.istio.io
160
162
` ` `
161
163
164
+ ### File Permission
165
+
166
+ The secret projections are currently written with world readable (0644,
167
+ effectively 444) file permissions. Given that file permissions are one of the
168
+ oldest and most hardened isolation mechanisms on unix, this is not ideal.
169
+ We would like to opportunistically restrict permissions for projected service
170
+ account tokens as long we can show that they won’t break users if we are to
171
+ migrate away from secrets to distribute service account credentials.
172
+
173
+ #### Proposed heuristics
174
+
175
+ + *Case 1*: The pod has an fsGroup set. We can set the file permission on the
176
+ token file to 0600 and let the fsGroup mechanism work as designed. It will
177
+ set the permissions to 0640, chown the token file to the fsGroup and start
178
+ the containers with a supplemental group that grants them access to the
179
+ token file. This works today.
180
+ + *Case 2*: The pod’s containers declare the same runAsUser for all containers
181
+ (ephemeral containers are excluded) in the pod. We chown the token file to
182
+ the pod’s runAsUser to grant the containers access to the token. All
183
+ containers must have UID either specified in container security context or
184
+ inherited from pod security context. Preferred UIDs in container images are
185
+ ignored.
186
+ + *Fallback*: We set the file permissions to world readable (0644) to match
187
+ the behavior of secrets.
188
+
189
+ This gives users that run as non-root greater isolation between users without
190
+ breaking existing applications. We also may consider adding more cases in the
191
+ future as long as we can ensure that they won’t break users.
192
+
193
+ #### Alternatives considered
194
+
195
+ + We can create a volume for each UserID and set the owner to be that UserID
196
+ with mode 0400. If user doesn't specify runAsUser, fetching UserID in image
197
+ requires a re-design of kubelet regarding volume mounts and image pulling.
198
+ This has significant implementation complexity because:
199
+ + We would have to reorder container creation to introspect images (that
200
+ might declare USER or GROUP directives) to pass this information to the
201
+ projected volume mounter.
202
+ + Further, images are mutable so these directives may change over the
203
+ lifetime of the pod.
204
+ + Volumes are shared between all pods that mount them today. Mapping a
205
+ single logical volume in a pod spec to distinct mount points is likely a
206
+ significant architectural change.
207
+ + We pick a random group and set fsGroup on all pods in the service account
208
+ admission controller. It’s unclear how we would do this without conflicting
209
+ with usage of groups and potentially compromising security.
210
+ + We set token files to be world readable always. Problems with this are
211
+ discussed above.
212
+
162
213
### Alternatives
163
214
164
215
1. Instead of implementing a service account token volume projection, we could
@@ -173,7 +224,6 @@ sources:
173
224
users needing to install this extension.
174
225
1. Complicates installation for the majority of users.
175
226
176
-
177
227
## Graduation Criteria
178
228
179
229
TBD
0 commit comments