@@ -89,7 +89,111 @@ $ cat /tmp/audit.json | jq '.Metadata'
8989
9090```
9191
92- So, we have seen how to install Trivy and how to use it to scan the juice shop container image. Thank
93- you for reading.
92+ We can also use Trivy check kubernetes configuration files and docker files for misconfiguration.
93+ ```
94+ $ trivy config .
95+ 2021-08-20T14:27:48.418+0530 INFO Need to update the built-in policies
96+ 2021-08-20T14:27:48.418+0530 INFO Downloading the built-in policies...
97+ 2021-08-20T14:29:31.874+0530 INFO Detected config files: 4
98+
99+ Dockerfile (dockerfile)
100+ =======================
101+ Tests: 23 (SUCCESSES: 23, FAILURES: 0, EXCEPTIONS: 0)
102+ Failures: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
103+
104+
105+ juice-shop-deploy.yaml (kubernetes)
106+ ===================================
107+ Tests: 28 (SUCCESSES: 17, FAILURES: 11, EXCEPTIONS: 0)
108+ Failures: 11 (UNKNOWN: 0, LOW: 6, MEDIUM: 5, HIGH: 0, CRITICAL: 0)
109+
110+ +---------------------------+------------+----------------------------------------+----------+--------------------------------------------+
111+ | TYPE | MISCONF ID | CHECK | SEVERITY | MESSAGE |
112+ +---------------------------+------------+----------------------------------------+----------+--------------------------------------------+
113+ | Kubernetes Security Check | KSV001 | Process can elevate its own privileges | MEDIUM | Container 'juice-shop' of |
114+ | | | | | Deployment 'juice-shop' should set |
115+ | | | | | 'securityContext.allowPrivilegeEscalation' |
116+ | | | | | to false |
117+ | | | | | -->avd.aquasec.com/appshield/ksv001 |
118+ + +------------+----------------------------------------+----------+--------------------------------------------+
119+ | | KSV003 | Default capabilities not dropped | LOW | Container 'juice-shop' of Deployment |
120+ | | | | | 'juice-shop' should add 'ALL' to |
121+ | | | | | 'securityContext.capabilities.drop' |
122+ | | | | | -->avd.aquasec.com/appshield/ksv003 |
123+ + +------------+----------------------------------------+ +--------------------------------------------+
124+ | | KSV011 | CPU not limited | | Container 'juice-shop' of |
125+ | | | | | Deployment 'juice-shop' should |
126+ | | | | | set 'resources.limits.cpu' |
127+ | | | | | -->avd.aquasec.com/appshield/ksv011 |
128+ + +------------+----------------------------------------+----------+--------------------------------------------+
129+ | | KSV012 | Runs as root user | MEDIUM | Container 'juice-shop' of |
130+ | | | | | Deployment 'juice-shop' should set |
131+ | | | | | 'securityContext.runAsNonRoot' to true |
132+ | | | | | -->avd.aquasec.com/appshield/ksv012 |
133+ + +------------+----------------------------------------+----------+--------------------------------------------+
134+ | | KSV014 | Root file system is not read-only | LOW | Container 'juice-shop' of |
135+ | | | | | Deployment 'juice-shop' should set |
136+ | | | | | 'securityContext.readOnlyRootFilesystem' |
137+ | | | | | to true |
138+ | | | | | -->avd.aquasec.com/appshield/ksv014 |
139+ + +------------+----------------------------------------+ +--------------------------------------------+
140+ | | KSV015 | CPU requests not specified | | Container 'juice-shop' of |
141+ | | | | | Deployment 'juice-shop' should |
142+ | | | | | set 'resources.requests.cpu' |
143+ | | | | | -->avd.aquasec.com/appshield/ksv015 |
144+ + +------------+----------------------------------------+ +--------------------------------------------+
145+ | | KSV016 | Memory requests not specified | | Container 'juice-shop' of |
146+ | | | | | Deployment 'juice-shop' should |
147+ | | | | | set 'resources.requests.memory' |
148+ | | | | | -->avd.aquasec.com/appshield/ksv016 |
149+ + +------------+----------------------------------------+ +--------------------------------------------+
150+ | | KSV018 | Memory not limited | | Container 'juice-shop' of |
151+ | | | | | Deployment 'juice-shop' should |
152+ | | | | | set 'resources.limits.memory' |
153+ | | | | | -->avd.aquasec.com/appshield/ksv018 |
154+ + +------------+----------------------------------------+----------+--------------------------------------------+
155+ | | KSV019 | Seccomp policies disabled | MEDIUM | Container 'juice-shop' of |
156+ | | | | | Deployment 'juice-shop' should |
157+ | | | | | specify a seccomp profile |
158+ | | | | | -->avd.aquasec.com/appshield/ksv019 |
159+ + +------------+----------------------------------------+ +--------------------------------------------+
160+ | | KSV020 | Runs with low user ID | | Container 'juice-shop' of |
161+ | | | | | Deployment 'juice-shop' should set |
162+ | | | | | 'securityContext.runAsUser' > 10000 |
163+ | | | | | -->avd.aquasec.com/appshield/ksv020 |
164+ + +------------+----------------------------------------+ +--------------------------------------------+
165+ | | KSV021 | Runs with low group ID | | Container 'juice-shop' of |
166+ | | | | | Deployment 'juice-shop' should set |
167+ | | | | | 'securityContext.runAsGroup' > 10000 |
168+ | | | | | -->avd.aquasec.com/appshield/ksv021 |
169+ +---------------------------+------------+----------------------------------------+----------+--------------------------------------------+
170+
171+ juice-shop-svc.yaml (kubernetes)
172+ ================================
173+ Tests: 28 (SUCCESSES: 28, FAILURES: 0, EXCEPTIONS: 0)
174+ Failures: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
175+
176+
177+ test/smoke/Dockerfile (dockerfile)
178+ ==================================
179+ Tests: 23 (SUCCESSES: 21, FAILURES: 2, EXCEPTIONS: 0)
180+ Failures: 2 (UNKNOWN: 0, LOW: 0, MEDIUM: 1, HIGH: 1, CRITICAL: 0)
181+
182+ +---------------------------+------------+--------------------+----------+------------------------------------------+
183+ | TYPE | MISCONF ID | CHECK | SEVERITY | MESSAGE |
184+ +---------------------------+------------+--------------------+----------+------------------------------------------+
185+ | Dockerfile Security Check | DS001 | ':latest' tag used | MEDIUM | Specify a tag in the 'FROM' |
186+ | | | | | statement for image 'alpine' |
187+ | | | | | -->avd.aquasec.com/appshield/ds001 |
188+ + +------------+--------------------+----------+------------------------------------------+
189+ | | DS002 | root user | HIGH | Specify at least 1 USER |
190+ | | | | | command in Dockerfile with |
191+ | | | | | non-root user as argument |
192+ | | | | | -->avd.aquasec.com/appshield/ds002 |
193+ +---------------------------+------------+--------------------+----------+------------------------------------------+
194+ ```
195+
196+ So, we have seen how to install Trivy and how to use it to scan the juice shop container image and
197+ check misconfigurations in files. Thank you for reading.
94198
95199--end-of-post--
0 commit comments