|
1 | 1 | // Module included in the following assemblies:
|
2 | 2 | //
|
3 |
| -// * security/pod-vulnerabilities-scan.adoc |
| 3 | +// * security/pod-vulnerability-scan.adoc |
4 | 4 |
|
5 | 5 | :_content-type: PROCEDURE
|
6 | 6 | [id="security-pod-scan-cso_{context}"]
|
7 |
| -= Running the {rhq-cso} |
| 7 | += Installing the {rhq-cso} |
8 | 8 |
|
9 |
| -You can start the {rhq-cso} from the {product-title} |
10 |
| -web console by selecting and installing that Operator from the Operator Hub, |
11 |
| -as described here. |
| 9 | +You can install the {rhq-cso} from the {product-title} web console Operator Hub, or by using the CLI. |
12 | 10 |
|
13 | 11 | .Prerequisites
|
14 | 12 |
|
15 |
| -* Have administrator privileges to the {product-title} cluster |
16 |
| -* Have containers that come from a Red Hat Quay or Quay.io registry running on your cluster |
| 13 | +* You have installed the `oc` CLI. |
| 14 | +* You have administrator privileges to the {product-title} cluster. |
| 15 | +* You have containers that come from a Red Hat Quay or Quay.io registry running on your cluster. |
17 | 16 |
|
18 | 17 | .Procedure
|
19 | 18 |
|
20 |
| -. Navigate to *Operators* -> *OperatorHub* and select *Security*. |
| 19 | +. You can install the {rhq-cso} by using the {product-title} web console: |
21 | 20 |
|
22 |
| -. Select the *Container Security* Operator, then select *Install* |
23 |
| -to go to the Create Operator Subscription page. |
| 21 | +.. On the web console, navigate to *Operators* -> *OperatorHub* and select *Security*. |
24 | 22 |
|
25 |
| -. Check the settings. All namespaces and automatic approval strategy are selected, by default. |
| 23 | +.. Select the *{rhq-cso}* Operator, and then select *Install*. |
26 | 24 |
|
27 |
| -. Select *Install*. The *Container Security* Operator appears after a few moments on the *Installed Operators* screen. |
| 25 | +.. On the *{rhq-cso}* page, select *Install*. *Update channel*, *Installation mode*, and *Update approval* are selected automatically. The *Installed Namespace* field defaults to `openshift-operators`. You can adjust these settings as needed. |
28 | 26 |
|
29 |
| -. Optional: You can add custom certificates to the {rhq-cso}. In this example, create a certificate |
30 |
| -named `quay.crt` in the current directory. Then run the following command to add the cert to the {rhq-cso}: |
| 27 | +.. Select *Install*. The *{rhq-cso}* appears after a few moments on the *Installed Operators* page. |
| 28 | + |
| 29 | +.. Optional: You can add custom certificates to the {rhq-cso}. For example, create a certificate named `quay.crt` in the current directory. Then, run the following command to add the custom certificate to the {rhq-cso}: |
31 | 30 | +
|
32 | 31 | [source,terminal]
|
33 | 32 | ----
|
34 | 33 | $ oc create secret generic container-security-operator-extra-certs --from-file=quay.crt -n openshift-operators
|
35 | 34 | ----
|
36 | 35 |
|
37 |
| -. If you added a custom certificate, restart the Operator pod for the new certs to take effect. |
| 36 | +.. Optional: If you added a custom certificate, restart the {rhq-cso} pod for the new certificates to take effect. |
38 | 37 |
|
39 |
| -. Open the OpenShift Dashboard (`Home` -> `Overview`). A link to |
40 |
| -*Quay Image Security* appears under the status section, with a listing of the number |
41 |
| -of vulnerabilities found so far. Select the link to see a *Quay Image Security breakdown*, as shown in the following figure: |
42 |
| -+ |
43 |
| -image:image_security.png[Access image scanning data from {product-title} dashboard] |
| 38 | +. Alternatively, you can install the {rhq-cso} by using the CLI: |
44 | 39 |
|
45 |
| -. You can do one of two things at this point to follow up on any detected vulnerabilities: |
46 |
| -+ |
47 |
| -* Select the link to the vulnerability. You are taken to the container |
48 |
| -registry that the container came |
49 |
| -from, where you can see information about the vulnerability. The following |
50 |
| -figure shows an example of detected vulnerabilities from a Quay.io registry: |
| 40 | +.. Retrieve the latest version of the Container Security Operator and its channel by entering the following command: |
51 | 41 | +
|
52 |
| -image:cso-registry-vulnerable.png[The {rhq-cso} points you to a registry containing the vulnerable image] |
| 42 | +[source,terminal] |
| 43 | +---- |
| 44 | +$ oc get packagemanifests container-security-operator \ |
| 45 | + -o jsonpath='{range .status.channels[*]}{@.currentCSV} {@.name}{"\n"}{end}' \ |
| 46 | + | awk '{print "STARTING_CSV=" $1 " CHANNEL=" $2 }' \ |
| 47 | + | sort -nr \ |
| 48 | + | head -1 |
| 49 | +---- |
53 | 50 | +
|
54 |
| -* Select the namespaces link to go to the *ImageManifestVuln* screen, |
55 |
| -where you can see the name of the selected image |
56 |
| -and all namespaces where that image is running. |
57 |
| -The following figure indicates that a particular vulnerable image |
58 |
| -is running in the `quay-enterprise` namespace: |
| 51 | +.Example output |
59 | 52 | +
|
60 |
| -image:cso-namespace-vulnerable.png[View namespaces a vulnerable image is running in] |
61 |
| - |
62 |
| -At this point, you know what images are vulnerable, what |
63 |
| -you need to do to fix those vulnerabilities, |
64 |
| -and every namespace that the image was run in. So you can: |
| 53 | +[source,terminal] |
| 54 | +---- |
| 55 | +STARTING_CSV=container-security-operator.v3.8.9 CHANNEL=stable-3.8 |
| 56 | +---- |
65 | 57 |
|
66 |
| -* Alert anyone running the image that |
67 |
| -they need to correct the vulnerability |
68 |
| -* Stop the images from running by deleting the deployment |
69 |
| -or other object that started the pod that the image is in |
| 58 | +.. Using the output from the previous command, create a `Subscription` custom resource for the {rhq-cso} and save it as `container-security-operator.yaml`. For example: |
| 59 | ++ |
| 60 | +[source,yaml] |
| 61 | +---- |
| 62 | +apiVersion: operators.coreos.com/v1alpha1 |
| 63 | +kind: Subscription |
| 64 | +metadata: |
| 65 | + name: container-security-operator |
| 66 | + namespace: openshift-operators |
| 67 | +spec: |
| 68 | + channel: ${CHANNEL} <1> |
| 69 | + installPlanApproval: Automatic |
| 70 | + name: container-security-operator |
| 71 | + source: redhat-operators |
| 72 | + sourceNamespace: openshift-marketplace |
| 73 | + startingCSV: ${STARTING_CSV} <2> |
| 74 | +---- |
| 75 | +<1> Specify the value you obtained in the previous step for the `spec.channel` parameter. |
| 76 | +<2> Specify the value you obtained in the previous step for the `spec.startingCSV` parameter. |
70 | 77 |
|
71 |
| -Note that if you do delete the pod, it may take several minutes |
72 |
| -for the vulnerability to reset on the dashboard. |
| 78 | +.. Enter the following command to apply the configuration: |
| 79 | ++ |
| 80 | +[source,terminal] |
| 81 | +---- |
| 82 | +$ oc apply -f container-security-operator.yaml |
| 83 | +---- |
| 84 | ++ |
| 85 | +.Example output |
| 86 | ++ |
| 87 | +[source,terminal] |
| 88 | +---- |
| 89 | +subscription.operators.coreos.com/container-security-operator created |
| 90 | +---- |
0 commit comments