Solve this question on: ssh cks8930
The Vulnerability Scanner trivy is installed on your main terminal. Use it to scan the following images for known CVEs:
Write all images that don't contain the vulnerabilities CVE-2020-10878 or CVE-2020-1967 into /opt/course/21/good-images on cks8930.
First, let's scan each image using trivy and check for the specific CVEs:
➜ ssh cks8930
➜ candidate@cks8930:~# trivy image nginx:1.16.1-alpine | grep -E 'CVE-2020-10878|CVE-2020-1967'
...
│ libcrypto1.1 │ CVE-2020-1967 │ HIGH
│ libssl1.1 │ CVE-2020-1967 │
Scan the Kubernetes components:
➜ candidate@cks8930:~# trivy image k8s.gcr.io/kube-apiserver:v1.18.0 | grep -E 'CVE-2020-10878|CVE-2020-1967'
...
│ │ CVE-2020-10878
➜ candidate@cks8930:~# trivy image k8s.gcr.io/kube-controller-manager:v1.18.0 | grep -E 'CVE-2020-10878|CVE-2020-1967'
...
│ │ CVE-2020-10878
Scan the Weave Net image:
➜ candidate@cks8930:~# trivy image docker.io/weaveworks/weave-kube:2.7.0 | grep -E 'CVE-2020-10878|CVE-2020-1967'
➜ candidate@cks8930:~#
From the scan results, we can see:
Create the output file with the only image that doesn't contain the specified CVEs:
➜ candidate@cks8930:~# echo "docker.io/weaveworks/weave-kube:2.7.0" > /opt/course/21/good-images
Verify the contents:
➜ candidate@cks8930:~# cat /opt/course/21/good-images
docker.io/weaveworks/weave-kube:2.7.0