Kubescape Executor¶
Category: IaC, Containers and Kubernetes
Script: kubescape.py
Integration: CLI
Faraday Plugin: KubescapePlugin
Website: https://kubescape.io/
Description¶
Runs a Kubescape posture scan against a Kubernetes cluster or local manifest files and imports the failed controls into Faraday. You can scan with all frameworks, a single framework, or a single control.
Prerequisites¶
kubescapeinstalled and available in the agent'sPATH(checked withkubescape version)- To scan a live cluster: a kubeconfig file readable by the agent, with permission to read the cluster's resources
- To scan manifests: the YAML files readable by the agent (for Docker deployments, mount them into the container)
Configuration¶
Environment Variables (Setup)¶
This executor does not require setup environment variables.
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
KUBESCAPE_SCAN_TARGET |
string | No | What to scan: cluster (all default frameworks), framework (the framework in KUBESCAPE_FRAMEWORK) or control (the control in KUBESCAPE_CONTROL_ID). Default: cluster. |
KUBESCAPE_FRAMEWORK |
string | No | Framework to use when KUBESCAPE_SCAN_TARGET is framework, e.g. nsa, mitre, cis, armobest, devopsbest, soc2 (default: nsa) |
KUBESCAPE_CONTROL_ID |
string | No | Control to run when KUBESCAPE_SCAN_TARGET is control (e.g., C-0001). Required in that mode. |
KUBESCAPE_KUBECONFIG |
string | No | Path to the kubeconfig file used to reach the cluster (e.g., /root/.kube/config). By default Kubescape uses its standard kubeconfig lookup. |
KUBESCAPE_MANIFEST_PATH |
string | No | Path to a YAML file or directory to scan instead of the live cluster (e.g., /manifests/) |
YAML Configuration Example¶
executors:
kubescape:
repo_executor: kubescape.py
max_size: 65536
varenvs: {}
params:
KUBESCAPE_SCAN_TARGET:
mandatory: false
type: string
base: string
KUBESCAPE_FRAMEWORK:
mandatory: false
type: string
base: string
KUBESCAPE_CONTROL_ID:
mandatory: false
type: string
base: string
KUBESCAPE_KUBECONFIG:
mandatory: false
type: string
base: string
KUBESCAPE_MANIFEST_PATH:
mandatory: false
type: string
base: string
How It Works¶
- Builds a
kubescape scancommand for the selected target: the whole cluster,framework <name>orcontrol <id> - Adds
KUBESCAPE_MANIFEST_PATHas the scan input when it is set, and--kubeconfigwhenKUBESCAPE_KUBECONFIGis set - Runs the scan with JSON output to a temporary file
- Parses the report with
KubescapePluginand sends the results to Faraday
Notes¶
- An invalid
KUBESCAPE_SCAN_TARGET, orcontrolwithoutKUBESCAPE_CONTROL_ID, stops the run. KUBESCAPE_FRAMEWORKis ignored unlessKUBESCAPE_SCAN_TARGETisframework.- The run fails if Kubescape does not write a report.
- Supports the shared agent parameters (
AGENT_CONFIG_*tags and severity filters).