

Rbac-tool gen -generated-type=Role -deny-resources=secrets.,services., -allowed-verbs=* -allowed-groups=,extensions,apps, # Generate a Role policy that allows create, update, get, list (read/write) everything except Secrets, Services, NetworkPolicies in core,Apps and API groups Rbac-tool gen -deny-resources=secrets.,services. Generate a Role policy that allows create, update, get, list (read/write) everything except StatefulSetsĮxamples generated against Kubernetes cluster v1.16 deployed using KIND: # Generate a ClusterRole policy that allows users to read everything except secrets and services.Generate a Role policy that allows create, update, get, list (read/write) everything except Secrets, Services, Ingresses, and NetworkPolicies.Generate a ClusterRole policy that allows users to read everything except secrets and services.Here are some examples that capture how rbac-tool generate can help: Kubernetes RBAC lacks the notion of denying semantics, which means generating an RBAC policy that says “Allow everything except THIS” is not as straightforward as one would imagine. Rbac-tool policy-rules -e '^system:unauth' Examples # List policy rules for system unauthenticated group The command rbac-tool policy-rules aggregates the policies and relationships from the various RBAC resources, and provides a flat view of the allowed permissions for any given User/ServiceAccount/Group. # Who can read a secret resource by the name some-secretĪ Flat and Simple View of RBAC Permissions # Who can read the Kubernetes API endpoint /apis Examples # Who can read ConfigMap resources The command rbac-tool who-can enables operators to simply query which subjects/principals are allowed to perform a certain action based on the presently configured RBAC policies. Query Who Can Perform Certain Kubernetes API Actions Rbac-tool analysis -cluster-context myctx Examples # Analyze the cluster pointed by the kubeconfig context 'myctx' with the internal analysis rule set The command allows the use of a custom analysis rule set, as well as the ability to define custom exceptions (global and per-rule), and can integrate into deployment tools such as GitOps and automation analysis tasks in order to detect undesired permission changes, unexpected drifts, or risky roles. The command rbac-tool analysis analyzes RBAC permissions and highlights overly permissive principals, risky permissions, or any specific permissions that are not desired by cluster operators. Rbac-tool viz -outformat dot -exclude-namespaces=soemns & cat rbac.dot | dot -Tpng > rbac.png & google-chrome rbac.png Rbac-tool viz -cluster-context myctx # Scan and create a PNG image from the graph Examples # Scan the cluster pointed by the kubeconfig context 'myctx' Visualize Cluster RBAC Policies and UsageĪ Kubernetes RBAC command can be used to analyze cluster policies and how they are being used and generate a simple relationship graph.īy default, rbac-tool viz will connect to the local cluster (pointed by kubeconfig) and create a RBAC graph of the actively running workload on all namespaces except kube-system. It is available as a standalone tool or as a kubectl Krew Plugin. InsightCloudSec’s RBAC tool significantly simplifies querying, analyzing, and generating RBAC policies. InsightCloudSec’s RBAC tool is an all-in-one open-source tool for analyzing Kubernetes RBAC policies and simplifying any complexities associated with Kubernetes RBAC. Introducing Your Swiss Army Knife for RBAC Controls This is all quite useful, but Kubernetes RBAC is often viewed as complex and not very user-friendly. RBAC authorization uses the API group to drive authorization decisions, allowing you to dynamically configure policies through the Kubernetes API. Kubernetes Role-Based Access Control (RBAC) is a method of regulating access to computer or network resources based on the roles of individual users within your organization.
