Git Product home page Git Product logo

alyragab / rbac-police Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paloaltonetworks/rbac-police

0.0 1.0 0.0 216 KB

Evaluate the RBAC permissions of serviceaccounts, pods and nodes in Kubernetes clusters through policies written in Rego

Home Page: https://www.paloaltonetworks.com/resources/whitepapers/kubernetes-privilege-escalation-excessive-permissions-in-popular-platforms

License: MIT License

Go 62.03% Makefile 0.08% Open Policy Agent 37.89%

rbac-police's Introduction

rbac-police

Retrieve the RBAC permissions of serviceAccounts, pods and nodes in a Kubernetes cluster, and evaluate them using policies written in Rego.

The default policy library includes around 20 policies that identify serviceAccounts, pods and nodes that possess risky permissions, each detecting a different attack path. See the Recommendations section here for advice on addressing powerful permissions in Kubernetes clusters.

Quick Start

Requires Golang>=1.16.

  1. Build rbac-police
go build
  1. Connect kubectl to a Kubernetes cluster.
  2. Evaluate RBAC permissions and identify privilege escalation paths in your cluster using the default policy library.
./rbac-police eval lib/

Use Cases

Evaluate RBAC permissions and identify privilege escalation paths in your cluster.

./rbac-police eval lib/

Set severity threshold

Only evaluate policies with a severity equal to or higher than a threshold.

./rbac-police eval lib/ -s High

Scope to a namespace

Collect and evaluate RBAC permssions in a certain namespace.

./rbac-police eval lib/ -n production

Only alert on SAs that exist on all nodes

Only consider violations from service accounts that exist on all nodes. Useful for identifying violating DaemonSets.

./rbac-police eval lib/ --only-sas-on-all-nodes

Ignore control plane

Ignore control plane pods and nodes in clusters that host the control plane.

./rbac-police eval lib/ --ignore-controlplane

Nodes don't use NodeAuthorizer

Specify a custom user used by nodes in clusters that don't use the NodeAuthorizer.

./rbac-police eval lib/ --node-user=nodeclient

Collect once for multiple evaluations

./rbac-police collect -o rbacDb.json
./rbac-police eval lib/ rbacDb.json -s Critical
./rbac-police eval lib/ rbacDb.json --only-sas-on-all-nodes

Manually inspect RBAC permissions

./rbac-police expand

Or:

./rbac-police collect -o rbacDb.json
./rbac-police expand rbacDb.json

Documentation

Help

Usage:
  rbac-police [command]

Available Commands:
  collect     Collects the RBAC permissions of serviceAccounts, pods and nodes
  completion  Generate the autocompletion script for the specified shell
  eval        Evaulates RBAC permissions of serviceAccounts, pods and nodes using Rego policies
  expand      Presents the RBAC permissions of serviceAccounts, pods and nodes in a human-readable format
  help        Help about any command

Flags:
  -a, --all-serviceaccounts   collect data on all serviceAccounts, not only those assigned to a pod
  -h, --help                  help for rbac-police
      --ignore-controlplane   don't collect data on control plane nodes and pods. Identified by either the 'node-role.kubernetes.io/control-plane' or 'node-role.kubernetes.io/master' labels. ServiceAccounts will not be linked to control plane components
  -l, --loud                  loud mode, print results regardless of -o
  -n, --namespace string      scope collection on serviceAccounts to a namespace
      --node-groups strings   treat nodes as part of these groups (default [system:nodes])
      --node-user string      user assigned to all nodes, default behaviour assumes nodes users are compatible with the NodeAuthorizer
  -o, --out-file string       save results to file

Use "rbac-police [command] --help" for more information about a command.

Media Mentions

Radiohead:

rbac-police, I've given all I can. It's not enough...

N.W.A:

rbac-police comin' straight from the underground!

rbac-police's People

Contributors

yuvalavra 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.