Code Monkey home page Code Monkey logo

cel-approver-policy-plugin's Introduction

cel-approver-policy-plugin

This repo contains an experimental CEL cert-manager/approver-policy plugin that allows to specify CEL expressions used to decide if CertificateRequests can be approved.

Validating CSR attributes with CEL could be considered a core feature in cert-manager/approver-policy, and there are ongoing discussions with the cert-manager maintainers to somehow merge this plugin into the core of approver-policy.

I have no plans to extend the features of this plugin at present, and will not accept pull requests attempting to do so. But please feel free to open an issue or PR (better) for bugs. For any questions or comments feel free to ping me on Kubernetes Slack #cert-manager-dev (@erikgb).

Installation

Plugins are external approvers that are built into approver-policy at compile time.

To install approver-policy with cel-approver-policy-plugin follow the approver-policy installation instructions, but replace the default approver-policy image with an image from this project.

All commits on the default branch will push to ghcr.io/erikgb/cel-approver-policy-plugin:main.

Supported "extra" flags:

  • policy-with-no-plugin-allowed: Whether a CertificateRequestPolicy without cel-approver-policy plugin should be allowed in the cluster

Usage

Example CertificateRequestPolicy that allows issuance if all dnsNames ends with <namespace>.svc or <namespace>.svc.cluster.local:

apiVersion: policy.cert-manager.io/v1alpha1
kind: CertificateRequestPolicy
metadata:
  name: cluster-local-service
spec:
  allowed:
    # Be aware that using a plugin does not disable the core approver
    # A CertificateRequest still has to match the allowed block here even if a plugin is specified
    dnsNames:
      values:
        - "*"
  plugins:
    cel-approver-policy-plugin:
      values:
        dnsNames: >-
          ['.svc', '.svc.cluster.local'].exists(d, self.endsWith(cr.namespace + d))
  selector:
    issuerRef: {}

At this experimental stage, the plugin only supports CEL validation for a couple of commonly used CSR-fields:

  • dnsNames
  • uris

Writing CEL expressions for this plugin

The plugin has access to the same CEL community libraries as Kubernetes:

The following CEL variables are available to use in expressions:

  • self: the string typed value to validate obtained from the decoded CSR
  • cr: a map with selected fields from CertificateRequest; currently namespace and name keys

cel-approver-policy-plugin's People

Contributors

dependabot[bot] avatar erikgb avatar

Watchers

 avatar

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.