Giter VIP home page Giter VIP logo

Comments (3)

tsandall avatar tsandall commented on June 4, 2024 1

@tallclair that's a good idea. Updated the README.

@tallclair also, I realized that the original sample policy I posted was granting access to GET /. You'll want to disable/remove that in your version.

from kube-mgmt.

tsandall avatar tsandall commented on June 4, 2024

It depends on your case, because kube-mgmt may or may not be used to load policy and data. Here are the endpoints.

Policy loading (e.g., policy synching from configmaps implemented here):

  • PUT /v1/policy/<path>
  • DELETE /v1/policy/<path>

Data loading (e.g., k8s resource synching implemented here) :

  • PUT /v1/data/<path>
  • PATCH /v1/data/<path>

The configmap loader also supports data as of recently; someone wanted to be able to load arbitrary data via configmaps 🤷)

Here's a sample based on a common authz policy that many people use. It's not quite least privilege because kube-mgmt could do anything against OPA, but it might be enough for your use case:

package system.authz

# Deny access by default.
default allow = false

# Allow anonymous access to `data.example.response`
# Note: depending on how callers are configured, they may only require this or the default decision below.
allow { input.path = ["v0", "data", "example", "response"]; input.method = "POST" }

# Allow anonymous access to default decision.
allow { input.path = [""]; input.method = "POST" }

# This is only used for health check in liveness and readiness probe
allow { input.path = ["health"]; input.method = "GET" }

# This is only used for prometheus metrics
allow { input.path = ["metrics"]; input.method = "GET" }

# This is used by kube-mgmt to PUT/PATCH against /v1/data and PUT/DELETE against /v1/policies.
# Note: The $TOKEN value is replaced at deploy-time (typically w/ an initContainer) to the actual value
allow { input.identity == "$TOKEN" }

from kube-mgmt.

tallclair avatar tallclair commented on June 4, 2024

Thanks. This addresses my immediate need, but might be useful to put in the README?

from kube-mgmt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.