-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Authorization for referring to Secrets #4957
Comments
Using the volume in a pod is equivalent to having read access on the secret. So, the pod creator/updater maybe should have to have read permission on the secret that is referenced. Questions:
I don't think it is sufficient to say that if the secret is in the same namespace, then it can be referenced. |
|
If I have permission to make pods but not to see a secret, can I update an existing pod that references a secret I can't see? |
@erictune And also, to what degree does the answer to your question depend on your specific relationship with the pod's service account? |
(or even more indirectly, a pod that references a proposed securitycontext/serviceaccount thing which in turn references secrets) |
If our goals for secrets are:
But if they are also:
Then we need more thought about it. |
I think the pod-writer-role case is a valid one. |
to be clear, I'm saying the following use case:
|
the alternative would be to have two namespaces. I don't like that approach, but I'm putting it out there. |
@erictune That's how I understood it; I think this will be a common UC. |
@liggitt yes thinking about serviceaccounts too. |
Just to be sure I'm caught up, the story breaks down like this. Inside of the When it comes time to schedule the pod, we have a few problems and I'm not sure which ones we're trying to solve.
|
|
Ok, so that makes my number 2 less important and my number 3 more important. If being able to use a secret does not imply the ability to read that secret, we probably want a way to express those two concepts in authorization rules. |
The user can't use a secret, but the kubelet is using the secret on their behalf. The only notch we have to support is "can't read secrets, but can clone a pod template / existing pod". And that's not a very important story. I'm not sure most users would be able to set a volumesecretsource - that's an initializer or admission controller making that decision.
|
@liggitt has an incoming brain dump of the entire flow to put here - we had quite a few recommendations. |
Sorry for the delay... sorting out my thoughts here piecemill before I get distracted. First, there seems to be two main divisions of secrets:
For secrets a container uses directly, I don't think we'll ever get the default secret manifestions correct to the point where a container would never need to override them. That means that containers would still (potentially) have to set up volumemounts, secret volumes with secret references, etc. |
Subtype of 2 - Secrets that can be generically injected into /run/secrets for the container to use (i.e., pod doesn't need to know how the secrets manifest) ----- Original Message -----
|
Now that #5807 is in, pods can only ref secrets in the same namespace. |
In our model, only if they have policy level access. Read/Write secrets was reserved for "Edit". We talked about having a default role slightly below "Edit" that was "EditWithSecrets" that allowed you to read secrets but not write them, or a "ViewSecrets" that was "View" with the added ability to see secrets. We talked about enforcing access to secrets through a service account, by enabling an endpoint /namespaces/bar/pod/foo/secrets that follows the same rules of permissions (kubelet is granted access to it because it's scheduled to the kubelet). Hadn't got very far on that though. ----- Original Message -----
|
@liggitt @pmorie @smarterclayton @deads2k I sort of like the idea of doing it in the apiserver, because it gives immediate feedback. |
Just thinking through it it simplifies the kubelet interaction if it can get secrets for a pod by api, although it means they may want to denormalize based on service account as a performance optimization. Someone from our ops team asked me this the other day, and the more the kubelet has to know to do the right thing the harder it is to verify it is secure. If there was /pods/foo/secrets or /podSecrets/foo the lookup can be mediated by the server, pod-kubelet access check is a simple O(1), and the secret lookup is just a constant factor. We haven't talked about the kubelet security role, but we proposed making it a programmatic policy check (the user kubelet:node123 has access to any pod that has status.host == node123) vs trying to articulate it in a generic fashion using only verbs. But right now we punted on that until Jordan lands his node security fixes, and probably until after 1.0.
|
@erictune I have thought about it but i'm not sure where I stand on it. |
/subscribe |
Is there any progress? I try to use RBAC to authz, but RBAC also has this security problem till now. env
How to reproduce
secret and pod
User who cannot read secret
User who is namespace owner
|
Correct, that is currently working as designed. The ability to create pods in a namespace currently implies the ability to read secrets in the namespace (even if you couldn't exec in, you could run an image that would send the mounted secrets to you). |
@liggitt But this seems to be conflict with what abac or rbac promises? if we have abac or rbac policies that clearly rule out accessing secrets, like
If we consider this as working as design, is there a way for us to 'tell' secret owner about this info (that pod creator/updater can consume secrets or configs in this namespace even you didn't give the permission in the role)? |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
The ACL boundary for the content of pod specs is the namespace level (a pod spec can refer to a service account, secret, or configmap in its namespace) /close |
@liggitt: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
When a pod is created/updated and has a volumeSource of type "secret", then we should validate whether the user creating the pod has permission to use that secret.
The text was updated successfully, but these errors were encountered: