File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ ## Install bom cli
2+ ```
3+ wget https://github.com/kubernetes-sigs/bom/releases/download/v0.6.0/bom-amd64-linux
4+ chmod +x bom-amd64-linux
5+ sudo mv bom-amd64-linux /usr/local/bin/bom
6+ ```
7+ ## Use bom to generate sbom for controller manager image
8+ ```
9+ bom generate spdx-json \
10+ --image registry.k8s.io/kube-controller-manager:v1.32.0 \
11+ --output ./sbom1.json
12+
13+ ```
14+
15+ ## Install trivy
16+ ```
17+ curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh
18+ sudo mv bin/trivy /usr/local/bin
19+
20+ trivy image --format cyclonedx \
21+ --output ./sbom2.json \
22+ registry.k8s.io/kube-controller-manager:v1.32.0
23+
24+ ```
25+
26+ ## Use trivy
27+ ```
28+ trivy sbom ./sbom1.json --format json --output ./sbom_check_result.json
29+ cat sbom_check_result.json | jq
30+ trivy sbom ./sbom2.json
31+ ```
32+
33+ ### Use Trivy for Kubernetes deployments
34+ ```
35+ kubectl run p1 --image=nginx
36+ kubectl run p2 --image=httpd
37+ kubectl run p3 --image=alpine -- sleep 1000
38+ kubectl get pods -o=jsonpath='{range.items[*]}{"\n"}{.metadata.name}{":\t"}{range.spec.containers[*]}{.image}{","}{end}{end}' |sort
39+ trivy image --severity HIGH,CRITICAL nginx
40+ trivy image --severity HIGH,CRITICAL httpd
41+ trivy image --severity HIGH,CRITICAL alpine
42+ echo p1 $'\n'p2 > /tmp/badimages.txt
43+ ```
You can’t perform that action at this time.
0 commit comments