Skip to content
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

[WIP] authn-authz: document delegating custom signing domains #49275

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stevekuznetsov
Copy link
Contributor

Description

Correctly scoping permissions for an actor that can delegate permissions to sign and approve CertificateSigningRequests under a domain is subtle.

Issue

Closes: kubernetes/kubernetes#122154

cc @enj

@k8s-ci-robot k8s-ci-robot added language/en Issues or PRs related to English language cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 2, 2025
@k8s-ci-robot k8s-ci-robot requested review from enj and mikedanese January 2, 2025 22:31
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 2, 2025
@stevekuznetsov stevekuznetsov force-pushed the skuznets/delegating-csr-tutorial branch from c8dc3aa to 5e12edc Compare January 2, 2025 22:36
Copy link

netlify bot commented Jan 2, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit c8dc3aa
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/677713ae6cfcc600085f6187
😎 Deploy Preview https://deploy-preview-49275--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 2, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit 25b4950
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/677c1ca13475f500088673c2
😎 Deploy Preview https://deploy-preview-49275--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sftim
Copy link
Contributor

sftim commented Jan 3, 2025

document delegating custom signing domains

sounds like a task [page] - this is a task a cluster admin might want to learn

Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/retitle [WIP] authn-authz: document delegating custom signing domains

Comment on lines 627 to 635
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: top-level-csr-approver
rules:
- apiGroups: ["certificates.k8s.io"]
resourceNames: ["example.com/*"]
resources: ["signers"]
verbs: ["approve", "sign"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, either:

  • mention that RBAC is only one possible authz mechanism
  • avoid a focus RBAC and instead talk about what the SubjectAccessReview(s) will look like

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I need to read up on the other mechanisms right now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main in-tree alternative is webhook authz, but you can combine that with eg https://www.openpolicyagent.org/integrations/kubernetes-authorization/ or https://github.com/awslabs/cedar-access-control-for-k8s

OpenShift has its own custom authz that extends K8s RBAC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought about this a little more and I'm not sure how to address this comment. The document is specifically addressing a workaround for the RBAC authorizer not understanding example.com/* in a ClusterRole as granting permissions over the entire domain. Other implementations of SubjectAccessReview backends won't necessarily have the delegation problem that RBAC has. OpenShift RBAC ~is k8s RBAC, so the doc here applies to OpenShift identically. By design the doc will not have any meaning in other contexts.

@k8s-ci-robot k8s-ci-robot changed the title authn-authz: document delegating custom signing domains [WIP] authn-authz: document delegating custom signing domains Jan 3, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 3, 2025
@stevekuznetsov stevekuznetsov force-pushed the skuznets/delegating-csr-tutorial branch from 5e12edc to 00ab59d Compare January 6, 2025 14:52
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign dipesh-rawat for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@stevekuznetsov stevekuznetsov force-pushed the skuznets/delegating-csr-tutorial branch from 00ab59d to c7bcb15 Compare January 6, 2025 15:01
its permissions to sign, approve or deny CertificateSigningRequests outside of that
domain may be restricted by:

<!-- TODO validate best posture here, signer names are opaque and don't need to be domains? -->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enj would appreciate your review here.

Error from server (Forbidden): error when creating "-": clusterroles.rbac.authorization.k8s.io "specific-csr-approver" is forbidden: ValidatingAdmissionPolicy 'installer-csr-delegation-policy' with binding 'installer-csr-delegation-policy-binding' denied request: failed expression: variables.signerNameInDomain == true
```

TODO: why don't we get the message? from the VAP??
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enj would appreciate your review here.


TODO: why don't we get the message? from the VAP??

TODO: validate that domain parameter is not empty or startsWith is useless?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enj would appreciate your review here.

@stevekuznetsov
Copy link
Contributor Author

@stevekuznetsov stevekuznetsov force-pushed the skuznets/delegating-csr-tutorial branch 2 times, most recently from b3728e3 to b5d1101 Compare January 6, 2025 17:27
Correctly scoping permissions for an actor that can delegate permissions
to sign and approve CertificateSigningRequests under a domain is subtle.

Signed-off-by: Steve Kuznetsov <[email protected]>
@stevekuznetsov stevekuznetsov force-pushed the skuznets/delegating-csr-tutorial branch from b5d1101 to 25b4950 Compare January 6, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. language/en Issues or PRs related to English language size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Users Can't Delegate CSR Approval/Signing Permissions Within A Domain
3 participants