Appendix D: Tool Guide
In Chapter 0 you install around thirty tools in one go. This appendix
tells you what each of them is, what you need it for in the lab and in
which chapter it is first put to serious use. Each group comes with a
few typical commands. They use the lab conventions from Chapter 0: build
registry localhost:5001, target registry
localhost:5002, sample application
demo-app.
Remember: Almost everything you install with Homebrew is a command-line client.
kyvernoandargocdon your laptop do not install anything in the cluster. You set up the in-cluster counterparts (Kyverno controller, Argo CD) in Chapter 9 and Chapter 1 respectively, withhelmorkubectl.
How the tools work together
Together, the tools form a chain from source code to the cluster. Each station checks or proves something before the artifact moves on:
Station Question Tools
─────────────── ───────────────────────────── ───────────────────────
Source code Insecure code, secrets? semgrep, gitleaks
Configuration IaC clean, rules met? checkov, conftest, opa
Build Reproducible, documented? docker buildx
Image What is inside? syft (SBOM)
Scan Known vulnerabilities? grype, trivy
Sign Is it genuine? cosign
Transfer Unchanged in target zone? skopeo, crane, oras
Cluster May it run? kyverno, argocd
Group 1: Basic craft for containers and Kubernetes
brew install kind kubectl helm git jq yq curl openssl| Tool | What it is | What it is for in the lab | Chapter |
|---|---|---|---|
| kind | Kubernetes in Docker | Local cluster as the target zone | 0 |
| kubectl | Kubernetes CLI | Manage Pods, Deployments, Services | all |
| helm | Package manager for Kubernetes | Install Kyverno, Gatekeeper and others | 6, 9 |
| git | Version control | Code, pipelines, GitOps repos | all |
| jq | JSON processor | Evaluate scan reports, SBOMs, API responses | all |
| yq | YAML processor | Read and change manifests and values | 2, 10 |
| curl | HTTP client | REST APIs of Nexus, Vault, registries | all |
| openssl | Cryptography toolkit | Own CA, inspect certificates and keys | 4, 5 |
Typical commands:
kind create cluster --name seclab --config ~/seclab/kind.yaml
kubectl get pods -A # everything that is running
kubectl get pods -A -o json | jq -r '.items[].metadata.name'
yq '.spec.template.spec.containers[].image' k8s/deployment.yaml
openssl x509 -in ca.crt -noout -subject -enddate # inspect a certificateTip:
jqandyqare the unsung heroes of this book. Almost every security tool speaks JSON or YAML. If you master both, you can evaluate any scan in a single line.
Group 2: Scanning, inventorying, signing
brew install cosign syft grype trivy checkov semgrep gitleaks| Tool | What it is | What it is for in the lab | Chapter |
|---|---|---|---|
| cosign | Signing tool (Sigstore) | Sign and verify images offline | 5 |
| syft | SBOM generator | Inventory of all packages in an image | 7 |
| grype | Vulnerability scanner | Find CVEs in images and SBOMs | 7 |
| trivy | All-round scanner | Images, file systems, IaC, secrets | 2, 8 |
| checkov | IaC scanner | Check Kubernetes YAML, Dockerfiles, Terraform | 8 |
| semgrep | Static code analysis (SAST) | Find dangerous patterns in source code | 8 |
| gitleaks | Secret scanner | Find passwords and tokens in the Git history | 6, 8 |
Typical commands:
syft localhost:5001/demo-app:1.0.0 -o cyclonedx-json=sbom.cdx.json
grype sbom:./sbom.cdx.json --only-fixed # only fixable findings
trivy image --severity HIGH,CRITICAL localhost:5001/demo-app:1.0.0
trivy config . # IaC misconfigurations
checkov -d k8s/ --compact --quiet
semgrep scan --config p/python --metrics=off .
gitleaks git . -v # entire Git history
cosign verify --key cosign.pub --insecure-ignore-tlog=true "$IMAGE"Warning: semgrep downloads rule sets like
p/pythonfrom the internet.--metrics=offprevents usage data from being sent to the vendor in the process. In isolated environments, you use your own rule files (Chapter 8).
Group 3: Registries, policies and GitOps
brew install skopeo oras crane kyverno conftest opa argocd| Tool | What it is | What it is for in the lab | Chapter |
|---|---|---|---|
| skopeo | Image copier without a Docker daemon | Transfer images between zones | 3, 4 |
| crane | Lean registry client | Query digests, manifests, tags | 3, 4, 5 |
| oras | Client for arbitrary OCI artifacts | Signatures, SBOMs and bundles in registries | 4, 5, 8 |
| kyverno | Kyverno CLI | Test Kubernetes policies locally | 9 |
| conftest | Policy tester based on OPA | Check YAML, Dockerfiles, JSON with Rego | 9 |
| opa | Open Policy Agent | Evaluate, test, format Rego policies | 9 |
| argocd | Argo CD CLI | Sync GitOps applications | 1, 11 |
Typical commands:
crane digest localhost:5001/demo-app:1.0.0 # get the digest
skopeo copy --all --preserve-digests \
--src-tls-verify=false --dest-tls-verify=false \
docker://localhost:5001/demo-app:1.0.0 \
docker://localhost:5002/demo-app:1.0.0
oras push --plain-http localhost:5001/bundles/policy:1.0 policy.tar.gz
kyverno apply policies/ --resource beispiele/schlecht.yaml
conftest test k8s/deployment.yaml -p policy/
opa eval -d policy/ -i input.json 'data.main.deny'
argocd app sync demo-appAlso in the lab
| Tool | What it is | What it is for in the lab | Chapter |
|---|---|---|---|
| Docker / Colima | Container runtime | Everything that runs in containers | all |
| docker buildx | Extended image builder | Reproducible builds, provenance | 2 |
| vault (or bao) | Secrets management | Issue, rotate, revoke secrets | 6 |
| gitlab-runner | CI executor (as a container) | Run pipelines from GitLab | 1 |
Who does what? The overlaps
Some tools seem to do the same thing. In practice they have different strengths, and the overlap itself is useful: two scanners with different databases find more than one.
| Area | Tools | Difference |
|---|---|---|
| Vulnerabilities | grype / trivy | grype: specialized in CVEs, ideal with an SBOM. trivy: broader, also scans IaC and secrets |
| SBOM | syft / trivy | syft: specialized in SBOMs. trivy can generate SBOMs and scan them right away |
| IaC | checkov / trivy config | checkov: larger rule set for IaC. trivy: one tool for many things |
| Code | semgrep / gitleaks | semgrep: insecure code patterns. gitleaks: accidentally committed secrets |
| Registry | skopeo / crane / oras | skopeo: transfer images. crane: query the registry. oras: non-image artifacts |
| Policies | opa / conftest / kyverno | opa: general-purpose engine. conftest: check files in CI. kyverno: Kubernetes-native, without Rego |
Remember: You do not have to master every tool in your sleep. What matters is that you can use one confidently for each station of the chain and know which tool answers which question: What is inside? (syft), Is it vulnerable? (grype, trivy), Is it genuine? (cosign), May it run? (kyverno, opa).