-
Notifications
You must be signed in to change notification settings - Fork 44
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
PoC: Generate SPIFFE identities in csi-driver #251
base: main
Are you sure you want to change the base?
Conversation
This is inteded as a quick demonstration of a potential replacement for csi-driver-spiffe. This isn't official, isn't on the roadmap and there's no guarantee that anything here will ever be used in any format. This is intended as a point of discussion following recent discussions between maintainers and in the cert-manager daily standup Signed-off-by: Ashley Davis <[email protected]>
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Typically the reason you'd pass along an audience scoped token is to present it to an issuer to attest that:
The threat model with scoped access tokens isn't to protect against an evil kubernetes API (as you say, the API already has access to signing keys). It's to protect against a single kubelet, or csi-driver instance, being breached and therefore permitted to request a certificate for any Pod, even those not assigned to it. |
Where I've said "pass along to an issuer", I should note that also includes just utilising it to make the CREATE request due to our mutating webhook defaulting UserInfo fields to those contained in that token. This requires issuers only need to trust the apiserver to be correct, not kubelet's (within the boundaries of configured maximum token lifetime). |
Do you know of some sort of kubernetes threat model out there which asserts that kubelets are "far less trusted"? Would be interested to read more in depth on that.
This is really the crux of it for me. I'm kinda fine with doing the token song and dance [1] in the csi-driver if that sparks joy for whatever reason - it feels like it's probably either mostly theatre or else it's suboptimal API design of csi-drivers generally. At the end of the day it's likely to be defence in depth and that's no bad thing if the cost is low. I'm really not convinced though that giving every pod permission to create CertificateRequests is a desirable thing though. I think the risk from that is scarily high and I don't think the tools that are available are sufficient to mitigate that risk. I'm much more comfortable with a threat model saying "you have to trust csi-driver to do the right thing and not be evil or pwned" (and the easier UX that comes with that) than I am with a threat model saying "you must enable approval and get all of your policies exactly right". [1]: Effectively this but with actually validating the token given that I'd propose to not use the pod's token to request CRs |
PR needs rebase. 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-sigs/prow repository. |
This is intended as a quick demonstration and as a point of discussion.
This is intended as a starting point following discussions between maintainers and in the cert-manager daily standup.
That said: I'm seriously wondering if this sort of approach could replace the entire csi-driver-spiffe project and remove that maintainence burden, with a net-positive in security for everyone.
Differences from csi-driver-spiffe
If tokenRequests were unilaterally enabled for csi-driver we could do the token song-and-dance that csi-driver-spiffe does.
But I don't think that approach is particularly helpful. The
csi.storage.k8s.io/serviceAccount.name
andcsi.storage.k8s.io/pod.namespace
used in this PR (which are provided by the k8s API) are sufficient without requiring a token, and they're just as trustworthy because they come from the k8s API. There's no cryptographic validation - but even if we did cryptographic validation, that's just us checking the k8s API. An evil k8s API could presumably defeat cryptographic validation.There's also a security benefit in that pods don't need permission to create CertificateRequests, which means a compromised pod down the line won't be able to request certs. Approval (approver-policy) helps with rogue pods but doesn't fully solve the issue - better to avoid the risk entirely.
What's Missing From This PR
Example
Example of this working:
Example resulting cert: