Giter Club home page Giter Club logo

lula's Introduction

Lula - The Kubernetes Compliance Engine

lula is a tool written to bridge the gap between expected configuration required for compliance and actual configuration.

Cloud Native Infrastructure, Platforms, and applications can establish OSCAL documents that live beside source-of-truth code bases. Providing an inheritance model for when a control that the technology can satisfy IS satisfied in a live-environment.

This can be well established and regulated standards such as NIST 800-53. It can also be best practices, Enterprise Standards, or simply team development standards that need to be continuously monitored and validated.

How does it work?

The primary functionality is leveraging Kyverno CLI/Engine. lula:

  • Ingests a oscal-component.yaml and creates an object in memory
  • Queries all implemented-requirements for a rules field
  • If a rules field exists:
    • Generate a ClusterPolicy resource on the filesystem
    • Execute the applyCommandHelper function from Kyverno CLI
      • This will return the number of passing/failing resources in the cluster (or optionally static manifests on the filesystem)
      • If any fail, given valid exclusions that may be present, the control is declared as Fail
    • Remove ClusterPolicy from the filesystem
    • This is done for each implemented-requirement that has a rules field
  • Generate a report of the findings (Pass or fail for each control) on the filesystem (optional - can be run with --dry-run in order to not write to filesystem)

Getting Started

Demo

Static Manifest Demo

Resource Demo

Live Cluster Demo

Cluster Demo

Try it out

Dependencies

  • A running Kubernetes cluster
  • GoLang version 1.19.1

Steps

  1. Clone the repository to your local machine and change into the lula directory

    git clone https://github.com/defenseunicorns/lula.git && cd lula
  2. While in the lula directory, compile the tool into an executable binary. This outputs the lula binary to the current working directory.

    go build .
  3. Apply the ./demo/namespace.yaml file to create a namespace for the demo

    kubectl apply -f ./demo/namespace.yaml
  4. Apply the ./demo/pod.fail.yaml to create a pod in your cluster

    kubectl apply -f ./demo/pod.fail.yaml
  5. Run the following command in the lula directory:

    ./lula validate ./demo/oscal-component.yaml

    The output in your terminal should inform you that there is at least one failing pod in the cluster:

    Applying 1 policy rule to 19 resources...
    
    policy 42c2ffdc-5f05-44df-a67f-eec8660aeffd -> resource foo/Pod/demo-pod failed: 
    1. ID-1: validation error: Every pod in namespace 'foo' should have 'foo=bar' label. rule ID-1 failed at path /metadata/labels/foo/ 
    UUID: 42C2FFDC-5F05-44DF-A67F-EEC8660AEFFD
            Resources Passing: 0
            Resources Failing: 1
            Status: Fail
  6. Now, apply the ./demo/pod.pass.yaml file to your cluster to configure the pod to pass compliance validation:

    kubectl apply -f ./demo/pod.pass.yaml
  7. Run the following command in the lula directory:

    ./lula validate ./demo/oscal-component.yaml

    The output should now show the pod as passing the compliance requirement:

    Applying 1 policy rule to 19 resources...
    UUID: 42C2FFDC-5F05-44DF-A67F-EEC8660AEFFD
            Resources Passing: 1
            Resources Failing: 0
            Status: Pass

Future Extensibility

  • Support for cloud infrastructure state queries
  • Support for API validation

Developing

  • Go 1.19

lula's People

Contributors

brandtkeller avatar corang avatar michael-kruggel avatar hennersz avatar lucasrod16 avatar aj-stein-nist avatar overflow0xffff avatar liquidsaul 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.