2.2. Configuring the ScanSettingBinding object
By creating a ScanSettingBinding object in the openshift-compliance namespace, you can scan your cluster by using the cis and cis-node profiles either from the command-line interface (CLI) or user interface (UI).
This example uses ocp4-cis and ocp4-cis-node profiles, but OpenShift Container Platform provides additional profiles.
For more information, see "Understanding the Compliance Operator".
Prerequisites
- You have installed the Compliance Operator.
Procedure
To create the
ScanSettingBindingobject from the CLI, perform the following steps:Create a file named
sscan.yamlby using the following content:apiVersion: compliance.openshift.io/v1alpha1 kind: ScanSettingBinding metadata: name: cis-compliance profiles: - name: ocp4-cis-node kind: Profile apiGroup: compliance.openshift.io/v1alpha1 - name: ocp4-cis kind: Profile apiGroup: compliance.openshift.io/v1alpha1 settingsRef: name: default kind: ScanSetting apiGroup: compliance.openshift.io/v1alpha1Create the
ScanSettingBindingobject by running the following command:$ oc create -f sscan.yaml -n openshift-complianceIf successful, the following message is displayed:
$ scansettingbinding.compliance.openshift.io/cis-compliance created
To create the
ScanSettingBindingobject from the UI, perform the following steps:-
Change the active project to
openshift-compliance. - Click + to open the Import YAML page.
- Paste the YAML from the previous example, and then click Create.
-
Change the active project to
Verification
Run a compliance scan in RHACS.
For more information about how to run a compliance scan by using the compliance feature, see "Checking the compliance status of your infrastructure".
-
Ensure that
ocp4-cisandocp4-cis-noderesults are displayed.
If you are using the CLI, you can view the compliance scan results from the dashboard page.
For more information about how to view the compliance scan results from the dashboard page, see "Viewing the compliance standards across your environment".
If you are using the UI, you can view the compliance scan results from both the dashboard and coverage page.
For more information about how to view the compliance scan results from the coverage page, see "Assessing the profile compliance across clusters".