kube-bench Executor¶
Category: IaC, Containers and Kubernetes
Script: kube_bench.py
Integration: CLI
Faraday Plugin: Raw JSON
Website: aquasecurity/kube-bench
Description¶
Runs kube-bench on the machine where the agent runs to check it against the CIS Kubernetes Benchmark, and imports the failed and warning checks into Faraday as vulnerabilities.
Prerequisites¶
kube-benchinstalled and available in the agent'sPATH(checked withkube-bench version)- The agent must run on a Kubernetes node (control plane or worker), with read access to the Kubernetes configuration files and processes that kube-bench audits
- kube-bench's configuration files (its
cfgdirectory), either in the default location or at the path set inKUBEBENCH_CONFIG_DIR
Configuration¶
Environment Variables (Setup)¶
This executor does not require setup environment variables.
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
KUBEBENCH_BENCHMARK |
string | No | Benchmark version to run (e.g., cis-1.8, eks-1.2.0, gke-1.6.0, aks-1.0). By default kube-bench detects it from the Kubernetes version. |
KUBEBENCH_TARGETS |
list | No | Check groups to run (e.g., ["master", "node", "etcd", "policies", "controlplane"]). By default kube-bench picks the groups for the node type. |
KUBEBENCH_CONFIG_DIR |
string | No | Path to kube-bench's configuration directory (e.g., /etc/kube-bench/cfg) |
YAML Configuration Example¶
executors:
kube_bench:
repo_executor: kube_bench.py
max_size: 65536
varenvs: {}
params:
KUBEBENCH_BENCHMARK:
mandatory: false
type: string
base: string
KUBEBENCH_TARGETS:
mandatory: false
type: list
base: list
KUBEBENCH_CONFIG_DIR:
mandatory: false
type: string
base: string
How It Works¶
- Runs
kube-bench run --jsonwith the configured benchmark, targets and configuration directory - Reads every check result in the JSON output and skips the ones with status
PASSorINFO - Maps each remaining check to a Faraday vulnerability:
- Name:
kube-bench <test number>: <test description> - Severity:
FAILbecomes high andWARNbecomes medium - Description: the test number, status, description and audit command
- Resolution: kube-bench's remediation text
- Name:
- Groups all vulnerabilities under one host named after the agent machine
Notes¶
- The executor creates a single host per run, whose IP and hostname are the hostname of the machine where the agent runs.
- The run fails if kube-bench produces no output.
- The shared agent parameters (
AGENT_CONFIG_*tags and severity filters) are not applied by this executor.