You should have one or more pipelines to build your application from the first workshop part, now we want to secure the build and deployment of it. For the sake of this workshop we’ll take a somewhat simplified use case:
We want to scan our application image for the Red Hat Security Advisory RHSA-2021:4904 concerning openssl-lib.
If this RHSA is found in an image we don’t want to deploy the application.
These are the steps you will go through:
First create a new policy category and the system policy. In the ACS Portal do the following:
Workshop
as Category nameRHSA-2021:4904
into the CVE identifier fieldCurrently there is an issue with persisting the group change to the central instance. As a workaround run this in your Web Terminal zu restart the central instance:
oc delete pod -n stackrox -l app=central
Start the pipeline with the affected image version:
workshop-int
project, start it and set Version to java-old-image
(Remember how we set up this ImageStream
tag
to point to an old and vulnerable version of the image?)To make it easier spotting the violations for this deployment you can filter the list by entering namespace
and then workshop-int
in the filter bar.
Quarkus-Build-Options-Git-Gsklhg-Build-...
) come and go when they are finished.Workshop RHSA-2021:4904
(Check the Time of the violation)There will be other policy violations listed, triggered by default policies, have a look around. Note that none of the policies are enforced (so that the pipeline build would be stopped) yet!
Now start the pipeline with the fixed image version that doesn’t contain the CVE anymore:
openjdk-11-el7
).Workshop RHSA-2021:4904
for your deployment is gone because the image no longer contains itThis shows how ACS is automatically scanning images when they become active against all enabled policies. But we don’t want to just admire a violation after the image has been deployed, we want to disable the deployment during build time! So the next step is to integrate the check into the build pipeline and enforce it (don’t deploy the application).