Local Quick Start
Get started locally with Docker Compose.
Prerequisites
It is assumed that you have if you haven't already.
Run Krane locally
Krane depends on RedisGraph. docker-compose stack defines all what's required to build and run Krane service locally. It'll also take care of its for details.
In CI/CD pipeline
To validate RBAC definition as a step in CI/CD pipeline
krane report --ci -d </path/to/rbac-directory>
NOTE: Krane expects certain naming convention to be followed for locally stored RBAC resource files. See docker image.
CI mode is enabled by --ci flag. Krane will return non zero status code along with details of breaking risk rules when one or more dangers have been detected.
Visualisation Dashboard
To view RBAC facets tree, network graph and latest report findings you need to start dashboard server first.
krane dashboard
Cluster flag -c <cluster-name> may be passed if you want to run the dashboard against specific cluster name. Dashboard will look for data related to specified cluster name which is cached on the file system.
Command above will start local web server on default port 8000, and display the dashboard link.
Architecture
RBAC Data indexed in a local Graph database
Krane indexes RBAC entites in RedisGraph. This allows us to query network of dependencies efficiently and simply using subset of .
Schema
template. Requires writer to be defined. writer - Writer is a Ruby expression used to format query result set. Writer has precedence over template.template - Built-in query/writer template name. If query & writer are not specified then chosen query generator will be used along with matching writer.Risk Rule attributes
Rule can contain any of the following attributes:
-
id[Required] Rule id is a unique rule identifier. -
group_title[Required] Title applying to all items falling under this risk check. -
severity[Required] Severity, as one of :danger, :warning, :info. -
info[Required] Textual information about the check and suggestions on how to mitigate the risk. -
query[Conditonal] .
custom_params [Optional] List of custom key-value pairs to be evaluated and replaced in a rule query and writer representation.
- Example: Template placeholders for the keys aboveCODE
custom_params:
- attrA: valueA
- attrB: valueB{{attrA}}and{{attrB}}will be replaced withvalueAandvalueBrespectively.
threshold [Optional] Numeric value. When definied this will become available as template placeholder {{threshold}} in the writer expression.
macro [Optional] Reference to common parameters defined in a named macro.
disabled [Optional] When set to true it'll disable given rule and exclude it from evaluation. By default all rules are enabled.
Risk Rule examples
Explicit query & writer expression
- id: verbose-rule-example
group_title: Example rule
severity: :danger
info: Risk description and instructions on how to mitigate it goes here
query: |
MATCH
(s:Subject)-[:ACCESS]->(ns:Namespace)
WHERE
NOT s.name IN {{whitelist_subject_names}}
RETURN
s.kind as subject_kind,
s.name as subject_name,
COLLECT(ns.name) as namespace_names
ORDER BY
subject_kind,
subject_name,
namespace_names DESC
threshold: 2
writer: |
if result.namespace_names.count > {{threshold}}
"#{result.subject_kind} #{result.subject_name} can access namespaces: #{result.namespace_names.join(', ')}"
end
disabled: trueThe example above explicitly defines a graph query which is used to evaluate RBAC risk, and a writer expression used to format query result set. The query simply selects all Subjects (excluding whitelisted) and Namespaces to which they have access to. Note that the result set will only include Subjects having access to more than 2 values defined for a given rule id. If a placeholder field name is not defined in the whitelist it'll be substituted with an empty array [''] by default. Read more on file and divided into three separate sections:
global- Top level scope. Custom attributes defined here will apply to all Risk Rules regardless of the cluster name.common- Custom attributes will be scoped to specific Risk Ruleidregardless of the cluster name.cluster(with nested list of cluster names) - Custom attributes will apply to specific Risk Ruleidfor a given cluster name.
Each with id attribute value matching "some-risk-rule-id"
{{whitelist_role_names}} => ['acp:prometheus:operator']
{{whitelist_subject_names}} => ['privileged-psp-user', 'another-user']
The placeholder keys above, when used in the custom graph queries, will be replaced by their respective values upon Risk Rule evaluation.
Example:
---
rules:
global: # global scope - applies to all risk rule and cluster names
whitelist_role_names: # custom attribute name
- acp:prometheus:operator # custom attribute values
common: # common scope - applies to specific risk rule id regardless of cluster name
some-risk-rule-id: # this corresponds to risk rule id defined in config/rules.yaml
whitelist_subject_names: # custom attribute name
- privileged-psp-user # custom attribute values
cluster: # cluster scope - applies to speciifc risk rule id and cluster name
default: # example cluster name
some-risk-rule-id: # risk rule id
whitelist_subject_names: # custom attribute nane
- another-user # custom attribute valuesKubernetes Deployment
Krane can be deployed to a local or remote Kubernetes clusters easily.
K8s Prerequisites
Kubernetes namespace, service account along with appropriate RBAC must be present in the cluster. See the which waits for RedisGraph instance to become available before starting RBAC report loop and dashboard web server.
You may control certain aspects of in-cluster execution with the following environment variables:
KRANE_REPORT_INTERVAL- Defines interval in seconds for RBAC static analysis report run. Default:300(in seconds, i.e. 5 minutes).KRANE_REPORT_OUTPUT- Defines RBAC risk report output format. Possible values:json,:yaml,:none. Default::json.
Local or Remote K8s Cluster
If your K8s cluster comes with built-in command:
docker stack deploy \
--orchestrator kubernetes \
--namespace krane \
--compose-file docker-compose.yml \
--compose-file docker-compose.k8s.yml krane
Note: Make sure your current kube context is set correctly prior to running the command above!
The application Stack should be now deployed to a Kubernetes cluster and all services ready and exposed. Note that Krane will automatically start its report loop and dashboard server.
$ docker stack services --orchestrator kubernetes --namespace krane krane
ID NAME MODE REPLICAS IMAGE PORTS
0de30651-dd5 krane_redisgraph replicated 1/1 redislabs/redisgraph:1.99.7 *:6379->6379/tcp
aa377a5f-62b krane_krane replicated 1/1 quay.io/appvia/krane:latest *:8000->8000/tcp
Check your Kubernetes cluster RBAC security posture by visiting
http://localhost:8000
Note that for remote cluster deployments you'll likely need to port-forward Krane service first
kubectl --context=my-remote-cluster --namespace=krane port-forward svc/krane 8000
To delete the Stack
docker stack rm krane \
--orchestrator kubernetes \
--namespace krane
Alternatively, deploy with directory.
Modify manifests as required for your deployments making sure you reference the correct version of Krane docker image in its for available tags, or just use latest.
Notifications
Krane will notify you about detected anomalies of medium and high severity via its Slack integration.
To enable notifications specify Slack webhook_url & channel in the . docker-compose is the quickest way to get Krane's dependencies running locally.
docker-compose up -d redisgraph
To inspect RedisGraph service is up:
docker-compose ps
To stop services:
docker-compose down
Development
At this point you should be able to modify Krane codebase and test results by invoking commands in local shell.
./bin/krane --help # to get help
./bin/krane report -k docker-desktop # to generate your first report for
# local docker-desktop k8s cluster
...To enable Dashboard UI local development mode
cd dashboard
npm install
npm start
This will automatically start the Dashboard server, open default browser and watch for source files changes.
Krane comes preconfigured for improved developer experience with guide for more information on how to get started. If you use Krane, find it useful, or are generally interested in Kubernetes security then please let us know by Starring and Watching this repo. Thanks!
Community
//TODO
Roadmap
See our
Community-Analysen & Experten-Meinungen 0
Verwandte Story-Cluster & Quellen (Vektor-KI)
Ähnliche Beiträge
Auch interessante Nachrichten Krane - Kubernetes RBAC Static Analysis And Visualisation Tool
Thematisch verwandte Begriffe: Krane, Kubernetes, RBAC, Static · 6 Treffer
UPDATE: DFN-CERT-2026-4860 rsync: Mehrere Schwachstellen ermöglichen u. a. das ...
Massive Elektro-Probleme: Audi A4 E-tron auf neuer SSP erneut verschoben – ID Golf gleich mit
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
SOCIAL SHARE CARD GENERATOR