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

Organize PSP policies into standardized buckets #6

Open
sozercan opened this issue May 21, 2020 · 9 comments
Open

Organize PSP policies into standardized buckets #6

sozercan opened this issue May 21, 2020 · 9 comments
Assignees
Labels

Comments

@sozercan
Copy link
Member

Describe the solution you'd like
There are quite a few PSP policies in the library. It might be confusing to users which ones to deploy and what constraints parameters to set.

sig-auth provides a set of standardized PSP definitions (https://docs.google.com/document/d/1d9c4BaDzRw1B5fAcf7gLOMZSVEvrpSutivjfNOwIqT0/edit#heading=h.ihgl7qlgtyzu) that we can align on, ranging from unrestricted to common best practices to restricted.

We should create guidance and buckets for users to adopt PSP policies easily, and mention that these can be customized by users.

@maxsmythe
Copy link
Contributor

It'd be good to do this in a separate library Repo. I think we've graduated to the point where the library should have its own lifecycle.

@tallclair
Copy link
Contributor

I'll take a first pass at adding these to https://github.com/open-policy-agent/gatekeeper-library, based on the spec in https://kubernetes.io/docs/concepts/security/pod-security-standards/

@jsturtevant
Copy link

for anyone landing here, https://github.com/open-policy-agent/gatekeeper/tree/master/library/pod-security-policy is the currently list but is not separated into the buckets from https://kubernetes.io/docs/concepts/security/pod-security-standards/ as of now (privileged, baseline/default, and restricted)

@ritazh
Copy link
Member

ritazh commented Aug 4, 2020

Thanks @jsturtevant! The plan is to move the policies in https://github.com/open-policy-agent/gatekeeper/tree/master/library/pod-security-policy to https://github.com/open-policy-agent/gatekeeper-library within their own buckets. Hopefully we will get to this soon.

@sozercan sozercan transferred this issue from open-policy-agent/gatekeeper Sep 14, 2020
@ritazh
Copy link
Member

ritazh commented Apr 21, 2021

As discussed on the community call, here are some ideas to consider for implementation to support pod security standards:

@maxsmythe
Copy link
Contributor

As discussed on the community call, here are some ideas to consider for implementation to support pod security standards:

We may run into other common use cases for GK policies. Do we want to create a folder to group these into?

gatekeeper-library/policy-packs/pod-security-standards/{privileged,baseline,restricted}

The constraints will have to be purpose-built to implement the relevant standard, so will probably live (and be developed) directly in these folders. How to integrate the templates is an interesting problem. We probably don't want them living side-by-side with constraints because:

  • Users will probably apply multiple tiers of these standards per cluster, we probably don't want to duplicate templates if they do so
  • Users will want to customize these "packs" (adopting that name for "bundle of constraints" for the sake of discussion) to apply to specific namespaces (e.g. "prod" is restricted, "dev" is baseline). That means injecting specific matchers into all constraints in a given pack. We wont want to inject matchers into ConstraintTemplates as that's not a valid thing to do.

How would users consume packs?

Ideally we'd want something where a user can declare "namespace foo is privileged" with a minimum amount of complexity.

The low-level pipeline for that would be:

  • Gather any missing templates
  • Gather the constraints from the appropriate directory
  • Apply a namespace matcher to all the constraints

What would the output device be? Is this going straight to kubectl apply? Or is there some source-of-truth repository the output will be added to? This matters for templates -- without a cluster to query, it's hard to know how we'd detect "missing templates"

kpt is targeted at the use case of "apply a bundle of manifests", kind of like how gomod manages golang packages. That makes it seem a likely way of doing this, though I don't know about the part where we're injecting a matcher into all constraints. A kpt function could do that. I'm not sure if there is one ready-made to help with this.

Another option would be to use what @sozercan suggested, writing our own custom binary, though then we'd need to have a pipeline for hosting/delivering that.

None of the above addresses the template problem. I don't think there is a great prepackaged solution here. Kustomize is tempting, but we'd need to include files outside the Kustomize file's base directory. We probably don't want to put anything inside the template tree, as that couples the "packages" directory with our source code, which will hurt maintainability in the future. If we used the custom binary idea, we could scan the library directory for templates that support the underlying kind as part of a build process.

Another option would be to require the user to add templates manually, that would be a one-time cost. That would sidestep the "missing template" problem.

@stale
Copy link

stale bot commented Feb 1, 2023

This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 1, 2023
@sozercan
Copy link
Member Author

sozercan commented Feb 7, 2023

not stale

@stale stale bot closed this as completed Feb 21, 2023
@sozercan sozercan reopened this Sep 13, 2023
@stale stale bot removed the stale label Sep 13, 2023
Copy link

stale bot commented Nov 12, 2023

This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 12, 2023
@stale stale bot closed this as completed Nov 26, 2023
@sozercan sozercan reopened this Apr 15, 2024
@stale stale bot closed this as completed May 1, 2024
@ritazh ritazh reopened this May 1, 2024
@ritazh ritazh added triaged and removed stale labels May 1, 2024
@JaydipGabani JaydipGabani self-assigned this Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants