Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 5. Compliance Operator
5.1. Compliance Operator overview Link kopierenLink in die Zwischenablage kopiert!
The OpenShift Container Platform Compliance Operator assists users by automating the inspection of numerous technical implementations and compares those against certain aspects of industry standards, benchmarks, and baselines; the Compliance Operator is not an auditor. In order to be compliant or certified under these various standards, you need to engage an authorized auditor such as a Qualified Security Assessor (QSA), Joint Authorization Board (JAB), or other industry recognized regulatory authority to assess your environment.
The Compliance Operator makes recommendations based on generally available information and practices regarding such standards and may assist with remediations, but actual compliance is your responsibility. You are required to work with an authorized auditor to achieve compliance with a standard. For the latest updates, see the Compliance Operator release notes. For more information on compliance support for all Red Hat products, see Product Compliance.
5.1.1. Compliance Operator concepts Link kopierenLink in die Zwischenablage kopiert!
5.1.2. Compliance Operator management Link kopierenLink in die Zwischenablage kopiert!
Installing the Compliance Operator
Updating the Compliance Operator
5.1.3. Compliance Operator scan management Link kopierenLink in die Zwischenablage kopiert!
Tailoring the Compliance Operator
Retrieving Compliance Operator raw results
Managing Compliance Operator remediation
Performing advanced Compliance Operator tasks
5.2. Compliance Operator release notes Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator lets OpenShift Container Platform administrators describe the required compliance state of a cluster and provides them with an overview of gaps and ways to remediate them.
These release notes track the development of the Compliance Operator in the OpenShift Container Platform.
For an overview of the Compliance Operator, see Understanding the Compliance Operator.
To access the latest release, see Updating the Compliance Operator.
For more information on compliance support for all Red Hat products, see Product Compliance.
5.2.1. OpenShift Compliance Operator 1.8.1 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.8.1:
5.2.1.1. Bug Fixes Link kopierenLink in die Zwischenablage kopiert!
-
Before this release, Compliance Operator could cause a privilege escalation due to incorrect permissions on . With this release, the permissions have been corrected. For more information, see (CVE-2025-7195).
/etc/passwd -
Previously, Compliance Operator scans using rhcos4 profile would incorrectly return scan results when using Red Hat Enterprise Linux CoreOS (RHCOS) 10 systems. With this release, scans using rhcos4 profiles return
NOT-APPLICABLEandCOMPLIANTresults. For more information, see (CMP-4034).NON-COMPLIANT
5.2.2. OpenShift Compliance Operator 1.8.0 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.8.0:
5.2.2.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
-
With this update, the Compliance Operator provides the Common Expression Language (CEL) scanner in TECH PREVIEW status. The CEL scanner implements a new Custom Resource Definition (CRD) that allows administrators to define and enforce custom security policies using CEL expressions. This new content format does not replace the existing XCCDF (Extensible Configuration Checklist Description Format) profiles but extends the ability to comply with custom security policies. For more information, see (CMP-3118).
CustomRule -
Previously, Compliance Operator required persistent storage to save raw scan results, which presented challenges for edge deployments and environments without storage infrastructure. With this release, Compliance Operator supports running scans without persistent storage. Administrators can set in
rawResultStorage.enabled: falseresources to disable storage of scan result files, allowing compliance scans to run in storage-constrained environments such as edge deployments and single-node OpenShift. Compliance check results remain fully available throughScanSettingresources. Raw result storage remains enabled by default for backward compatibility. For more information, see (CMP-1225).ComplianceCheckResult -
Previously, Compliance Operator provided and
ocp4-bsiprofiles for BSI compliance scanning. With this release, theocp4-bsi-nodeprofile is now available, extending BSI standard coverage to RHCOS systems. For more information, see (CMP-3720).rhcos4-bsi - This release removes the deprecated CIS 1.4.0, CIS 1.5.0, DISA STIG V1R1 and DISA STIG V2R1 profiles. The newer versions have replaced these obsolete profiles for customer use. For more information, see (CMP-3712).
- With this release, PCI-DSS profiles 3.2.1 and 4.0.0 are now supported on ARM architecture systems. For more information, see (CMP-3723).
5.2.2.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
- With this release, automatic remediation for API server encryption now applies the appropriate encryption mode based on OpenShift version: AES-GCM for OpenShift 4.13.0 and higher versions, AES-CBC for earlier versions. Both encryption modes remain compliant across all OpenShift versions. For more information, see (CMP-3248).
- Prior to this release, Compliance Operator would remediate SSH settings on RHCOS hosts by deploying a fixed sshd_config file containing all SSH hardening settings. If the scan for corresponding rules failed, this could result in unintended configuration changes to SSH. With this release, Compliance Operator applies very specific remediations to SSH according to the rules shown in https://github.com/ComplianceAsCode/content/blob/master/shared/macros/10-kubernetes.jinja#L1-L154. For more information, see (CMP-3553).
-
For prior versions of Compliance Operator, the log rotation function depended on finding the file in the
logrotatefolder. With this release, Compliance Operator works with the/etc/cron.dailyservice. This provides reliable log rotation behavior from Compliance Operator.logrotate.timer -
For previous versions of Compliance Operator, it is possible for the to be omitted from the compliance report. These omissions were caused by missing
STIG IDandstigrefvalues. With this release, the omissions have been corrected and nowstigidreliably shows up in the compliance report.STIG ID -
Prior to this release, Compliance Operator STIG control CNTR-OS-000720 selected rule , but since the rule was not available in Compliance Operator, no output was generated. With this release, the rule,
rhcos4-audit-rules-suid-privilege-functionis now available in Compliance Operator and listed in the scan output. For more information, see (CMP-3558).rhcos4-audit-rules-suid-privilege-function -
In previous versions of Compliance Operator, scanning with the profile would fail for the rule
ocp4-stigeven if TLS is enabled correctly. This would occur because theocp4-stig-modified-audit-log-forwarding-uses-tlsfield is no longer required by thetls://resource, causing the scan output to show an incorrectClusterLogForwarderresult. With this release, the protocol prefix is not required and the scan output produces correct results. For more information, see (routes-protected-by-tls compliance check failing when ODF 4.11 is installed).FAIL - Previously, there was no automated method to check if API servers were using unsupported configuration overrides as recommended by CIS Benchmark control 1.2.31 or 1.2.33. This release provides dedicated rules for checking for unsupported configuration overrides.
-
For prior releases of Compliance Operator, some rules were missing a variable reference in the annotation, such as rule . With this release, the variable reference is available for rules and the erroneous output is eliminated. For more information, see (CMP-3582).
resource-requests-limits -
Previously, the rule required setting rate limits for all routes outside the
ocp4-routes-rate-limitandopenshiftnamespaces. However, using the feature and scanning for it presented problems because other namespaces managed by critical Operators should not be modified and not be scanned for the modification by Compliance Operator. With this release, routes managed by critical Operators are not flagged as errors by the Compliance Operator.kube -
In prior versions of Compliance Operator, a reported the warning
ComplianceScanwhen theSDN not foundnetworking provider was not found. In this release, Compliance Operator suppresses the warning when OpenShift-SDN is not the active networking provider. For more information, see (CMP-3591).openshift-sdn -
Previously, duplicate variables could be accidentally created in and were not correctly detected by Compliance Operator. With this release, duplicate
TailoredProfileinsetValuesare identified and trigger a warning event from a compliance scan.TailoredProfile -
In previous releases of Compliance Operator, the rule ocp4-audit-log-forwarding-uses-tls failed when the output configuration contained maps without a URL key. With this release, the rule correctly filters for outputs that have a URL field, showing
clusterlogforwarderwhen TLS is properly enabled forPASS. For more information, see (CMP-3597).clusterlogforwarder -
In prior versions of Compliance Operator, for the rule , no remediation was generated after scanning the cluster. In this release, remediation is provided for
rhcos4-service-systemd-coredump-disabled.rhcos4-service-systemd-coredump-disabled -
In prior versions of Compliance Operator, the rule to check the setting of would return
imagestream.spec.tags.importPolicy.scheduledeven when the configuration was correct. With this release, the rule now correctly excludes imagestreams managed by the samples operator and those owned by ClusterVersion, resulting in accurate compliance status reporting.FAIL -
In prior releases, Compliance Operator included outdated TLS cipher suite rules which used unsupported configuration overrides with defective remediations. With this release, these outdated rules have been removed from the default profile. Also, the rule has been renamed to
ocp4-kubelet-configure-tls-cipher-suites-ingresscontrollerfor better organization. For more information, see (CMP-3606).ocp4-ingress-controller-tls-cipher-suites -
In prior versions of Compliance Operator, creating directly with custom content images failed during the profile deprecation check. With this release, Compliance Operator gracefully handles cases where the
ComplianceScanscannot be determined, logging an informational message instead of failing the scan. For more information, see (CMP-3613).ProfileBundle -
Previously, Compliance Operator scanned incorrectly flagged passthrough routes as NON-COMPLIANT with the rule. With this release, passthrough routes are properly excluded from this rule because they delegate TLS termination to the backend application.
ocp4-routes-protected-by-tls
5.2.3. OpenShift Compliance Operator 1.7.1 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.7.1:
5.2.3.1. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Previously, the Compliance Operator’s container could be terminated due to running out of memory, showing the status
pausercontainer is increased to prevent the error and improve overall stability. (OCPBUGS-50924)OOMKilled). With this update, the memory limit for the `pauser
5.2.4. OpenShift Compliance Operator 1.7.0 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.7.0:
5.2.4.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
-
A extension is now available for the Compliance Operator installed on
must-gather,aarch64,x86, andppc64learchitectures. Thes390xtool provides crucial configuration details to Red Hat Customer Support and engineering. For more information, see Using the must-gather tool for the Compliance Operator.must-gather - CIS Benchmark Support has been added to Compliance Operator 1.7.0. The profile supported is CIS OpenShift Benchmark 1.7.0. For more information, see (CMP-3081)
-
Compliance Operator is now supported on architecture for CIS OpenShift Benchmark 1.7.0 and FedRAMP Moderate Revision 4. For more information, see (CMP-2960)
aarch64 - Compliance Operator 1.7.0 now supports OpenShift DISA STIG V2R2 profiles for OpenShift and RHCOS. For more information, see (CMP-3142)
- Compliance Operator 1.7.0 now supports deprecation of old, unsupported profile versions, such as deprecation of CIS 1.4 profiles, CIS 1.5 profiles, DISA STIG V1R1 profiles and DISA STIG V2R1 profiles. For more information, see (CMP-3149)
- With this release of Compliance Operator 1.7.0, the deprecation of older CIS and DISA STIG profiles mean that these older profiles will no longer be supported with the appearance of Compliance Operator 1.8.0. For more information, see (CMP-3284)
- With this release of Compliance Operator 1.7.0, BSI profile support is added for OpenShift. For more information, refer to the KCS article BSI Quick Check and BSI Compliance Summary.
5.2.4.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Before this release, Compliance Operator would provide an unneeded remediation recommendation due to differences in filesystem structure for the architecture. With this release, the Compliance Operator now recognizes the differences in filesystem structure and does not provide the misleading remediation. With this update, the rule is now more clearly defined. (OCPBUGS-33194)
s390x -
Previously, the instructions for rule did not work for OpenShift 4.17 and later. With this update, the instructions and actionable steps are corrected. (OCPBUGS-42350)
ocp4-etcd-unique-ca - When using the Compliance Operator with Cluster Logging Operator (CLO) version 6.0, various rules would fail. This is due to backwards incompatible changes to the CRDs that CLO uses. The Compliance Operator relies on those CRDs to verify logging functionality. The CRDs have been corrected to support the PCI-DSS profiles with CLO. (OCPBUGS-43229)
-
After installing Cluster Logging Operator (CLO) 6.0, users found that the ComplianceCheckResult was failing because there was a change in the APIversion of the
ocp4-cis-audit-log-forwarding-enabledresource. Log collection and forwarding configurations are now specified under the new API, part of the observability.openshift.io API group. (OCPBUGS-43585)clusterlogforwarder - For previous releases of Compliance Operator, the scans would generate an error log for the reconcile loop on the Operator pod. With this release, the Compliance Operator controller logic is more stable. (OCPBUGS-51267)
-
Previously, the rules or
file-integrity-existswould fail onfile-integrity-notification-enabledOpenShift clusters. With this update, these rules evaluate asaarch64onNOT-APPLICABLEsystems. (OCPBUGS-52884)aarch64 -
Before this release of the Compliance Operator, the rule failed for the API server ciphers, resulting in
kubelet-configure-tls-cipher-suitesstatus. The rule has been updated to check new ciphers from RFC 8446, which are included with OpenShift 4.18. The rule is now being evaluated correctly. (OCPBUGS-54212)E2E-FAILURE -
Previously, the Compliance Operator platform scan would fail and produce the message . With this release, the Compliance Operator is safe to run on 4.19 clusters, when that version of OpenShift is available to customers. (OCPBUGS-54403)
failed to parse Ignition config -
Before this release of Compliance Operator, several rules were not platform aware, creating unneeded errors. Now that the rules have been properly ported to other architectures, those rules run correctly and users can observe some Compliance Check Results reporting appropriately, depending on the architecture they are using. (OCPBUGS-53041)
NOT-APPLICABLE -
Previously, the rule would fail unexpectedly. With this release, the rule fails only when this is the needed result. (OCPBUGS-55190)
file-groupowner-ovs-conf-db-hugetlbf
5.2.5. OpenShift Compliance Operator 1.6.2 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.6.2:
CVE-2024-45338 is resolved in the Compliance Operator 1.6.2 release. (CVE-2024-45338)
5.2.6. OpenShift Compliance Operator 1.6.1 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.6.1:
This update includes upgraded dependencies in underlying base images.
5.2.7. OpenShift Compliance Operator 1.6.0 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.6.0:
5.2.7.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
- The Compliance Operator now contains supported profiles for Payment Card Industry Data Security Standard (PCI-DSS) version 4. For more information, see Supported compliance profiles.
- The Compliance Operator now contains supported profiles for Defense Information Systems Agency Security Technical Implementation Guide (DISA STIG) V2R1. For more information, see Supported compliance profiles.
-
A extension is now available for the Compliance Operator installed on
must-gather,x86, andppc64learchitectures. Thes390xtool provides crucial configuration details to Red Hat Customer Support and engineering. For more information, see Using the must-gather tool for the Compliance Operator.must-gather
5.2.7.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Before this release, a misleading description in the rule resulted in misunderstanding, causing potential for misconfigurations. With this update, the rule is now more clearly defined. (CMP-2485)
ocp4-route-ip-whitelist -
Previously, the reporting of all of the for a
ComplianceCheckResultsstatusDONEwas incomplete. With this update, annotation has been added to report the number of totalComplianceScanfor aComplianceCheckResultswith aComplianceScanstatus. (CMP-2615)DONE -
Previously, the rule description contained ambiguous guidelines, leading to confusion among users. With this update, the rule description and actionable steps are clarified. (OCPBUGS-17828)
ocp4-cis-scc-limit-container-allowed-capabilities - Before this update, sysctl configurations caused certain auto remediations for RHCOS4 rules to fail scans in affected clusters. With this update, the correct sysctl settings are applied and RHCOS4 rules for FedRAMP High profiles pass scans correctly. (OCPBUGS-19690)
-
Before this update, an issue with a filter caused errors with the
jqdeployment during compliance checks. With this update, therhacs-operator-controller-managerfilter expression is updated and thejqdeployment is exempt from compliance checks pertaining to container resource limits, eliminating false positive results. (OCPBUGS-19690)rhacs-operator-controller-manager -
Before this update, and
rhcos4-highprofiles checked values of an incorrectly titled configuration file. As a result, some scan checks could fail. With this update, therhcos4-moderateprofiles now check the correct configuration file and scans pass correctly. (OCPBUGS-31674)rhcos4 -
Previously, the variable used in the
accessokenInactivityTimeoutSecondsrule was immutable, leading to aoauthclient-inactivity-timeoutstatus when performing DISA STIG scans. With this update, proper enforcement of theFAILvariable operates correctly and aaccessTokenInactivityTimeoutSecondsstatus is now possible. (OCPBUGS-32551)PASS - Before this update, some annotations for rules were not updated, displaying the incorrect control standards. With this update, annotations for rules are updated correctly, ensuring the correct control standards are displayed. (OCPBUGS-34982)
-
Previously, when upgrading to Compliance Operator 1.5.1, an incorrectly referenced secret in a configuration caused integration issues with the Prometheus Operator. With this update, the Compliance Operator will accurately reference the secret containing the token for
ServiceMonitormetrics. (OCPBUGS-39417)ServiceMonitor
5.2.8. OpenShift Compliance Operator 1.5.1 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.5.1:
5.2.9. OpenShift Compliance Operator 1.5.0 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.5.0:
5.2.9.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
- With this update, the Compliance Operator provides a unique profile ID for easier programmatic use. (CMP-2450)
- With this release, the Compliance Operator is now tested and supported on the ROSA HCP environment. The Compliance Operator loads only Node profiles when running on ROSA HCP. This is because a Red Hat managed platform restricts access to the control plane, which makes Platform profiles irrelevant to the operator’s function.(CMP-2581)
5.2.9.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
- CVE-2024-2961 is resolved in the Compliance Operator 1.5.0 release. (CVE-2024-2961)
- Previously, for ROSA HCP systems, profile listings were incorrect. This update allows the Compliance Operator to provide correct profile output. (OCPBUGS-34535)
-
With this release, namespaces can be excluded from the check by setting the
ocp4-configure-network-policies-namespacesvariable in the tailored profile. (CMP-2543)ocp4-var-network-policies-namespaces-exempt-regex
5.2.10. OpenShift Compliance Operator 1.4.1 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.4.1:
5.2.10.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
- As of this release, the Compliance Operator now provides the CIS OpenShift 1.5.0 profile rules. (CMP-2447)
-
With this update, the Compliance Operator now provides and
OCP4 STIG IDwith the profile rules. (CMP-2401)SRG -
With this update, obsolete rules being applied to have been removed. (CMP-2471)
s390x
5.2.10.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Previously, for Red Hat Enterprise Linux CoreOS (RHCOS) systems using Red Hat Enterprise Linux (RHEL) 9, application of the rule failed. This update replaces the rule with
ocp4-kubelet-enable-protect-kernel-sysctl-file-exist. Now, after auto remediation is applied, RHEL 9-based RHCOS systems will showocp4-kubelet-enable-protect-kernel-sysctlupon the application of this rule. (OCPBUGS-13589)PASS -
Previously, after applying compliance remediations using profile , the nodes were no longer accessible using SSH to the core user account. With this update, nodes remain accessible through SSH using the `sshkey1 option. (OCPBUGS-18331)
rhcos4-e8 -
Previously, the profile was missing rules from CaC that fulfill requirements on the published
STIGfor OpenShift Container Platform. With this update, upon remediation, the cluster satisfiesSTIGrequirements that can be remediated using Compliance Operator. (OCPBUGS-26193)STIG -
Previously, creating a object with profiles of different types for multiple products bypassed a restriction against multiple products types in a binding. With this update, the product validation now allows multiple products regardless of the of profile types in the
ScanSettingBindingobject. (OCPBUGS-26229)ScanSettingBinding -
Previously, running the rule showed as
rhcos4-service-debug-shell-disabledeven after auto-remediation was applied. With this update, running theFAILrule now showsrhcos4-service-debug-shell-disabledafter auto-remediation is applied. (OCPBUGS-28242)PASS -
With this update, instructions for the use of the rule are enhanced to provide more detail. (OCPBUGS-28797)
rhcos4-banner-etc-issue -
Previously the rule provided
api_server_api_priority_flowschema_catch_allstatus on OpenShift Container Platform 4.16 clusters. With this update, theFAILrule providesapi_server_api_priority_flowschema_catch_allstatus on OpenShift Container Platform 4.16 clusters. (OCPBUGS-28918)PASS -
Previously, when a profile was removed from a completed scan shown in a (SSB) object, the Compliance Operator did not remove the old scan. Afterward, when launching a new SSB using the deleted profile, the Compliance Operator failed to update the result. With this release of the Compliance Operator, the new SSB now shows the new compliance check result. (OCPBUGS-29272)
ScanSettingBinding -
Previously, on architecture, the metrics service was not created. With this update, when deploying the Compliance Operator v1.4.1 on
ppc64learchitecture, the metrics service is now created correctly. (OCPBUGS-32797)ppc64le -
Previously, on a HyperShift hosted cluster, a scan with the will run into an unrecoverable error due to a
ocp4-pci-dss profileissue. With this release, the scan for thefilter cannot iterateprofile will reachocp4-pci-dssstatus and return either adoneorCompliancetest result. (OCPBUGS-33067)Non-Compliance
5.2.11. OpenShift Compliance Operator 1.4.0 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.4.0:
5.2.11.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
-
With this update, clusters which use custom node pools outside the default and
workernode pools no longer need to supply additional variables to ensure Compliance Operator aggregates the configuration file for that node pool.master -
Users can now pause scan schedules by setting the attribute to
ScanSetting.suspend. This allows users to suspend a scan schedule and reactivate it without the need to delete and re-create theTrue. This simplifies pausing scan schedules during maintenance periods. (CMP-2123)ScanSettingBinding -
Compliance Operator now supports an optional attribute on
versioncustom resources. (CMP-2125)Profile -
Compliance Operator now supports profile names in . (CMP-2126)
ComplianceRules -
Compliance Operator compatibility with improved API improvements is available in this release. (CMP-2310)
cronjob
5.2.11.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
- Previously, on a cluster with Windows nodes, some rules will FAIL after auto remediation is applied because the Windows nodes were not skipped by the compliance scan. With this release, Windows nodes are correctly skipped when scanning. (OCPBUGS-7355)
-
With this update, default mount propagation is now handled correctly for root volume mounts of pods that rely on multipathing. (OCPBUGS-17494)
rprivate -
Previously, the Compliance Operator would generate a remediation for without reconciling the rule even while applying the remediation. With release 1.4.0, the
coreos_vsyscall_kernel_argumentrule properly evaluates kernel arguments and generates an appropriate remediation.(OCPBUGS-8041)coreos_vsyscall_kernel_argument -
Before this update, rule would fail even after auto-remediation has been applied. With this update,
rhcos4-audit-rules-login-events-faillockfailure locks are now applied correctly after auto-remediation. (OCPBUGS-24594)rhcos4-audit-rules-login-events-faillock -
Previously, upgrades from Compliance Operator 1.3.1 to Compliance Operator 1.4.0 would cause OVS rules scan results to go from to
PASS. With this update, OVS rules scan results now showNOT-APPLICABLE(OCPBUGS-25323)PASS
5.2.12. OpenShift Compliance Operator 1.3.1 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.3.1:
This update addresses a CVE in an underlying dependency.
It is recommended to update the Compliance Operator to version 1.3.1 or later before updating your OpenShift Container Platform cluster to version 4.14 or later.
5.2.12.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
You can install and use the Compliance Operator in an OpenShift Container Platform cluster running in FIPS mode.
ImportantTo enable FIPS mode for your cluster, you must run the installation program from a RHEL computer configured to operate in FIPS mode. For more information about configuring FIPS mode on RHEL, see Installing the system in FIPS mode.
5.2.12.2. Known issue Link kopierenLink in die Zwischenablage kopiert!
- On a cluster with Windows nodes, some rules will FAIL after auto remediation is applied because the Windows nodes are not skipped by the compliance scan. This differs from the expected results because the Windows nodes must be skipped when scanning. (OCPBUGS-7355)
5.2.13. OpenShift Compliance Operator 1.3.0 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.3.0:
5.2.13.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
- The Defense Information Systems Agency Security Technical Implementation Guide (DISA-STIG) for OpenShift Container Platform is now available from Compliance Operator 1.3.0. See Supported compliance profiles for additional information.
- Compliance Operator 1.3.0 now supports IBM Power® and IBM Z® for NIST 800-53 Moderate-Impact Baseline for OpenShift Container Platform platform and node profiles.
5.2.14. OpenShift Compliance Operator 1.2.0 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.2.0:
5.2.14.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
The CIS OpenShift Container Platform 4 Benchmark v1.4.0 profile is now available for platform and node applications. To locate the CIS OpenShift Container Platform v4 Benchmark, go to CIS Benchmarks and click Download Latest CIS Benchmark, where you can then register to download the benchmark.
ImportantUpgrading to Compliance Operator 1.2.0 will overwrite the CIS OpenShift Container Platform 4 Benchmark 1.1.0 profiles.
If your OpenShift Container Platform environment contains existing
andcisremediations, there might be some differences in scan results after upgrading to Compliance Operator 1.2.0.cis-node-
Additional clarity for auditing security context constraints (SCCs) is now available for the rule.
scc-limit-container-allowed-capabilities
5.2.15. OpenShift Compliance Operator 1.1.0 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.1.0:
5.2.15.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
-
A start and end timestamp is now available in the custom resource definition (CRD) status.
ComplianceScan -
The Compliance Operator can now be deployed on hosted control planes using the OperatorHub by creating a file. For more information, see Installing the Compliance Operator on hosted control planes.
Subscription
5.2.15.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
Before this update, some Compliance Operator rule instructions were not present. After this update, instructions are improved for the following rules:
-
classification_banner -
oauth_login_template_set -
oauth_logout_url_set -
oauth_provider_selection_set -
ocp_allowed_registries ocp_allowed_registries_for_import
-
Before this update, check accuracy and rule instructions were unclear. After this update, the check accuracy and instructions are improved for the following
rules:sysctl-
kubelet-enable-protect-kernel-sysctl -
kubelet-enable-protect-kernel-sysctl-kernel-keys-root-maxbytes -
kubelet-enable-protect-kernel-sysctl-kernel-keys-root-maxkeys -
kubelet-enable-protect-kernel-sysctl-kernel-panic -
kubelet-enable-protect-kernel-sysctl-kernel-panic-on-oops -
kubelet-enable-protect-kernel-sysctl-vm-overcommit-memory kubelet-enable-protect-kernel-sysctl-vm-panic-on-oom
-
-
Before this update, the rule did not include instructions. With this update, the
ocp4-alert-receiver-configuredrule now includes improved instructions. (OCPBUGS-7307)ocp4-alert-receiver-configured -
Before this update, the rule would fail for the
rhcos4-sshd-set-loglevel-infoprofile. With this update, the remediation for therhcos4-e8rule was updated to apply the correct configuration changes, allowing subsequent scans to pass after the remediation is applied. (OCPBUGS-7816)sshd-set-loglevel-info -
Before this update, a new installation of OpenShift Container Platform with the latest Compliance Operator install failed on the rule. With this update, the
scheduler-no-bind-addressrule has been disabled on newer versions of OpenShift Container Platform since the parameter was removed. (OCPBUGS-8347)scheduler-no-bind-address
5.2.16. OpenShift Compliance Operator 1.0.0 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 1.0.0:
5.2.16.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
-
The Compliance Operator is now stable and the release channel is upgraded to . Future releases will follow Semantic Versioning. To access the latest release, see Updating the Compliance Operator.
stable
5.2.16.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
- Before this update, the compliance_operator_compliance_scan_error_total metric had an ERROR label with a different value for each error message. With this update, the compliance_operator_compliance_scan_error_total metric does not increase in values. (OCPBUGS-1803)
-
Before this update, the rule would result in a
ocp4-api-server-audit-log-maxsizestate. With this update, the error message has been removed from the metric, decreasing the cardinality of the metric in line with best practices. (OCPBUGS-7520)FAIL -
Before this update, the rule description was misleading that FIPS could be enabled after installation. With this update, the
rhcos4-enable-fips-moderule description clarifies that FIPS must be enabled at install time. (OCPBUGS-8358)rhcos4-enable-fips-mode
5.2.17. OpenShift Compliance Operator 0.1.61 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 0.1.61:
5.2.17.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
-
The Compliance Operator now supports timeout configuration for Scanner Pods. The timeout is specified in the object. If the scan is not completed within the timeout, the scan retries until the maximum number of retries is reached. See Configuring ScanSetting timeout for more information.
ScanSetting
5.2.17.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Before this update, Compliance Operator remediations required variables as inputs. Remediations without variables set were applied cluster-wide and resulted in stuck nodes, even though it appeared the remediation applied correctly. With this update, the Compliance Operator validates if a variable needs to be supplied using a for a remediation. (OCPBUGS-3864)
TailoredProfile -
Before this update, the instructions for were incomplete, requiring users to refine the query manually. With this update, the query provided in
ocp4-kubelet-configure-tls-cipher-suitesreturns the actual results to perform the audit steps. (OCPBUGS-3017)ocp4-kubelet-configure-tls-cipher-suites - Before this update, system reserved parameters were not generated in kubelet configuration files, causing the Compliance Operator to fail to unpause the machine config pool. With this update, the Compliance Operator omits system reserved parameters during machine configuration pool evaluation. (OCPBUGS-4445)
-
Before this update, objects did not have correct descriptions. With this update, the Compliance Operator sources the
ComplianceCheckResultinformation from the rule description. (OCPBUGS-4615)ComplianceCheckResult - Before this update, the Compliance Operator did not check for empty kubelet configuration files when parsing machine configurations. As a result, the Compliance Operator would panic and crash. With this update, the Compliance Operator implements improved checking of the kubelet configuration data structure and only continues if it is fully rendered. (OCPBUGS-4621)
- Before this update, the Compliance Operator generated remediations for kubelet evictions based on machine config pool name and a grace period, resulting in multiple remediations for a single eviction rule. With this update, the Compliance Operator applies all remediations for a single rule. (OCPBUGS-4338)
-
Before this update, a regression occurred when attempting to create a that was using a
ScanSettingBindingwith a non-defaultTailoredProfilemarked theMachineConfigPoolasScanSettingBinding. With this update, functionality is restored and customFailedusing aScanSettingBindingperforms correctly. (OCPBUGS-6827)TailoredProfile Before this update, some kubelet configuration parameters did not have default values. With this update, the following parameters contain default values (OCPBUGS-6708):
-
ocp4-cis-kubelet-enable-streaming-connections -
ocp4-cis-kubelet-eviction-thresholds-set-hard-imagefs-available -
ocp4-cis-kubelet-eviction-thresholds-set-hard-imagefs-inodesfree -
ocp4-cis-kubelet-eviction-thresholds-set-hard-memory-available -
ocp4-cis-kubelet-eviction-thresholds-set-hard-nodefs-available
-
-
Before this update, the rule failed running on the kubelet because of the permissions necessary for the kubelet to run. With this update, the
selinux_confinement_of_daemonsrule is disabled. (OCPBUGS-6968)selinux_confinement_of_daemons
5.2.18. OpenShift Compliance Operator 0.1.59 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 0.1.59:
5.2.18.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
-
The Compliance Operator now supports Payment Card Industry Data Security Standard (PCI-DSS) and
ocp4-pci-dssprofiles on theocp4-pci-dss-nodearchitecture.ppc64le
5.2.18.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Previously, the Compliance Operator did not support the Payment Card Industry Data Security Standard (PCI DSS) and
ocp4-pci-dssprofiles on different architectures such asocp4-pci-dss-node. Now, the Compliance Operator supportsppc64leandocp4-pci-dssprofiles on theocp4-pci-dss-nodearchitecture. (OCPBUGS-3252)ppc64le -
Previously, after the recent update to version 0.1.57, the service account (SA) was no longer owned by the cluster service version (CSV), which caused the SA to be removed during the Operator upgrade. Now, the CSV owns the
rerunnerSA in 0.1.59, and upgrades from any previous version will not result in a missing SA. (OCPBUGS-3452)rerunner
5.2.19. OpenShift Compliance Operator 0.1.57 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 0.1.57:
5.2.19.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
-
checks changed from
KubeletConfigtoNodetype.Platformchecks the default configuration of theKubeletConfig. The configuration files are aggregated from all nodes into a single location per node pool. See EvaluatingKubeletConfigKubeletConfigrules against default configuration values. -
The Custom Resource now allows users to override the default CPU and memory limits of scanner pods through the
ScanSettingattribute. For more information, see Increasing Compliance Operator resource limits.scanLimits -
A object can now be set through
PriorityClass. This ensures the Compliance Operator is prioritized and minimizes the chance that the cluster falls out of compliance. For more information, see SettingScanSettingPriorityClassforScanSettingscans.
5.2.19.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Previously, the Compliance Operator hard-coded notifications to the default namespace. If the Operator were installed in a non-default namespace, the notifications would not work as expected. Now, notifications work in non-default
openshift-compliancenamespaces. (BZ#2060726)openshift-compliance - Previously, the Compliance Operator was unable to evaluate default configurations used by kubelet objects, resulting in inaccurate results and false positives. This new feature evaluates the kubelet configuration and now reports accurately. (BZ#2075041)
-
Previously, the Compliance Operator reported the rule in a
ocp4-kubelet-configure-event-creationstate after applying an automatic remediation because theFAILvalue was set higher than the default value. Now, theeventRecordQPSrule remediation sets the default value, and the rule applies correctly. (BZ#2082416)ocp4-kubelet-configure-event-creation -
The rule requires manual intervention to perform effectively. New descriptive instructions and rule updates increase applicability of the
ocp4-configure-network-policiesrule for clusters using Calico CNIs. (BZ#2091794)ocp4-configure-network-policies -
Previously, the Compliance Operator would not clean up pods used to scan infrastructure when using the option in the scan settings. This caused pods to be left on the cluster even after deleting the
debug=true. Now, pods are always deleted when aScanSettingBindingis deleted.(BZ#2092913)ScanSettingBinding -
Previously, the Compliance Operator used an older version of the command that caused alerts about deprecated functionality. Now, an updated version of the
operator-sdkcommand is included and there are no more alerts for deprecated functionality. (BZ#2098581)operator-sdk - Previously, the Compliance Operator would fail to apply remediations if it could not determine the relationship between kubelet and machine configurations. Now, the Compliance Operator has improved handling of the machine configurations and is able to determine if a kubelet configuration is a subset of a machine configuration. (BZ#2102511)
-
Previously, the rule for did not properly describe success criteria. As a result, the requirements for
ocp4-cis-node-master-kubelet-enable-cert-rotationwere unclear. Now, the rule forRotateKubeletClientCertificatereports accurately regardless of the configuration present in the kubelet configuration file. (BZ#2105153)ocp4-cis-node-master-kubelet-enable-cert-rotation - Previously, the rule for checking idle streaming timeouts did not consider default values, resulting in inaccurate rule reporting. Now, more robust checks ensure increased accuracy in results based on default configuration values. (BZ#2105878)
-
Previously, the Compliance Operator would fail to fetch API resources when parsing machine configurations without Ignition specifications, which caused the processes to crash loop. Now, the Compliance Operator handles Machine Config Pools that do not have Ignition specifications correctly. (BZ#2117268)
api-check-pods -
Previously, rules evaluating the configuration would fail even after applying remediations due to a mismatch in values for the
modprobeconfiguration. Now, the same values are used for themodprobeconfiguration in checks and remediations, ensuring consistent results. (BZ#2117747)modprobe
5.2.19.3. Deprecations Link kopierenLink in die Zwischenablage kopiert!
-
Specifying Install into all namespaces in the cluster or setting the environment variable to
WATCH_NAMESPACESno longer affects all namespaces. Any API resources installed in namespaces not specified at the time of Compliance Operator installation is no longer be operational. API resources might require creation in the selected namespace, or the""namespace by default. This change improves the Compliance Operator’s memory usage.openshift-compliance
5.2.20. OpenShift Compliance Operator 0.1.53 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 0.1.53:
5.2.20.1. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Previously, the rule contained an incorrect variable comparison, resulting in false positive scan results. Now, the Compliance Operator provides accurate scan results when setting
ocp4-kubelet-enable-streaming-connections. (BZ#2069891)streamingConnectionIdleTimeout -
Previously, group ownership for was incorrect on IBM Z® architectures, resulting in
/etc/openvswitch/conf.dbcheck failures. Now, the check is markedocp4-cis-node-worker-file-groupowner-ovs-conf-dbon IBM Z® architecture systems. (BZ#2072597)NOT-APPLICABLE -
Previously, the rule reported in a
ocp4-cis-scc-limit-container-allowed-capabilitiesstate due to incomplete data regarding the security context constraints (SCC) rules in the deployment. Now, the result isFAIL, which is consistent with other checks that require human intervention. (BZ#2077916)MANUAL Previously, the following rules failed to account for additional configuration paths for API servers and TLS certificates and keys, resulting in reported failures even if the certificates and keys were set properly:
-
ocp4-cis-api-server-kubelet-client-cert -
ocp4-cis-api-server-kubelet-client-key -
ocp4-cis-kubelet-configure-tls-cert -
ocp4-cis-kubelet-configure-tls-key
Now, the rules report accurately and observe legacy file paths specified in the kubelet configuration file. (BZ#2079813)
-
-
Previously, the rule did not account for a configurable timeout set by the deployment when assessing compliance for timeouts. This resulted in the rule failing even if the timeout was valid. Now, the Compliance Operator uses the
content_rule_oauth_or_oauthclient_inactivity_timeoutvariable to set valid timeout length. (BZ#2081952)var_oauth_inactivity_timeout - Previously, the Compliance Operator used administrative permissions on namespaces not labeled appropriately for privileged use, resulting in warning messages regarding pod security-level violations. Now, the Compliance Operator has appropriate namespace labels and permission adjustments to access results without violating permissions. (BZ#2088202)
-
Previously, applying auto remediations for and
rhcos4-high-master-sysctl-kernel-yama-ptrace-scoperesulted in subsequent failures of those rules in scan results, even though they were remediated. Now, the rules reportrhcos4-sysctl-kernel-core-patternaccurately, even after remediations are applied.(BZ#2094382)PASS -
Previously, the Compliance Operator would fail in a state because of out-of-memory exceptions. Now, the Compliance Operator is improved to handle large machine configuration data sets in memory and function correctly. (BZ#2094854)
CrashLoopBackoff
5.2.20.2. Known issue Link kopierenLink in die Zwischenablage kopiert!
When
is set within the"debug":trueobject, the pods generated by theScanSettingBindingobject are not removed when that binding is deleted. As a workaround, run the following command to delete the remaining pods:ScanSettingBinding$ oc delete pods -l compliance.openshift.io/scan-name=ocp4-cis
5.2.21. OpenShift Compliance Operator 0.1.52 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 0.1.52:
5.2.21.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
- The FedRAMP high SCAP profile is now available for use in OpenShift Container Platform environments. For more information, See Supported compliance profiles.
5.2.21.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Previously, the container would crash due to a mount permission issue in a security environment where
OpenScapcapability is dropped. Now, executable mount permissions are applied to all users. (BZ#2082151)DAC_OVERRIDE -
Previously, the compliance rule could be configured as
ocp4-configure-network-policies. Now, compliance ruleMANUALis set toocp4-configure-network-policies. (BZ#2072431)AUTOMATIC - Previously, the Cluster Autoscaler would fail to scale down because the Compliance Operator scan pods were never removed after a scan. Now, the pods are removed from each node by default unless explicitly saved for debugging purposes. (BZ#2075029)
-
Previously, applying the Compliance Operator to the would result in the node going into a
KubeletConfigstate due to unpausing the Machine Config Pools too early. Now, the Machine Config Pools are unpaused appropriately and the node operates correctly. (BZ#2071854)NotReady -
Previously, the Machine Config Operator used instead of
base64code in the latest release, causing Compliance Operator remediation to fail. Now, the Compliance Operator checks encoding to handle bothurl-encodedandbase64Machine Config code and the remediation applies correctly. (BZ#2082431)url-encoded
5.2.21.3. Known issue Link kopierenLink in die Zwischenablage kopiert!
When
is set within the"debug":trueobject, the pods generated by theScanSettingBindingobject are not removed when that binding is deleted. As a workaround, run the following command to delete the remaining pods:ScanSettingBinding$ oc delete pods -l compliance.openshift.io/scan-name=ocp4-cis
5.2.22. OpenShift Compliance Operator 0.1.49 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 0.1.49:
5.2.22.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator is now supported on the following architectures:
- IBM Power®
- IBM Z®
- IBM® LinuxONE
5.2.22.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Previously, the content did not include platform-specific checks for network types. As a result, OVN- and SDN-specific checks would show as
openshift-complianceinstead offailedbased on the network configuration. Now, new rules contain platform checks for networking rules, resulting in a more accurate assessment of network-specific checks. (BZ#1994609)not-applicable -
Previously, the rule incorrectly checked TLS settings that results in the rule failing the check, even if the connection secure SSL/TLS protocol. Now, the check properly evaluates TLS settings that are consistent with the networking guidance and profile recommendations. (BZ#2002695)
ocp4-moderate-routes-protected-by-tls -
Previously, used pagination when requesting namespaces. This caused the rule to fail because the deployments truncated lists of more than 500 namespaces. Now, the entire namespace list is requested, and the rule for checking configured network policies works for deployments with more than 500 namespaces. (BZ#2038909)
ocp-cis-configure-network-policies-namespace -
Previously, remediations using the macros were hard-coded to specific sshd configurations. As a result, the configurations were inconsistent with the content the rules were checking for and the check would fail. Now, the sshd configuration is parameterized and the rules apply successfully. (BZ#2049141)
sshd jinja -
Previously, the always checked the first entry in the Cluter Version Operator (CVO) history. As a result, the upgrade would fail in situations where subsequent versions of OpenShift Container Platform would be verified. Now, the compliance check result for
ocp4-cluster-version-operator-verify-integrityis able to detect verified versions and is accurate with the CVO history. (BZ#2053602)ocp4-cluster-version-operator-verify-integrity -
Previously, the rule did not check for a list of empty admission controller plugins. As a result, the rule would always fail, even if all admission plugins were enabled. Now, more robust checking of the
ocp4-api-server-no-adm-ctrl-plugins-disabledrule accurately passes with all admission controller plugins enabled. (BZ#2058631)ocp4-api-server-no-adm-ctrl-plugins-disabled - Previously, scans did not contain platform checks for running against Linux worker nodes. As a result, running scans against worker nodes that were not Linux-based resulted in a never ending scan loop. Now, the scan schedules appropriately based on platform type and labels complete successfully. (BZ#2056911)
5.2.23. OpenShift Compliance Operator 0.1.48 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 0.1.48:
5.2.23.1. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
-
Previously, some rules associated with extended Open Vulnerability and Assessment Language (OVAL) definitions had a of
checkType. This was because the Compliance Operator was not processing extended OVAL definitions when parsing rules. With this update, content from extended OVAL definitions is parsed so that these rules now have aNoneof eithercheckTypeorNode. (BZ#2040282)Platform -
Previously, a manually created object for
MachineConfigprevented aKubeletConfigobject from being generated for remediation, leaving the remediation in theKubeletConfigstate. With this release, aPendingobject is created by the remediation, regardless if there is a manually createdKubeletConfigobject forMachineConfig. As a result,KubeletConfigremediations now work as expected. (BZ#2040401)KubeletConfig
5.2.24. OpenShift Compliance Operator 0.1.47 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 0.1.47:
5.2.24.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator now supports the following compliance benchmarks for the Payment Card Industry Data Security Standard (PCI DSS):
- ocp4-pci-dss
- ocp4-pci-dss-node
- Additional rules and remediations for FedRAMP moderate impact level are added to the OCP4-moderate, OCP4-moderate-node, and rhcos4-moderate profiles.
- Remediations for KubeletConfig are now available in node-level profiles.
5.2.24.2. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
Previously, if your cluster was running OpenShift Container Platform 4.6 or earlier, remediations for USBGuard-related rules would fail for the moderate profile. This is because the remediations created by the Compliance Operator were based on an older version of USBGuard that did not support drop-in directories. Now, invalid remediations for USBGuard-related rules are not created for clusters running OpenShift Container Platform 4.6. If your cluster is using OpenShift Container Platform 4.6, you must manually create remediations for USBGuard-related rules.
Additionally, remediations are created only for rules that satisfy minimum version requirements. (BZ#1965511)
-
Previously, when rendering remediations, the compliance operator would check that the remediation was well-formed by using a regular expression that was too strict. As a result, some remediations, such as those that render , would not pass the regular expression check and therefore, were not created. The regular expression was found to be unnecessary and removed. Remediations now render correctly. (BZ#2033009)
sshd_config
5.2.25. OpenShift Compliance Operator 0.1.44 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 0.1.44:
5.2.25.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
-
In this release, the option is now added to the
strictNodeScan,ComplianceScanandComplianceSuiteCRs. This option defaults toScanSettingwhich matches the previous behavior, where an error occurred if a scan was not able to be scheduled on a node. Setting the option totrueallows the Compliance Operator to be more permissive about scheduling scans. Environments with ephemeral nodes can set thefalsevalue to false, which allows a compliance scan to proceed, even if some of the nodes in the cluster are not available for scheduling.strictNodeScan -
You can now customize the node that is used to schedule the result server workload by configuring the and
nodeSelectorattributes of thetolerationsobject. These attributes are used to place theScanSettingpod, the pod that is used to mount a PV storage volume and store the raw Asset Reporting Format (ARF) results. Previously, theResultServerand thenodeSelectorparameters defaulted to selecting one of the control plane nodes and tolerating thetolerations. This did not work in environments where control plane nodes are not permitted to mount PVs. This feature provides a way for you to select the node and tolerate a different taint in those environments.node-role.kubernetes.io/master taint -
The Compliance Operator can now remediate objects.
KubeletConfig - A comment containing an error message is now added to help content developers differentiate between objects that do not exist in the cluster compared to objects that cannot be fetched.
-
Rule objects now contain two new attributes, and
checkType. These attributes allow you to determine if the rule pertains to a node check or platform check, and also allow you to review what the rule does.description -
This enhancement removes the requirement that you have to extend an existing profile to create a tailored profile. This means the field in the
extendsCRD is no longer mandatory. You can now select a list of rule objects to create a tailored profile. Note that you must select whether your profile applies to nodes or the platform by setting theTailoredProfileannotation or by setting thecompliance.openshift.io/product-type:suffix for the-nodeCR.TailoredProfile -
In this release, the Compliance Operator is now able to schedule scans on all nodes irrespective of their taints. Previously, the scan pods would only tolerated the , meaning that they would either ran on nodes with no taints or only on nodes with the
node-role.kubernetes.io/master tainttaint. In deployments that use custom taints for their nodes, this resulted in the scans not being scheduled on those nodes. Now, the scan pods tolerate all node taints.node-role.kubernetes.io/master In this release, the Compliance Operator supports the following North American Electric Reliability Corporation (NERC) security profiles:
- ocp4-nerc-cip
- ocp4-nerc-cip-node
- rhcos4-nerc-cip
- In this release, the Compliance Operator supports the NIST 800-53 Moderate-Impact Baseline for the Red Hat OpenShift - Node level, ocp4-moderate-node, security profile.
5.2.25.2. Templating and variable use Link kopierenLink in die Zwischenablage kopiert!
- In this release, the remediation template now allows multi-value variables.
-
With this update, the Compliance Operator can change remediations based on variables that are set in the compliance profile. This is useful for remediations that include deployment-specific values such as time outs, NTP server host names, or similar. Additionally, the objects now use the label
ComplianceCheckResultthat lists the variables a check has used.compliance.openshift.io/check-has-value
5.2.25.3. Bug fixes Link kopierenLink in die Zwischenablage kopiert!
- Previously, while performing a scan, an unexpected termination occurred in one of the scanner containers of the pods. In this release, the Compliance Operator uses the latest OpenSCAP version 1.3.5 to avoid a crash.
-
Previously, using to apply remediations triggered an update of the cluster nodes. This was disruptive if some of the remediations did not include all of the required input variables. Now, if a remediation is missing one or more required input variables, it is assigned a state of
autoReplyRemediations. If one or more remediations are in aNeedsReviewstate, the machine config pool remains paused, and the remediations are not applied until all of the required variables are set. This helps minimize disruption to the nodes.NeedsReview - The RBAC Role and Role Binding used for Prometheus metrics are changed to 'ClusterRole' and 'ClusterRoleBinding' to ensure that monitoring works without customization.
-
Previously, if an error occurred while parsing a profile, rules or variables objects were removed and deleted from the profile. Now, if an error occurs during parsing, the annotates the object with a temporary annotation that prevents the object from being deleted until after parsing completes. (BZ#1988259)
profileparser -
Previously, an error occurred if titles or descriptions were missing from a tailored profile. Because the XCCDF standard requires titles and descriptions for tailored profiles, titles and descriptions are now required to be set in CRs.
TailoredProfile -
Previously, when using tailored profiles, variable values were allowed to be set using only a specific selection set. This restriction is now removed, and
TailoredProfilevariables can be set to any value.TailoredProfile
5.2.26. Release Notes for Compliance Operator 0.1.39 Link kopierenLink in die Zwischenablage kopiert!
The following advisory is available for the OpenShift Compliance Operator 0.1.39:
5.2.26.1. New features and enhancements Link kopierenLink in die Zwischenablage kopiert!
- Previously, the Compliance Operator was unable to parse Payment Card Industry Data Security Standard (PCI DSS) references. Now, the Operator can parse compliance content that is provided with PCI DSS profiles.
- Previously, the Compliance Operator was unable to execute rules for AU-5 control in the moderate profile. Now, permission is added to the Operator so that it can read Prometheusrules.monitoring.coreos.com objects and run the rules that cover AU-5 control in the moderate profile.
5.3. Compliance Operator support Link kopierenLink in die Zwischenablage kopiert!
5.3.1. Compliance Operator lifecycle Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator is a "Rolling Stream" Operator, meaning updates are available asynchronously of OpenShift Container Platform releases. For more information, see OpenShift Operator Life Cycles on the Red Hat Customer Portal.
5.3.2. Getting support Link kopierenLink in die Zwischenablage kopiert!
If you experience difficulty with a procedure described in this documentation, or with OpenShift Container Platform in general, visit the Red Hat Customer Portal.
From the Customer Portal, you can:
- Search or browse through the Red Hat Knowledgebase of articles and solutions relating to Red Hat products.
- Submit a support case to Red Hat Support.
- Access other product documentation.
To identify issues with your cluster, you can use Insights in OpenShift Cluster Manager. Insights provides details about issues and, if available, information on how to solve a problem.
If you have a suggestion for improving this documentation or have found an error, submit a Jira issue for the most relevant documentation component. Please provide specific details, such as the section name and OpenShift Container Platform version.
5.3.3. Using the must-gather tool for the Compliance Operator Link kopierenLink in die Zwischenablage kopiert!
Starting in Compliance Operator v1.6.0, you can collect data about the Compliance Operator resources by running the
must-gather
Consider using the
must-gather
Procedure
Run the following command to collect data about the Compliance Operator:
$ oc adm must-gather --image=$(oc get csv compliance-operator.v1.6.0 -o=jsonpath='{.spec.relatedImages[?(@.name=="must-gather")].image}')
5.4. Compliance Operator concepts Link kopierenLink in die Zwischenablage kopiert!
5.4.1. Understanding the Compliance Operator Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator lets OpenShift Container Platform administrators describe the required compliance state of a cluster and provides them with an overview of gaps and ways to remediate them. The Compliance Operator assesses compliance of both the Kubernetes API resources of OpenShift Container Platform, as well as the nodes running the cluster. The Compliance Operator uses OpenSCAP, a NIST-certified tool, to scan and enforce security policies provided by the content.
The Compliance Operator is available for Red Hat Enterprise Linux CoreOS (RHCOS) deployments only.
5.4.1.1. Compliance Operator profiles Link kopierenLink in die Zwischenablage kopiert!
There are several profiles available as part of the Compliance Operator installation. You can use the
oc get
View the available profiles:
$ oc get profile.compliance -n openshift-complianceExample output
NAME AGE VERSION ocp4-cis 3h49m 1.5.0 ocp4-cis-1-4 3h49m 1.4.0 ocp4-cis-1-5 3h49m 1.5.0 ocp4-cis-node 3h49m 1.5.0 ocp4-cis-node-1-4 3h49m 1.4.0 ocp4-cis-node-1-5 3h49m 1.5.0 ocp4-e8 3h49m ocp4-high 3h49m Revision 4 ocp4-high-node 3h49m Revision 4 ocp4-high-node-rev-4 3h49m Revision 4 ocp4-high-rev-4 3h49m Revision 4 ocp4-moderate 3h49m Revision 4 ocp4-moderate-node 3h49m Revision 4 ocp4-moderate-node-rev-4 3h49m Revision 4 ocp4-moderate-rev-4 3h49m Revision 4 ocp4-nerc-cip 3h49m ocp4-nerc-cip-node 3h49m ocp4-pci-dss 3h49m 3.2.1 ocp4-pci-dss-3-2 3h49m 3.2.1 ocp4-pci-dss-4-0 3h49m 4.0.0 ocp4-pci-dss-node 3h49m 3.2.1 ocp4-pci-dss-node-3-2 3h49m 3.2.1 ocp4-pci-dss-node-4-0 3h49m 4.0.0 ocp4-stig 3h49m V2R1 ocp4-stig-node 3h49m V2R1 ocp4-stig-node-v1r1 3h49m V1R1 ocp4-stig-node-v2r1 3h49m V2R1 ocp4-stig-v1r1 3h49m V1R1 ocp4-stig-v2r1 3h49m V2R1 rhcos4-e8 3h49m rhcos4-high 3h49m Revision 4 rhcos4-high-rev-4 3h49m Revision 4 rhcos4-moderate 3h49m Revision 4 rhcos4-moderate-rev-4 3h49m Revision 4 rhcos4-nerc-cip 3h49m rhcos4-stig 3h49m V2R1 rhcos4-stig-v1r1 3h49m V1R1 rhcos4-stig-v2r1 3h49m V2R1These profiles represent different compliance benchmarks. Each profile has the product name that it applies to added as a prefix to the profile’s name.
applies the Essential 8 benchmark to the OpenShift Container Platform product, whileocp4-e8applies the Essential 8 benchmark to the Red Hat Enterprise Linux CoreOS (RHCOS) product.rhcos4-e8Run the following command to view the details of the
profile:rhcos4-e8$ oc get -n openshift-compliance -oyaml profiles.compliance rhcos4-e8Example 5.1. Example output
apiVersion: compliance.openshift.io/v1alpha1 description: 'This profile contains configuration checks for Red Hat Enterprise Linux CoreOS that align to the Australian Cyber Security Centre (ACSC) Essential Eight. A copy of the Essential Eight in Linux Environments guide can be found at the ACSC website: https://www.cyber.gov.au/acsc/view-all-content/publications/hardening-linux-workstations-and-servers' id: xccdf_org.ssgproject.content_profile_e8 kind: Profile metadata: annotations: compliance.openshift.io/image-digest: pb-rhcos4hrdkm compliance.openshift.io/product: redhat_enterprise_linux_coreos_4 compliance.openshift.io/product-type: Node creationTimestamp: "2022-10-19T12:06:49Z" generation: 1 labels: compliance.openshift.io/profile-bundle: rhcos4 name: rhcos4-e8 namespace: openshift-compliance ownerReferences: - apiVersion: compliance.openshift.io/v1alpha1 blockOwnerDeletion: true controller: true kind: ProfileBundle name: rhcos4 uid: 22350850-af4a-4f5c-9a42-5e7b68b82d7d resourceVersion: "43699" uid: 86353f70-28f7-40b4-bf0e-6289ec33675b rules: - rhcos4-accounts-no-uid-except-zero - rhcos4-audit-rules-dac-modification-chmod - rhcos4-audit-rules-dac-modification-chown - rhcos4-audit-rules-execution-chcon - rhcos4-audit-rules-execution-restorecon - rhcos4-audit-rules-execution-semanage - rhcos4-audit-rules-execution-setfiles - rhcos4-audit-rules-execution-setsebool - rhcos4-audit-rules-execution-seunshare - rhcos4-audit-rules-kernel-module-loading-delete - rhcos4-audit-rules-kernel-module-loading-finit - rhcos4-audit-rules-kernel-module-loading-init - rhcos4-audit-rules-login-events - rhcos4-audit-rules-login-events-faillock - rhcos4-audit-rules-login-events-lastlog - rhcos4-audit-rules-login-events-tallylog - rhcos4-audit-rules-networkconfig-modification - rhcos4-audit-rules-sysadmin-actions - rhcos4-audit-rules-time-adjtimex - rhcos4-audit-rules-time-clock-settime - rhcos4-audit-rules-time-settimeofday - rhcos4-audit-rules-time-stime - rhcos4-audit-rules-time-watch-localtime - rhcos4-audit-rules-usergroup-modification - rhcos4-auditd-data-retention-flush - rhcos4-auditd-freq - rhcos4-auditd-local-events - rhcos4-auditd-log-format - rhcos4-auditd-name-format - rhcos4-auditd-write-logs - rhcos4-configure-crypto-policy - rhcos4-configure-ssh-crypto-policy - rhcos4-no-empty-passwords - rhcos4-selinux-policytype - rhcos4-selinux-state - rhcos4-service-auditd-enabled - rhcos4-sshd-disable-empty-passwords - rhcos4-sshd-disable-gssapi-auth - rhcos4-sshd-disable-rhosts - rhcos4-sshd-disable-root-login - rhcos4-sshd-disable-user-known-hosts - rhcos4-sshd-do-not-permit-user-env - rhcos4-sshd-enable-strictmodes - rhcos4-sshd-print-last-log - rhcos4-sshd-set-loglevel-info - rhcos4-sysctl-kernel-dmesg-restrict - rhcos4-sysctl-kernel-kptr-restrict - rhcos4-sysctl-kernel-randomize-va-space - rhcos4-sysctl-kernel-unprivileged-bpf-disabled - rhcos4-sysctl-kernel-yama-ptrace-scope - rhcos4-sysctl-net-core-bpf-jit-harden title: Australian Cyber Security Centre (ACSC) Essential EightRun the following command to view the details of the
rule:rhcos4-audit-rules-login-events$ oc get -n openshift-compliance -oyaml rules rhcos4-audit-rules-login-eventsExample 5.2. Example output
apiVersion: compliance.openshift.io/v1alpha1 checkType: Node description: |- The audit system already collects login information for all users and root. If the auditd daemon is configured to use the augenrules program to read audit rules during daemon startup (the default), add the following lines to a file with suffix.rules in the directory /etc/audit/rules.d in order to watch for attempted manual edits of files involved in storing logon events: -w /var/log/tallylog -p wa -k logins -w /var/run/faillock -p wa -k logins -w /var/log/lastlog -p wa -k logins If the auditd daemon is configured to use the auditctl utility to read audit rules during daemon startup, add the following lines to /etc/audit/audit.rules file in order to watch for unattempted manual edits of files involved in storing logon events: -w /var/log/tallylog -p wa -k logins -w /var/run/faillock -p wa -k logins -w /var/log/lastlog -p wa -k logins id: xccdf_org.ssgproject.content_rule_audit_rules_login_events kind: Rule metadata: annotations: compliance.openshift.io/image-digest: pb-rhcos4hrdkm compliance.openshift.io/rule: audit-rules-login-events control.compliance.openshift.io/NIST-800-53: AU-2(d);AU-12(c);AC-6(9);CM-6(a) control.compliance.openshift.io/PCI-DSS: Req-10.2.3 policies.open-cluster-management.io/controls: AU-2(d),AU-12(c),AC-6(9),CM-6(a),Req-10.2.3 policies.open-cluster-management.io/standards: NIST-800-53,PCI-DSS creationTimestamp: "2022-10-19T12:07:08Z" generation: 1 labels: compliance.openshift.io/profile-bundle: rhcos4 name: rhcos4-audit-rules-login-events namespace: openshift-compliance ownerReferences: - apiVersion: compliance.openshift.io/v1alpha1 blockOwnerDeletion: true controller: true kind: ProfileBundle name: rhcos4 uid: 22350850-af4a-4f5c-9a42-5e7b68b82d7d resourceVersion: "44819" uid: 75872f1f-3c93-40ca-a69d-44e5438824a4 rationale: Manual editing of these files may indicate nefarious activity, such as an attacker attempting to remove evidence of an intrusion. severity: medium title: Record Attempts to Alter Logon and Logout Events warning: Manual editing of these files may indicate nefarious activity, such as an attacker attempting to remove evidence of an intrusion.
5.4.1.1.1. Compliance Operator profile types Link kopierenLink in die Zwischenablage kopiert!
Compliance Operator rules are organized into profiles. Profiles can target the Platform or Nodes for OpenShift Container Platform, and some benchmarks include
rhcos4
- Platform
- Platform profiles evaluate your OpenShift Container Platform cluster components. For example, a Platform-level rule can confirm whether APIServer configurations are using strong encryption cyphers.
- Node
-
Node profiles evaluate the OpenShift or RHCOS configuration of each host. You can use two Node profiles:
ocp4Node profiles andrhcos4Node profiles. Theocp4Node profiles evaluate the OpenShift configuration of each host. For example, they can confirm whetherkubeconfigfiles have the correct permissions to meet a compliance standard. Therhcos4Node profiles evaluate the Red Hat Enterprise Linux CoreOS (RHCOS) configuration of each host. For example, they can confirm whether the SSHD service is configured to disable password logins.
For benchmarks that have Node and Platform profiles, such as PCI-DSS, you must run both profiles in your OpenShift Container Platform environment.
For benchmarks that have
ocp4
ocp4
rhcos4
In a cluster with many Nodes, both
ocp4
rhcos4
5.4.2. Understanding the Custom Resource Definitions Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator in the OpenShift Container Platform provides you with several Custom Resource Definitions (CRDs) to accomplish the compliance scans. To run a compliance scan, it leverages the predefined security policies, which are derived from the ComplianceAsCode community project. The Compliance Operator converts these security policies into CRDs, which you can use to run compliance scans and get remediations for the issues found.
5.4.2.1. CRDs workflow Link kopierenLink in die Zwischenablage kopiert!
The CRD provides you the following workflow to complete the compliance scans:
- Define your compliance scan requirements
- Configure the compliance scan settings
- Process compliance requirements with compliance scans settings
- Monitor the compliance scans
- Check the compliance scan results
5.4.2.2. Defining the compliance scan requirements Link kopierenLink in die Zwischenablage kopiert!
By default, the Compliance Operator CRDs include
ProfileBundle
Profile
TailoredProfile
5.4.2.2.1. ProfileBundle object Link kopierenLink in die Zwischenablage kopiert!
When you install the Compliance Operator, it includes ready-to-run
ProfileBundle
ProfileBundle
Profile
Rule
Variable
Profile
Example ProfileBundle object
apiVersion: compliance.openshift.io/v1alpha1
kind: ProfileBundle
name: <profile bundle name>
namespace: openshift-compliance
status:
dataStreamStatus: VALID
- 1
- Indicates whether the Compliance Operator was able to parse the content files.
When the
contentFile
errorMessage
Troubleshooting
When you roll back to a known content image from an invalid image, the
ProfileBundle
PENDING
ProfileBundle
5.4.2.2.2. Profile object Link kopierenLink in die Zwischenablage kopiert!
The
Profile
Node
Platform
Profile
TailorProfile
You cannot create or modify the
Profile
ProfileBundle
ProfileBundle
Profile
Example Profile object
apiVersion: compliance.openshift.io/v1alpha1
description: <description of the profile>
id: xccdf_org.ssgproject.content_profile_moderate
kind: Profile
metadata:
annotations:
compliance.openshift.io/product: <product name>
compliance.openshift.io/product-type: Node
creationTimestamp: "YYYY-MM-DDTMM:HH:SSZ"
generation: 1
labels:
compliance.openshift.io/profile-bundle: <profile bundle name>
name: rhcos4-moderate
namespace: openshift-compliance
ownerReferences:
- apiVersion: compliance.openshift.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: ProfileBundle
name: <profile bundle name>
uid: <uid string>
resourceVersion: "<version number>"
selfLink: /apis/compliance.openshift.io/v1alpha1/namespaces/openshift-compliance/profiles/rhcos4-moderate
uid: <uid string>
rules:
- rhcos4-account-disable-post-pw-expiration
- rhcos4-accounts-no-uid-except-zero
- rhcos4-audit-rules-dac-modification-chmod
- rhcos4-audit-rules-dac-modification-chown
title: <title of the profile>
- 1
- Specify the XCCDF name of the profile. Use this identifier when you define a
ComplianceScanobject as the value of the profile attribute of the scan. - 2
- Specify either a
NodeorPlatform. Node profiles scan the cluster nodes and platform profiles scan the Kubernetes platform. - 3
- Specify the list of rules for the profile. Each rule corresponds to a single check.
5.4.2.2.3. Rule object Link kopierenLink in die Zwischenablage kopiert!
The
Rule
Rule
Example Rule object
apiVersion: compliance.openshift.io/v1alpha1
checkType: Platform
description: <description of the rule>
id: xccdf_org.ssgproject.content_rule_configure_network_policies_namespaces
instructions: <manual instructions for the scan>
kind: Rule
metadata:
annotations:
compliance.openshift.io/rule: configure-network-policies-namespaces
control.compliance.openshift.io/CIS-OCP: 5.3.2
control.compliance.openshift.io/NERC-CIP: CIP-003-3 R4;CIP-003-3 R4.2;CIP-003-3
R5;CIP-003-3 R6;CIP-004-3 R2.2.4;CIP-004-3 R3;CIP-007-3 R2;CIP-007-3 R2.1;CIP-007-3
R2.2;CIP-007-3 R2.3;CIP-007-3 R5.1;CIP-007-3 R6.1
control.compliance.openshift.io/NIST-800-53: AC-4;AC-4(21);CA-3(5);CM-6;CM-6(1);CM-7;CM-7(1);SC-7;SC-7(3);SC-7(5);SC-7(8);SC-7(12);SC-7(13);SC-7(18)
labels:
compliance.openshift.io/profile-bundle: ocp4
name: ocp4-configure-network-policies-namespaces
namespace: openshift-compliance
rationale: <description of why this rule is checked>
severity: high
title: <summary of the rule>
- 1
- Specify the type of check this rule executes.
Nodeprofiles scan the cluster nodes andPlatformprofiles scan the Kubernetes platform. An empty value indicates there is no automated check. - 2
- Specify the XCCDF name of the rule, which is parsed directly from the datastream.
- 3
- Specify the severity of the rule when it fails.
The
Rule
ProfileBundle
ProfileBundle
OwnerReferences
5.4.2.2.4. TailoredProfile object Link kopierenLink in die Zwischenablage kopiert!
Use the
TailoredProfile
Profile
TailoredProfile
ConfigMap
ComplianceScan
You can use the
TailoredProfile
ScanSettingBinding
ScanSettingBinding
Example TailoredProfile object
apiVersion: compliance.openshift.io/v1alpha1
kind: TailoredProfile
metadata:
name: rhcos4-with-usb
spec:
extends: rhcos4-moderate
title: <title of the tailored profile>
disableRules:
- name: <name of a rule object to be disabled>
rationale: <description of why this rule is checked>
status:
id: xccdf_compliance.openshift.io_profile_rhcos4-with-usb
outputRef:
name: rhcos4-with-usb-tp
namespace: openshift-compliance
state: READY
- 1
- This is optional. Name of the
Profileobject upon which theTailoredProfileis built. If no value is set, a new profile is created from theenableRuleslist. - 2
- Specifies the XCCDF name of the tailored profile.
- 3
- Specifies the
ConfigMapname, which can be used as the value of thetailoringConfigMap.nameattribute of aComplianceScan. - 4
- Shows the state of the object such as
READY,PENDING, andFAILURE. If the state of the object isERROR, then the attributestatus.errorMessageprovides the reason for the failure.
With the
TailoredProfile
Profile
TailoredProfile
Profile
- an appropriate title
-
value must be empty
extends scan type annotation on the
object:TailoredProfilecompliance.openshift.io/product-type: Platform/NodeNoteIf you have not set the
annotation, the Compliance Operator defaults toproduct-typescan type. Adding thePlatformsuffix to the name of the-nodeobject results inTailoredProfilescan type.node
5.4.2.3. Configuring the compliance scan settings Link kopierenLink in die Zwischenablage kopiert!
After you have defined the requirements of the compliance scan, you can configure it by specifying the type of the scan, occurrence of the scan, and location of the scan. To do so, Compliance Operator provides you with a
ScanSetting
5.4.2.3.1. ScanSetting object Link kopierenLink in die Zwischenablage kopiert!
Use the
ScanSetting
ScanSetting
- default - it runs a scan every day at 1 AM on both master and worker nodes using a 1Gi Persistent Volume (PV) and keeps the last three results. Remediation is neither applied nor updated automatically.
-
default-auto-apply - it runs a scan every day at 1AM on both control plane and worker nodes using a 1Gi Persistent Volume (PV) and keeps the last three results. Both and
autoApplyRemediationsare set to true.autoUpdateRemediations
Example ScanSetting object
apiVersion: compliance.openshift.io/v1alpha1
autoApplyRemediations: true
autoUpdateRemediations: true
kind: ScanSetting
maxRetryOnTimeout: 3
metadata:
creationTimestamp: "2022-10-18T20:21:00Z"
generation: 1
name: default-auto-apply
namespace: openshift-compliance
resourceVersion: "38840"
uid: 8cb0967d-05e0-4d7a-ac1c-08a7f7e89e84
rawResultStorage:
nodeSelector:
node-role.kubernetes.io/master: ""
pvAccessModes:
- ReadWriteOnce
rotation: 3
size: 1Gi
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 300
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 300
- effect: NoSchedule
key: node.kubernetes.io/memory-pressure
operator: Exists
roles:
- master
- worker
scanTolerations:
- operator: Exists
schedule: 0 1 * * *
showNotApplicable: false
strictNodeScan: true
timeout: 30m
- 1
- Set to
trueto enable auto remediations. Set tofalseto disable auto remediations. - 2
- Set to
trueto enable auto remediations for content updates. Set tofalseto disable auto remediations for content updates. - 3
- Specify the number of stored scans in the raw result format. The default value is
3. As the older results get rotated, the administrator must store the results elsewhere before the rotation happens. - 4
- Specify the storage size that should be created for the scan to store the raw results. The default value is
1Gi - 6
- Specify how often the scan should be run in cron format.Note
To disable the rotation policy, set the value to
.0 - 5
- Specify the
node-role.kubernetes.iolabel value to schedule the scan forNodetype. This value has to match the name of aMachineConfigPool.
5.4.2.4. Processing the compliance scan requirements with compliance scans settings Link kopierenLink in die Zwischenablage kopiert!
When you have defined the compliance scan requirements and configured the settings to run the scans, then the Compliance Operator processes it using the
ScanSettingBinding
5.4.2.4.1. ScanSettingBinding object Link kopierenLink in die Zwischenablage kopiert!
Use the
ScanSettingBinding
Profile
TailoredProfile
ScanSetting
ComplianceSuite
ScanSetting
ScanSettingBinding
Example ScanSettingBinding object
apiVersion: compliance.openshift.io/v1alpha1
kind: ScanSettingBinding
metadata:
name: <name of the scan>
profiles:
# Node checks
- name: rhcos4-with-usb
kind: TailoredProfile
apiGroup: compliance.openshift.io/v1alpha1
# Cluster checks
- name: ocp4-moderate
kind: Profile
apiGroup: compliance.openshift.io/v1alpha1
settingsRef:
name: my-companys-constraints
kind: ScanSetting
apiGroup: compliance.openshift.io/v1alpha1
The creation of
ScanSetting
ScanSettingBinding
$ oc get compliancesuites
If you delete
ScanSettingBinding
5.4.2.5. Tracking the compliance scans Link kopierenLink in die Zwischenablage kopiert!
After the creation of compliance suite, you can monitor the status of the deployed scans using the
ComplianceSuite
5.4.2.5.1. ComplianceSuite object Link kopierenLink in die Zwischenablage kopiert!
The
ComplianceSuite
For
Node
MachineConfigPool
Example ComplianceSuite object
apiVersion: compliance.openshift.io/v1alpha1
kind: ComplianceSuite
metadata:
name: <name of the scan>
spec:
autoApplyRemediations: false
schedule: "0 1 * * *"
scans:
- name: workers-scan
scanType: Node
profile: xccdf_org.ssgproject.content_profile_moderate
content: ssg-rhcos4-ds.xml
contentImage: registry.redhat.io/compliance/openshift-compliance-content-rhel8@sha256:45dc...
rule: "xccdf_org.ssgproject.content_rule_no_netrc_files"
nodeSelector:
node-role.kubernetes.io/worker: ""
status:
Phase: DONE
Result: NON-COMPLIANT
scanStatuses:
- name: workers-scan
phase: DONE
result: NON-COMPLIANT
The suite in the background creates the
ComplianceScan
scans
ComplianceSuites
$ oc get events --field-selector involvedObject.kind=ComplianceSuite,involvedObject.name=<name of the suite>
You might create errors when you manually define the
ComplianceSuite
5.4.2.5.2. Advanced ComplianceScan Object Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator includes options for advanced users for debugging or integrating with existing tooling. While it is recommended that you not create a
ComplianceScan
ComplianceSuite
Example Advanced ComplianceScan object
apiVersion: compliance.openshift.io/v1alpha1
kind: ComplianceScan
metadata:
name: <name of the scan>
spec:
scanType: Node
profile: xccdf_org.ssgproject.content_profile_moderate
content: ssg-ocp4-ds.xml
contentImage: registry.redhat.io/compliance/openshift-compliance-content-rhel8@sha256:45dc...
rule: "xccdf_org.ssgproject.content_rule_no_netrc_files"
nodeSelector:
node-role.kubernetes.io/worker: ""
status:
phase: DONE
result: NON-COMPLIANT
- 1
- Specify either
NodeorPlatform. Node profiles scan the cluster nodes and platform profiles scan the Kubernetes platform. - 2
- Specify the XCCDF identifier of the profile that you want to run.
- 3
- Specify the container image that encapsulates the profile files.
- 4
- It is optional. Specify the scan to run a single rule. This rule has to be identified with the XCCDF ID, and has to belong to the specified profile.Note
If you skip the
parameter, then scan runs for all the available rules of the specified profile.rule - 5
- If you are on the OpenShift Container Platform and wants to generate a remediation, then nodeSelector label has to match the
MachineConfigPoollabel.NoteIf you do not specify
parameter or match thenodeSelectorlabel, scan will still run, but it will not create remediation.MachineConfig - 6
- Indicates the current phase of the scan.
- 7
- Indicates the verdict of the scan.
If you delete a
ComplianceSuite
When the scan is complete, it generates the result as Custom Resources of the
ComplianceCheckResult
ComplianceScans
oc get events --field-selector involvedObject.kind=ComplianceScan,involvedObject.name=<name of the suite>
5.4.2.6. Viewing the compliance results Link kopierenLink in die Zwischenablage kopiert!
When the compliance suite reaches the
DONE
5.4.2.6.1. ComplianceCheckResult object Link kopierenLink in die Zwischenablage kopiert!
When you run a scan with a specific profile, several rules in the profiles are verified. For each of these rules, a
ComplianceCheckResult
Example ComplianceCheckResult object
apiVersion: compliance.openshift.io/v1alpha1
kind: ComplianceCheckResult
metadata:
labels:
compliance.openshift.io/check-severity: medium
compliance.openshift.io/check-status: FAIL
compliance.openshift.io/suite: example-compliancesuite
compliance.openshift.io/scan-name: workers-scan
name: workers-scan-no-direct-root-logins
namespace: openshift-compliance
ownerReferences:
- apiVersion: compliance.openshift.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: ComplianceScan
name: workers-scan
description: <description of scan check>
instructions: <manual instructions for the scan>
id: xccdf_org.ssgproject.content_rule_no_direct_root_logins
severity: medium
status: FAIL
- 1
- Describes the severity of the scan check.
- 2
- Describes the result of the check. The possible values are:
- PASS: check was successful.
- FAIL: check was unsuccessful.
- INFO: check was successful and found something not severe enough to be considered an error.
- MANUAL: check cannot automatically assess the status and manual check is required.
- INCONSISTENT: different nodes report different results.
- ERROR: check run successfully, but could not complete.
- NOTAPPLICABLE: check did not run as it is not applicable.
To get all the check results from a suite, run the following command:
oc get compliancecheckresults \
-l compliance.openshift.io/suite=workers-compliancesuite
5.4.2.6.2. ComplianceRemediation object Link kopierenLink in die Zwischenablage kopiert!
For a specific check you can have a datastream specified fix. However, if a Kubernetes fix is available, then the Compliance Operator creates a
ComplianceRemediation
Example ComplianceRemediation object
apiVersion: compliance.openshift.io/v1alpha1
kind: ComplianceRemediation
metadata:
labels:
compliance.openshift.io/suite: example-compliancesuite
compliance.openshift.io/scan-name: workers-scan
machineconfiguration.openshift.io/role: worker
name: workers-scan-disable-users-coredumps
namespace: openshift-compliance
ownerReferences:
- apiVersion: compliance.openshift.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: ComplianceCheckResult
name: workers-scan-disable-users-coredumps
uid: <UID>
spec:
apply: false
object:
current:
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
spec:
config:
ignition:
version: 2.2.0
storage:
files:
- contents:
source: data:,%2A%20%20%20%20%20hard%20%20%20core%20%20%20%200
filesystem: root
mode: 420
path: /etc/security/limits.d/75-disable_users_coredumps.conf
outdated: {}
- 1
trueindicates the remediation was applied.falseindicates the remediation was not applied.- 2
- Includes the definition of the remediation.
- 3
- Indicates remediation that was previously parsed from an earlier version of the content. The Compliance Operator still retains the outdated objects to give the administrator a chance to review the new remediations before applying them.
To get all the remediations from a suite, run the following command:
oc get complianceremediations \
-l compliance.openshift.io/suite=workers-compliancesuite
To list all failing checks that can be remediated automatically, run the following command:
oc get compliancecheckresults \
-l 'compliance.openshift.io/check-status in (FAIL),compliance.openshift.io/automated-remediation'
To list all failing checks that can be remediated manually, run the following command:
oc get compliancecheckresults \
-l 'compliance.openshift.io/check-status in (FAIL),!compliance.openshift.io/automated-remediation'
5.5. Compliance Operator management Link kopierenLink in die Zwischenablage kopiert!
5.5.1. Installing the Compliance Operator Link kopierenLink in die Zwischenablage kopiert!
Before you can use the Compliance Operator, you must ensure it is deployed in the cluster.
All cluster nodes must have the same release version in order for this Operator to function properly. As an example, for nodes running RHCOS, all nodes must have the same RHCOS version.
The Compliance Operator might report incorrect results on managed platforms, such as OpenShift Dedicated, Red Hat OpenShift Service on AWS Classic, and Microsoft Azure Red Hat OpenShift. For more information, see the Knowledgebase article Compliance Operator reports incorrect results on Managed Services.
Before deploying the Compliance Operator, you are required to define persistent storage in your cluster to store the raw results output. For more information, see Persistent storage overview and Managing the default storage class.
5.5.1.1. Installing the Compliance Operator through the web console Link kopierenLink in die Zwischenablage kopiert!
Prerequisites
-
You must have privileges.
admin -
You must have a resource configured.
StorageClass
Procedure
-
In the OpenShift Container Platform web console, navigate to Operators
OperatorHub. - Search for the Compliance Operator, then click Install.
-
Keep the default selection of Installation mode and namespace to ensure that the Operator will be installed to the namespace.
openshift-compliance - Click Install.
Verification
To confirm that the installation is successful:
-
Navigate to the Operators
Installed Operators page. -
Check that the Compliance Operator is installed in the namespace and its status is
openshift-compliance.Succeeded
If the Operator is not installed successfully:
-
Navigate to the Operators
Installed Operators page and inspect the column for any errors or failures.Status -
Navigate to the Workloads
Pods page and check the logs in any pods in the project that are reporting issues.openshift-compliance
If the
restricted
system:authenticated
requiredDropCapabilities
You can create a custom SCC for the Compliance Operator scanner pod service account. For more information, see Creating a custom SCC for the Compliance Operator.
5.5.1.2. Installing the Compliance Operator using the CLI Link kopierenLink in die Zwischenablage kopiert!
Prerequisites
-
You must have privileges.
admin -
You must have a resource configured.
StorageClass
Procedure
Define a
object:NamespaceExample
namespace-object.yamlapiVersion: v1 kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" pod-security.kubernetes.io/enforce: privileged1 name: openshift-compliance- 1
- In OpenShift Container Platform 4.14, the pod security label must be set to
privilegedat the namespace level.
Create the
object:Namespace$ oc create -f namespace-object.yamlDefine an
object:OperatorGroupExample
operator-group-object.yamlapiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: compliance-operator namespace: openshift-compliance spec: targetNamespaces: - openshift-complianceCreate the
object:OperatorGroup$ oc create -f operator-group-object.yamlDefine a
object:SubscriptionExample
subscription-object.yamlapiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: compliance-operator-sub namespace: openshift-compliance spec: channel: "stable" installPlanApproval: Automatic name: compliance-operator source: redhat-operators sourceNamespace: openshift-marketplaceCreate the
object:Subscription$ oc create -f subscription-object.yaml
If you are setting the global scheduler feature and enable
defaultNodeSelector
openshift-compliance
openshift.io/node-selector: “”
Verification
Verify the installation succeeded by inspecting the CSV file:
$ oc get csv -n openshift-complianceVerify that the Compliance Operator is up and running:
$ oc get deploy -n openshift-compliance
5.5.1.3. Installing the Compliance Operator on ROSA hosted control planes (HCP) Link kopierenLink in die Zwischenablage kopiert!
As of the Compliance Operator 1.5.0 release, the Operator is tested against Red Hat OpenShift Service on AWS using Hosted control planes.
Red Hat OpenShift Service on AWS Hosted control planes clusters have restricted access to the control plane, which is managed by Red Hat. By default, the Compliance Operator will schedule to nodes within the
master
Subscription
Prerequisites
-
You must have privileges.
admin -
You must have a resource configured.
StorageClass
Procedure
Define a
object:NamespaceExample
namespace-object.yamlfileapiVersion: v1 kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" pod-security.kubernetes.io/enforce: privileged1 name: openshift-compliance- 1
- In OpenShift Container Platform 4.14, the pod security label must be set to
privilegedat the namespace level.
Create the
object by running the following command:Namespace$ oc create -f namespace-object.yamlDefine an
object:OperatorGroupExample
operator-group-object.yamlfileapiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: compliance-operator namespace: openshift-compliance spec: targetNamespaces: - openshift-complianceCreate the
object by running the following command:OperatorGroup$ oc create -f operator-group-object.yamlDefine a
object:SubscriptionExample
subscription-object.yamlfileapiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: compliance-operator-sub namespace: openshift-compliance spec: channel: "stable" installPlanApproval: Automatic name: compliance-operator source: redhat-operators sourceNamespace: openshift-marketplace config: nodeSelector: node-role.kubernetes.io/worker: ""1 - 1
- Update the Operator deployment to deploy on
workernodes.
Create the
object by running the following command:Subscription$ oc create -f subscription-object.yaml
Verification
Verify that the installation succeeded by running the following command to inspect the cluster service version (CSV) file:
$ oc get csv -n openshift-complianceVerify that the Compliance Operator is up and running by using the following command:
$ oc get deploy -n openshift-compliance
If the
restricted
system:authenticated
requiredDropCapabilities
You can create a custom SCC for the Compliance Operator scanner pod service account. For more information, see Creating a custom SCC for the Compliance Operator.
5.5.1.4. Installing the Compliance Operator on Hypershift hosted control planes Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator can be installed in hosted control planes using the OperatorHub by creating a
Subscription
Hosted control planes is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
Prerequisites
-
You must have privileges.
admin
Procedure
Define a
object similar to the following:NamespaceExample
namespace-object.yamlapiVersion: v1 kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" pod-security.kubernetes.io/enforce: privileged1 name: openshift-compliance- 1
- In OpenShift Container Platform 4.14, the pod security label must be set to
privilegedat the namespace level.
Create the
object by running the following command:Namespace$ oc create -f namespace-object.yamlDefine an
object:OperatorGroupExample
operator-group-object.yamlapiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: compliance-operator namespace: openshift-compliance spec: targetNamespaces: - openshift-complianceCreate the
object by running the following command:OperatorGroup$ oc create -f operator-group-object.yamlDefine a
object:SubscriptionExample
subscription-object.yamlapiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: compliance-operator-sub namespace: openshift-compliance spec: channel: "stable" installPlanApproval: Automatic name: compliance-operator source: redhat-operators sourceNamespace: openshift-marketplace config: nodeSelector: node-role.kubernetes.io/worker: "" env: - name: PLATFORM value: "HyperShift"Create the
object by running the following command:Subscription$ oc create -f subscription-object.yaml
Verification
Verify the installation succeeded by inspecting the CSV file by running the following command:
$ oc get csv -n openshift-complianceVerify that the Compliance Operator is up and running by running the following command:
$ oc get deploy -n openshift-compliance
5.5.2. Updating the Compliance Operator Link kopierenLink in die Zwischenablage kopiert!
As a cluster administrator, you can update the Compliance Operator on your OpenShift Container Platform cluster.
It is recommended to update the Compliance Operator to version 1.3.1 or later before updating your OpenShift Container Platform cluster to version 4.14 or later.
5.5.2.1. Preparing for an Operator update Link kopierenLink in die Zwischenablage kopiert!
The subscription of an installed Operator specifies an update channel that tracks and receives updates for the Operator. You can change the update channel to start tracking and receiving updates from a newer channel.
The names of update channels in a subscription can differ between Operators, but the naming scheme typically follows a common convention within a given Operator. For example, channel names might follow a minor release update stream for the application provided by the Operator (
1.2
1.3
stable
fast
You cannot change installed Operators to a channel that is older than the current channel.
Red Hat Customer Portal Labs include the following application that helps administrators prepare to update their Operators:
You can use the application to search for Operator Lifecycle Manager-based Operators and verify the available Operator version per update channel across different versions of OpenShift Container Platform. Cluster Version Operator-based Operators are not included.
5.5.2.2. Changing the update channel for an Operator Link kopierenLink in die Zwischenablage kopiert!
You can change the update channel for an Operator by using the OpenShift Container Platform web console.
If the approval strategy in the subscription is set to Automatic, the update process initiates as soon as a new Operator version is available in the selected channel. If the approval strategy is set to Manual, you must manually approve pending updates.
Prerequisites
- An Operator previously installed using Operator Lifecycle Manager (OLM).
Procedure
-
In the Administrator perspective of the web console, navigate to Operators
Installed Operators. - Click the name of the Operator you want to change the update channel for.
- Click the Subscription tab.
- Click the name of the update channel under Update channel.
- Click the newer update channel that you want to change to, then click Save.
For subscriptions with an Automatic approval strategy, the update begins automatically. Navigate back to the Operators
Installed Operators page to monitor the progress of the update. When complete, the status changes to Succeeded and Up to date. For subscriptions with a Manual approval strategy, you can manually approve the update from the Subscription tab.
5.5.2.3. Manually approving a pending Operator update Link kopierenLink in die Zwischenablage kopiert!
If an installed Operator has the approval strategy in its subscription set to Manual, when new updates are released in its current update channel, the update must be manually approved before installation can begin.
Prerequisites
- An Operator previously installed using Operator Lifecycle Manager (OLM).
Procedure
-
In the Administrator perspective of the OpenShift Container Platform web console, navigate to Operators
Installed Operators. - Operators that have a pending update display a status with Upgrade available. Click the name of the Operator you want to update.
- Click the Subscription tab. Any updates requiring approval are displayed next to Upgrade status. For example, it might display 1 requires approval.
- Click 1 requires approval, then click Preview Install Plan.
- Review the resources that are listed as available for update. When satisfied, click Approve.
-
Navigate back to the Operators
Installed Operators page to monitor the progress of the update. When complete, the status changes to Succeeded and Up to date.
5.5.3. Managing the Compliance Operator Link kopierenLink in die Zwischenablage kopiert!
This section describes the lifecycle of security content, including how to use an updated version of compliance content and how to create a custom
ProfileBundle
5.5.3.1. ProfileBundle CR example Link kopierenLink in die Zwischenablage kopiert!
The
ProfileBundle
contentImage
contentFile
rhcos4
ProfileBundle
apiVersion: compliance.openshift.io/v1alpha1
kind: ProfileBundle
metadata:
creationTimestamp: "2022-10-19T12:06:30Z"
finalizers:
- profilebundle.finalizers.compliance.openshift.io
generation: 1
name: rhcos4
namespace: openshift-compliance
resourceVersion: "46741"
uid: 22350850-af4a-4f5c-9a42-5e7b68b82d7d
spec:
contentFile: ssg-rhcos4-ds.xml
contentImage: registry.redhat.io/compliance/openshift-compliance-content-rhel8@sha256:900e...
status:
conditions:
- lastTransitionTime: "2022-10-19T12:07:51Z"
message: Profile bundle successfully parsed
reason: Valid
status: "True"
type: Ready
dataStreamStatus: VALID
5.5.3.2. Updating security content Link kopierenLink in die Zwischenablage kopiert!
Security content is included as container images that the
ProfileBundle
ProfileBundles
$ oc -n openshift-compliance get profilebundles rhcos4 -oyaml
Example output
apiVersion: compliance.openshift.io/v1alpha1
kind: ProfileBundle
metadata:
creationTimestamp: "2022-10-19T12:06:30Z"
finalizers:
- profilebundle.finalizers.compliance.openshift.io
generation: 1
name: rhcos4
namespace: openshift-compliance
resourceVersion: "46741"
uid: 22350850-af4a-4f5c-9a42-5e7b68b82d7d
spec:
contentFile: ssg-rhcos4-ds.xml
contentImage: registry.redhat.io/compliance/openshift-compliance-content-rhel8@sha256:900e...
status:
conditions:
- lastTransitionTime: "2022-10-19T12:07:51Z"
message: Profile bundle successfully parsed
reason: Valid
status: "True"
type: Ready
dataStreamStatus: VALID
- 1
- Security container image.
Each
ProfileBundle
5.5.4. Uninstalling the Compliance Operator Link kopierenLink in die Zwischenablage kopiert!
You can remove the OpenShift Compliance Operator from your cluster by using the OpenShift Container Platform web console or the CLI.
5.5.4.1. Uninstalling the OpenShift Compliance Operator from OpenShift Container Platform using the web console Link kopierenLink in die Zwischenablage kopiert!
To remove the Compliance Operator, you must first delete the objects in the namespace. After the objects are removed, you can remove the Operator and its namespace by deleting the openshift-compliance project.
Prerequisites
-
Access to an OpenShift Container Platform cluster using an account with permissions.
cluster-admin - The OpenShift Compliance Operator must be installed.
Procedure
To remove the Compliance Operator by using the OpenShift Container Platform web console:
Go to the Operators
Installed Operators Compliance Operator page. - Click All instances.
-
In All namespaces, click the Options menu
and delete all ScanSettingBinding, ComplainceSuite, ComplianceScan, and ProfileBundle objects.
-
Switch to the Administration
Operators Installed Operators page. -
Click the Options menu
on the Compliance Operator entry and select Uninstall Operator.
-
Switch to the Home
Projects page. - Search for 'compliance'.
Click the Options menu
next to the openshift-compliance project, and select Delete Project.
-
Confirm the deletion by typing in the dialog box, and click Delete.
openshift-compliance
-
Confirm the deletion by typing
5.5.4.2. Uninstalling the OpenShift Compliance Operator from OpenShift Container Platform using the CLI Link kopierenLink in die Zwischenablage kopiert!
To remove the Compliance Operator, you must first delete the objects in the namespace. After the objects are removed, you can remove the Operator and its namespace by deleting the openshift-compliance project.
Prerequisites
-
Access to an OpenShift Container Platform cluster using an account with permissions.
cluster-admin - The OpenShift Compliance Operator must be installed.
Procedure
Delete all objects in the namespace.
Delete the
objects:ScanSettingBinding$ oc delete ssb --all -n openshift-complianceDelete the
objects:ScanSetting$ oc delete ss --all -n openshift-complianceDelete the
objects:ComplianceSuite$ oc delete suite --all -n openshift-complianceDelete the
objects:ComplianceScan$ oc delete scan --all -n openshift-complianceDelete the
objects:ProfileBundle$ oc delete profilebundle.compliance --all -n openshift-compliance
Delete the Subscription object:
$ oc delete sub --all -n openshift-complianceDelete the CSV object:
$ oc delete csv --all -n openshift-complianceDelete the project:
$ oc delete project openshift-complianceExample output
project.project.openshift.io "openshift-compliance" deleted
Verification
Confirm the namespace is deleted:
$ oc get project/openshift-complianceExample output
Error from server (NotFound): namespaces "openshift-compliance" not found
5.6. Compliance Operator scan management Link kopierenLink in die Zwischenablage kopiert!
5.6.1. Supported compliance profiles Link kopierenLink in die Zwischenablage kopiert!
There are several profiles available as part of the Compliance Operator (CO) installation. While you can use the following profiles to assess gaps in a cluster, usage alone does not infer or guarantee compliance with a particular profile and is not an auditor.
In order to be compliant or certified under these various standards, you need to engage an authorized auditor such as a Qualified Security Assessor (QSA), Joint Authorization Board (JAB), or other industry recognized regulatory authority to assess your environment. You are required to work with an authorized auditor to achieve compliance with a standard.
For more information on compliance support for all Red Hat products, see Product Compliance.
The Compliance Operator might report incorrect results on some managed platforms, such as OpenShift Dedicated and Azure Red Hat OpenShift. For more information, see the Red Hat Knowledgebase Solution #6983418.
5.6.1.1. Compliance profiles Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator provides profiles to meet industry standard benchmarks.
The following tables reflect the latest available profiles in the Compliance Operator.
5.6.1.1.1. CIS compliance profiles Link kopierenLink in die Zwischenablage kopiert!
| Profile | Profile title | Application | Industry compliance benchmark | Supported architectures | Supported platforms |
|---|---|---|---|---|---|
| ocp4-cis [1] | CIS Red Hat OpenShift Container Platform Benchmark v1.7.0 | Platform | CIS Benchmarks ™ [4] |
| |
| ocp4-cis-1-7[3] | CIS Red Hat OpenShift Container Platform Benchmark v1.7.0 | Platform | CIS Benchmarks ™ [4] |
| |
| ocp4-cis-node [1] | CIS Red Hat OpenShift Container Platform Benchmark v1.7.0 | Node [2] | CIS Benchmarks ™ [4] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) |
| ocp4-cis-node-1-7[3] | CIS Red Hat OpenShift Container Platform Benchmark v1.7.0 | Node [2] | CIS Benchmarks ™ [4] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) |
-
The and
ocp4-cisprofiles maintain the most up-to-date version of the CIS benchmark as it becomes available in the Compliance Operator. If you want to adhere to a specific version, such as CIS v1.7.0, use theocp4-cis-nodeandocp4-cis-1-7profiles.ocp4-cis-node-1-7 - Node profiles must be used with the relevant Platform profile. For more information, see Compliance Operator profile types.
- All earlier CIS profiles are superceded by CIS v1.7.0. It is recommended to apply the latest profile to your environment.
- To locate the CIS OpenShift Container Platform v4 Benchmark, go to CIS Benchmarks and click Download Latest CIS Benchmark, where you can then register to download the benchmark.
5.6.1.1.2. BSI Profile Support Link kopierenLink in die Zwischenablage kopiert!
| Profile | Profile title | Application | Industry compliance benchmark | Supported architectures | Supported platforms |
|---|---|---|---|---|---|
| ocp4-bsi [1] | BSI IT-Grundschutz (Basic Protection) Building Block SYS.1.6 and APP.4.4 | Platform |
| ||
| ocp4-bsi-node [1] | BSI IT-Grundschutz (Basic Protection) Building Block SYS.1.6 and APP.4.4 | Node [2] |
| ||
| ocp4-bsi-2022 [3] | BSI IT-Grundschutz (Basic Protection) Building Block SYS.1.6 and APP.4.4 | Platform |
| ||
| ocp4-bsi-node-2022 [3] | BSI IT-Grundschutz (Basic Protection) Building Block SYS.1.6 and APP.4.4 | Node [2] |
| ||
| rhcos4-bsi [3] | BSI IT-Grundschutz (Basic Protection) Building Block SYS.1.6 and APP.4.4 | Node [2] |
| ||
| ocp4-bsi-2022 [3] | BSI IT-Grundschutz (Basic Protection) Building Block SYS.1.6 and APP.4.4 | Node [2] |
|
-
The and
ocp4-bsiprofiles maintain the most up-to-date version of the BSI Basic Protection Profile as it becomes available in the Compliance Operator. If you want to adhere to a specific version, such as BSI 2022, use theocp4-bsi-nodeandocp4-bsi-2022profiles.ocp4-bsi-node-2022 - Node profiles must be used with the relevant Platform profile. For more information, see Compliance Operator profile types.
- Edition 2022 is the latest available English edition of the BSI IT-Grundschutz (Basic Protection) compendium. There were no changes for Building Blocks SYS.1.6 and APP.4.4 in the latest published German compendium (edition 2023).
For more information, see BSI Quick Check.
5.6.1.1.3. Essential Eight compliance profiles Link kopierenLink in die Zwischenablage kopiert!
| Profile | Profile title | Application | Industry compliance benchmark | Supported architectures | Supported platforms |
|---|---|---|---|---|---|
| ocp4-e8 | Australian Cyber Security Centre (ACSC) Essential Eight | Platform |
| ||
| rhcos4-e8 | Australian Cyber Security Centre (ACSC) Essential Eight | Node |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) |
5.6.1.1.4. FedRAMP High compliance profiles Link kopierenLink in die Zwischenablage kopiert!
Applying automatic remedations to any profile, such as
rhcos4-stig
service-sshd-disabled
sshd
TailoredProfile
rhcos4-service-sshd-disabled
disableRules
| Profile | Profile title | Application | Industry compliance benchmark | Supported architectures | Supported platforms |
|---|---|---|---|---|---|
| ocp4-high [1] | NIST 800-53 High-Impact Baseline for Red Hat OpenShift - Platform level | Platform |
| ||
| ocp4-high-node [1] | NIST 800-53 High-Impact Baseline for Red Hat OpenShift - Node level | Node [2] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| ocp4-high-node-rev-4 | NIST 800-53 High-Impact Baseline for Red Hat OpenShift - Node level | Node [2] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| ocp4-high-rev-4 | NIST 800-53 High-Impact Baseline for Red Hat OpenShift - Platform level | Platform |
| ||
| rhcos4-high [1] | NIST 800-53 High-Impact Baseline for Red Hat Enterprise Linux CoreOS | Node |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| rhcos4-high-rev-4 | NIST 800-53 High-Impact Baseline for Red Hat Enterprise Linux CoreOS | Node |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) |
-
The ,
ocp4-highandocp4-high-nodeprofiles maintain the most up-to-date version of the FedRAMP High standard as it becomes available in the Compliance Operator. If you want to adhere to a specific version, such as FedRAMP high R4, use therhcos4-highandocp4-high-rev-4profiles.ocp4-high-node-rev-4 - Node profiles must be used with the relevant Platform profile. For more information, see Compliance Operator profile types.
5.6.1.1.5. FedRAMP Moderate compliance profiles Link kopierenLink in die Zwischenablage kopiert!
| Profile | Profile title | Application | Industry compliance benchmark | Supported architectures | Supported platforms |
|---|---|---|---|---|---|
| ocp4-moderate [1] | NIST 800-53 Moderate-Impact Baseline for Red Hat OpenShift - Platform level | Platform |
| ||
| ocp4-moderate-node [1] | NIST 800-53 Moderate-Impact Baseline for Red Hat OpenShift - Node level | Node [2] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| ocp4-moderate-node-rev-4 | NIST 800-53 Moderate-Impact Baseline for Red Hat OpenShift - Node level | Node [2] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| ocp4-moderate-rev-4 | NIST 800-53 Moderate-Impact Baseline for Red Hat OpenShift - Platform level | Platform |
| ||
| rhcos4-moderate [1] | NIST 800-53 Moderate-Impact Baseline for Red Hat Enterprise Linux CoreOS | Node |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| rhcos4-moderate-rev-4 | NIST 800-53 Moderate-Impact Baseline for Red Hat Enterprise Linux CoreOS | Node |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) |
-
The ,
ocp4-moderateandocp4-moderate-nodeprofiles maintain the most up-to-date version of the FedRAMP Moderate standard as it becomes available in the Compliance Operator. If you want to adhere to a specific version, such as FedRAMP Moderate R4, use therhcos4-moderateandocp4-moderate-rev-4profiles.ocp4-moderate-node-rev-4 - Node profiles must be used with the relevant Platform profile. For more information, see Compliance Operator profile types.
5.6.1.1.6. NERC-CIP compliance profiles Link kopierenLink in die Zwischenablage kopiert!
| Profile | Profile title | Application | Industry compliance benchmark | Supported architectures | Supported platforms |
|---|---|---|---|---|---|
| ocp4-nerc-cip | North American Electric Reliability Corporation (NERC) Critical Infrastructure Protection (CIP) cybersecurity standards profile for the OpenShift Container Platform - Platform level | Platform |
| ||
| ocp4-nerc-cip-node | North American Electric Reliability Corporation (NERC) Critical Infrastructure Protection (CIP) cybersecurity standards profile for the OpenShift Container Platform - Node level | Node [1] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| rhcos4-nerc-cip | North American Electric Reliability Corporation (NERC) Critical Infrastructure Protection (CIP) cybersecurity standards profile for Red Hat Enterprise Linux CoreOS | Node |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) |
- Node profiles must be used with the relevant Platform profile. For more information, see Compliance Operator profile types.
5.6.1.1.7. PCI-DSS compliance profiles Link kopierenLink in die Zwischenablage kopiert!
| Profile | Profile title | Application | Industry compliance benchmark | Supported architectures | Supported platforms |
|---|---|---|---|---|---|
| ocp4-pci-dss [1] | PCI-DSS v4 Control Baseline for OpenShift Container Platform 4 | Platform |
| ||
| ocp4-pci-dss-3-2 [3] | PCI-DSS v3.2.1 Control Baseline for OpenShift Container Platform 4 | Platform |
| ||
| ocp4-pci-dss-4-0 | PCI-DSS v4 Control Baseline for OpenShift Container Platform 4 | Platform |
| ||
| ocp4-pci-dss-node [1] | PCI-DSS v4 Control Baseline for OpenShift Container Platform 4 | Node [2] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| ocp4-pci-dss-node-3-2 [3] | PCI-DSS v3.2.1 Control Baseline for OpenShift Container Platform 4 | Node [2] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| ocp4-pci-dss-node-4-0 | PCI-DSS v4 Control Baseline for OpenShift Container Platform 4 | Node [2] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) |
-
The and
ocp4-pci-dssprofiles maintain the most up-to-date version of the PCI-DSS standard as it becomes available in the Compliance Operator. If you want to adhere to a specific version, such as PCI-DSS v3.2.1, use theocp4-pci-dss-nodeandocp4-pci-dss-3-2profiles.ocp4-pci-dss-node-3-2 - Node profiles must be used with the relevant Platform profile. For more information, see Compliance Operator profile types.
- PCI-DSS v3.2.1 is superceded by PCI-DSS v4. It is recommended to apply the latest profile to your environment.
5.6.1.1.8. STIG compliance profiles Link kopierenLink in die Zwischenablage kopiert!
Applying automatic remedations to any profile, such as
rhcos4-stig
service-sshd-disabled
sshd
TailoredProfile
rhcos4-service-sshd-disabled
disableRules
| Profile | Profile title | Application | Industry compliance benchmark | Supported architectures | Supported platforms |
|---|---|---|---|---|---|
| ocp4-stig [1] | Defense Information Systems Agency Security Technical Implementation Guide (DISA STIG) for Red Hat Openshift[3] | Platform |
| ||
| ocp4-stig-node [1] | Defense Information Systems Agency Security Technical Implementation Guide (DISA STIG) for Red Hat Openshift[3] | Node [2] |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| ocp4-stig-v2r3 | Defense Information Systems Agency Security Technical Implementation Guide (DISA STIG) for Red Hat Openshift V2R3 | Platform |
| ||
| ocp4-stig-node-v2r3 [1] | Defense Information Systems Agency Security Technical Implementation Guide (DISA STIG) for Red Hat Openshift V2R3 | Node |
| ||
| rhcos4-stig[1] | Defense Information Systems Agency Security Technical Implementation Guide (DISA STIG) for Red Hat Openshift[3] | Node |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) | |
| rhcos4-stig-v2r3 | Defense Information Systems Agency Security Technical Implementation Guide (DISA STIG) for Red Hat Openshift V2R3 | Node |
| Red Hat OpenShift Service on AWS with hosted control planes (ROSA HCP) |
-
The ,
ocp4-stigandocp4-stig-nodeprofiles maintain the most up-to-date version of the DISA-STIG benchmark as it becomes available in the Compliance Operator. If you want to adhere to a specific version, such as DISA-STIG V2R3, use therhcos4-stigandocp4-stig-v2r3profiles.ocp4-stig-node-v2r3 - Node profiles must be used with the relevant Platform profile. For more information, see Compliance Operator profile types.
- DISA-STIG V1R2 is superceded by DISA-STIG V2R3. It is recommended to apply the latest profile to your environment.
5.6.1.1.9. About extended compliance profiles Link kopierenLink in die Zwischenablage kopiert!
Some compliance profiles have controls that require following industry best practices, resulting in some profiles extending others. Combining the Center for Internet Security (CIS) best practices with National Institute of Standards and Technology (NIST) security frameworks establishes a path to a secure and compliant environment.
For example, the NIST High-Impact and Moderate-Impact profiles extend the CIS profile to achieve compliance. As a result, extended compliance profiles eliminate the need to run both profiles in a single cluster.
| Profile | Extends |
|---|---|
| ocp4-pci-dss | ocp4-cis |
| ocp4-pci-dss-node | ocp4-cis-node |
| ocp4-high | ocp4-cis |
| ocp4-high-node | ocp4-cis-node |
| ocp4-moderate | ocp4-cis |
| ocp4-moderate-node | ocp4-cis-node |
| ocp4-nerc-cip | ocp4-moderate |
| ocp4-nerc-cip-node | ocp4-moderate-node |
5.6.1.1.10. Compliance Operator profile types Link kopierenLink in die Zwischenablage kopiert!
Compliance Operator rules are organized into profiles. Profiles can target the Platform or Nodes for OpenShift Container Platform, and some benchmarks include
rhcos4
- Platform
- Platform profiles evaluate your OpenShift Container Platform cluster components. For example, a Platform-level rule can confirm whether APIServer configurations are using strong encryption cyphers.
- Node
-
Node profiles evaluate the OpenShift or RHCOS configuration of each host. You can use two Node profiles:
ocp4Node profiles andrhcos4Node profiles. Theocp4Node profiles evaluate the OpenShift configuration of each host. For example, they can confirm whetherkubeconfigfiles have the correct permissions to meet a compliance standard. Therhcos4Node profiles evaluate the Red Hat Enterprise Linux CoreOS (RHCOS) configuration of each host. For example, they can confirm whether the SSHD service is configured to disable password logins.
For benchmarks that have Node and Platform profiles, such as PCI-DSS, you must run both profiles in your OpenShift Container Platform environment.
For benchmarks that have
ocp4
ocp4
rhcos4
In a cluster with many Nodes, both
ocp4
rhcos4
5.6.2. Compliance Operator scans Link kopierenLink in die Zwischenablage kopiert!
The
ScanSetting
ScanSettingBinding
$ oc explain scansettings
or
$ oc explain scansettingbindings
5.6.2.1. Running compliance scans Link kopierenLink in die Zwischenablage kopiert!
You can run a scan using the Center for Internet Security (CIS) profiles. For convenience, the Compliance Operator creates a
ScanSetting
ScanSetting
default
For all-in-one control plane and worker nodes, the compliance scan runs twice on the worker and control plane nodes. The compliance scan might generate inconsistent scan results. You can avoid inconsistent results by defining only a single role in the
ScanSetting
Compliance Operator scans report
INCONSISTENT
aarch64
x86
For more information about inconsistent scan results, see Compliance Operator shows INCONSISTENT scan result with worker node.
Procedure
Inspect the
object by running the following command:ScanSetting$ oc describe scansettings default -n openshift-complianceExample output
Name: default Namespace: openshift-compliance Labels: <none> Annotations: <none> API Version: compliance.openshift.io/v1alpha1 Kind: ScanSetting Max Retry On Timeout: 3 Metadata: Creation Timestamp: 2024-07-16T14:56:42Z Generation: 2 Resource Version: 91655682 UID: 50358cf1-57a8-4f69-ac50-5c7a5938e402 Raw Result Storage: Node Selector: node-role.kubernetes.io/master: Pv Access Modes: ReadWriteOnce1 Rotation: 32 Size: 1Gi3 Storage Class Name: standard4 Tolerations: Effect: NoSchedule Key: node-role.kubernetes.io/master Operator: Exists Effect: NoExecute Key: node.kubernetes.io/not-ready Operator: Exists Toleration Seconds: 300 Effect: NoExecute Key: node.kubernetes.io/unreachable Operator: Exists Toleration Seconds: 300 Effect: NoSchedule Key: node.kubernetes.io/memory-pressure Operator: Exists Roles: master5 worker6 Scan Tolerations:7 Operator: Exists Schedule: 0 1 * * *8 Show Not Applicable: false Strict Node Scan: true Suspend: false Timeout: 30m Events: <none>- 1
- The Compliance Operator creates a persistent volume (PV) that contains the results of the scans. By default, the PV will use access mode
ReadWriteOncebecause the Compliance Operator cannot make any assumptions about the storage classes configured on the cluster. Additionally,ReadWriteOnceaccess mode is available on most clusters. If you need to fetch the scan results, you can do so by using a helper pod, which also binds the volume. Volumes that use theReadWriteOnceaccess mode can be mounted by only one pod at time, so it is important to remember to delete the helper pods. Otherwise, the Compliance Operator will not be able to reuse the volume for subsequent scans. - 2
- The Compliance Operator keeps results of three subsequent scans in the volume; older scans are rotated.
- 3
- The Compliance Operator will allocate one GB of storage for the scan results.
- 4
- The
scansetting.rawResultStorage.storageClassNamefield specifies thestorageClassNamevalue to use when creating thePersistentVolumeClaimobject to store the raw results. The default value is null, which will attempt to use the default storage class configured in the cluster. If there is no default class specified, then you must set a default class. - 5 6
- If the scan setting uses any profiles that scan cluster nodes, scan these node roles.
- 7
- The default scan setting object scans all the nodes.
- 8
- The default scan setting object runs scans at 01:00 each day.
As an alternative to the default scan setting, you can use
, which has the following settings:default-auto-applyName: default-auto-apply Namespace: openshift-compliance Labels: <none> Annotations: <none> API Version: compliance.openshift.io/v1alpha1 Auto Apply Remediations: true1 Auto Update Remediations: true2 Kind: ScanSetting Metadata: Creation Timestamp: 2022-10-18T20:21:00Z Generation: 1 Managed Fields: API Version: compliance.openshift.io/v1alpha1 Fields Type: FieldsV1 fieldsV1: f:autoApplyRemediations: f:autoUpdateRemediations: f:rawResultStorage: .: f:nodeSelector: .: f:node-role.kubernetes.io/master: f:pvAccessModes: f:rotation: f:size: f:tolerations: f:roles: f:scanTolerations: f:schedule: f:showNotApplicable: f:strictNodeScan: Manager: compliance-operator Operation: Update Time: 2022-10-18T20:21:00Z Resource Version: 38840 UID: 8cb0967d-05e0-4d7a-ac1c-08a7f7e89e84 Raw Result Storage: Node Selector: node-role.kubernetes.io/master: Pv Access Modes: ReadWriteOnce Rotation: 3 Size: 1Gi Tolerations: Effect: NoSchedule Key: node-role.kubernetes.io/master Operator: Exists Effect: NoExecute Key: node.kubernetes.io/not-ready Operator: Exists Toleration Seconds: 300 Effect: NoExecute Key: node.kubernetes.io/unreachable Operator: Exists Toleration Seconds: 300 Effect: NoSchedule Key: node.kubernetes.io/memory-pressure Operator: Exists Roles: master worker Scan Tolerations: Operator: Exists Schedule: 0 1 * * * Show Not Applicable: false Strict Node Scan: true Events: <none>Create a
object that binds to the defaultScanSettingBindingobject and scans the cluster using theScanSettingandcisprofiles. For example:cis-nodeapiVersion: compliance.openshift.io/v1alpha1 kind: ScanSettingBinding metadata: name: cis-compliance namespace: openshift-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
object by running:ScanSettingBinding$ oc create -f <file-name>.yaml -n openshift-complianceAt this point in the process, the
object is reconciled and based on theScanSettingBindingand theBindingsettings. The Compliance Operator creates aBoundobject and the associatedComplianceSuiteobjects.ComplianceScanFollow the compliance scan progress by running:
$ oc get compliancescan -w -n openshift-complianceThe scans progress through the scanning phases and eventually reach the
phase when complete. In most cases, the result of the scan isDONE. You can review the scan results and start applying remediations to make the cluster compliant. See Managing Compliance Operator remediation for more information.NON-COMPLIANT
5.6.2.2. Setting custom storage size for results Link kopierenLink in die Zwischenablage kopiert!
While the custom resources such as
ComplianceCheckResult
etcd
rawResultStorage.size
ScanSetting
ComplianceScan
A related parameter is
rawResultStorage.rotation
5.6.2.2.1. Using custom result storage values Link kopierenLink in die Zwischenablage kopiert!
Because OpenShift Container Platform can be deployed in a variety of public clouds or bare metal, the Compliance Operator cannot determine available storage configurations. By default, the Compliance Operator will try to create the PV for storing results using the default storage class of the cluster, but a custom storage class can be configured using the
rawResultStorage.StorageClassName
If your cluster does not specify a default storage class, this attribute must be set.
Configure the
ScanSetting
Example ScanSetting CR
apiVersion: compliance.openshift.io/v1alpha1
kind: ScanSetting
metadata:
name: default
namespace: openshift-compliance
rawResultStorage:
storageClassName: standard
rotation: 10
size: 10Gi
roles:
- worker
- master
scanTolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists
schedule: '0 1 * * *'
5.6.2.3. Scheduling the result server pod on a worker node Link kopierenLink in die Zwischenablage kopiert!
The result server pod mounts the persistent volume (PV) that stores the raw Asset Reporting Format (ARF) scan results. The
nodeSelector
tolerations
This is helpful for those environments where control plane nodes are not permitted to mount persistent volumes.
Procedure
Create a
custom resource (CR) for the Compliance Operator:ScanSettingDefine the
CR, and save the YAML file, for example,ScanSetting:rs-workers.yamlapiVersion: compliance.openshift.io/v1alpha1 kind: ScanSetting metadata: name: rs-on-workers namespace: openshift-compliance rawResultStorage: nodeSelector: node-role.kubernetes.io/worker: ""1 pvAccessModes: - ReadWriteOnce rotation: 3 size: 1Gi tolerations: - operator: Exists2 roles: - worker - master scanTolerations: - operator: Exists schedule: 0 1 * * *To create the
CR, run the following command:ScanSetting$ oc create -f rs-workers.yaml
Verification
To verify that the
object is created, run the following command:ScanSetting$ oc get scansettings rs-on-workers -n openshift-compliance -o yamlExample output
apiVersion: compliance.openshift.io/v1alpha1 kind: ScanSetting metadata: creationTimestamp: "2021-11-19T19:36:36Z" generation: 1 name: rs-on-workers namespace: openshift-compliance resourceVersion: "48305" uid: 43fdfc5f-15a7-445a-8bbc-0e4a160cd46e rawResultStorage: nodeSelector: node-role.kubernetes.io/worker: "" pvAccessModes: - ReadWriteOnce rotation: 3 size: 1Gi tolerations: - operator: Exists roles: - worker - master scanTolerations: - operator: Exists schedule: 0 1 * * * strictNodeScan: true
5.6.2.4. ScanSetting Custom Resource Link kopierenLink in die Zwischenablage kopiert!
The
ScanSetting
api-resource-collector
Subscription
To increase the default CPU and memory limits of the Compliance Operator, see Increasing Compliance Operator resource limits.
Increasing the memory limit for the Compliance Operator or the scanner pods is needed if the default limits are not sufficient and the Operator or scanner pods are ended by the Out Of Memory (OOM) process. For more information, see Increasing Compliance Operator resource limits.
5.6.2.5. Configuring the hosted control planes management cluster Link kopierenLink in die Zwischenablage kopiert!
If you are hosting your own Hosted control plane or Hypershift environment and want to scan a Hosted Cluster from the management cluster, you will need to set the name and prefix namespace for the target Hosted Cluster. You can achieve this by creating a
TailoredProfile
This procedure only applies to users managing their own hosted control planes environment.
Only
ocp4-cis
ocp4-pci-dss
Prerequisites
- The Compliance Operator is installed in the management cluster.
Procedure
Obtain the
andnameof the hosted cluster to be scanned by running the following command:namespace$ oc get hostedcluster -AExample output
NAMESPACE NAME VERSION KUBECONFIG PROGRESS AVAILABLE PROGRESSING MESSAGE local-cluster 79136a1bdb84b3c13217 4.13.5 79136a1bdb84b3c13217-admin-kubeconfig Completed True False The hosted control plane is availableIn the management cluster, create a
extending the scan Profile and define the name and namespace of the Hosted Cluster to be scanned:TailoredProfileExample
management-tailoredprofile.yamlapiVersion: compliance.openshift.io/v1alpha1 kind: TailoredProfile metadata: name: hypershift-cisk57aw88gry namespace: openshift-compliance spec: description: This profile test required rules extends: ocp4-cis1 title: Management namespace profile setValues: - name: ocp4-hypershift-cluster rationale: This value is used for HyperShift version detection value: 79136a1bdb84b3c132172 - name: ocp4-hypershift-namespace-prefix rationale: This value is used for HyperShift control plane namespace detection value: local-cluster3 Create the
:TailoredProfile$ oc create -n openshift-compliance -f mgmt-tp.yaml
5.6.2.6. Applying resource requests and limits Link kopierenLink in die Zwischenablage kopiert!
When the kubelet starts a container as part of a Pod, the kubelet passes that container’s requests and limits for memory and CPU to the container runtime. In Linux, the container runtime configures the kernel cgroups that apply and enforce the limits you defined.
The CPU limit defines how much CPU time the container can use. During each scheduling interval, the Linux kernel checks to see if this limit is exceeded. If so, the kernel waits before allowing the cgroup to resume execution.
If several different containers (cgroups) want to run on a contended system, workloads with larger CPU requests are allocated more CPU time than workloads with small requests. The memory request is used during Pod scheduling. On a node that uses cgroups v2, the container runtime might use the memory request as a hint to set
memory.min
memory.low
If a container attempts to allocate more memory than this limit, the Linux kernel out-of-memory subsystem activates and intervenes by stopping one of the processes in the container that tried to allocate memory. The memory limit for the Pod or container can also apply to pages in memory-backed volumes, such as an emptyDir.
The kubelet tracks
tmpfs
emptyDir
A container may not exceed its CPU limit for extended periods. Container run times do not stop Pods or containers for excessive CPU usage. To determine whether a container cannot be scheduled or is being killed due to resource limits, see Troubleshooting the Compliance Operator.
5.6.2.7. Scheduling Pods with container resource requests Link kopierenLink in die Zwischenablage kopiert!
When a Pod is created, the scheduler selects a Node for the Pod to run on. Each node has a maximum capacity for each resource type in the amount of CPU and memory it can provide for the Pods. The scheduler ensures that the sum of the resource requests of the scheduled containers is less than the capacity nodes for each resource type.
Although memory or CPU resource usage on nodes is very low, the scheduler might still refuse to place a Pod on a node if the capacity check fails to protect against a resource shortage on a node.
For each container, you can specify the following resource limits and request:
spec.containers[].resources.limits.cpu
spec.containers[].resources.limits.memory
spec.containers[].resources.limits.hugepages-<size>
spec.containers[].resources.requests.cpu
spec.containers[].resources.requests.memory
spec.containers[].resources.requests.hugepages-<size>
Although you can specify requests and limits for only individual containers, it is also useful to consider the overall resource requests and limits for a pod. For a particular resource, a container resource request or limit is the sum of the resource requests or limits of that type for each container in the pod.
Example container resource requests and limits
apiVersion: v1
kind: Pod
metadata:
name: frontend
spec:
containers:
- name: app
image: images.my-company.example/app:v4
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
- name: log-aggregator
image: images.my-company.example/log-aggregator:v6
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
5.6.3. Tailoring the Compliance Operator Link kopierenLink in die Zwischenablage kopiert!
While the Compliance Operator comes with ready-to-use profiles, they must be modified to fit the organizations’ needs and requirements. The process of modifying a profile is called tailoring.
The Compliance Operator provides the
TailoredProfile
5.6.3.1. Creating a new tailored profile Link kopierenLink in die Zwischenablage kopiert!
You can write a tailored profile from scratch by using the
TailoredProfile
title
description
extends
- Node scan: Scans the Operating System.
- Platform scan: Scans the OpenShift Container Platform configuration.
Procedure
-
Set the following annotation on the object:
TailoredProfile
Example new-profile.yaml
apiVersion: compliance.openshift.io/v1alpha1
kind: TailoredProfile
metadata:
name: new-profile
annotations:
compliance.openshift.io/product-type: Node
spec:
extends: ocp4-cis-node
description: My custom profile
title: Custom profile
enableRules:
- name: ocp4-etcd-unique-ca
rationale: We really need to enable this
disableRules:
- name: ocp4-file-groupowner-cni-conf
rationale: This does not apply to the cluster
- 1
- Set
NodeorPlatformaccordingly. - 2
- The
extendsfield is optional. - 3
- Use the
descriptionfield to describe the function of the newTailoredProfileobject. - 4
- Give your
TailoredProfileobject a title with thetitlefield.NoteAdding the
suffix to the-nodefield of thenameobject is similar to adding theTailoredProfileproduct type annotation and generates an Operating System scan.Node
5.6.3.2. Using tailored profiles to extend existing ProfileBundles Link kopierenLink in die Zwischenablage kopiert!
While the
TailoredProfile
The
ComplianceSuite
TailoringConfigMap
TailoringConfigMap
tailoring.xml
Procedure
Browse the available rules for the Red Hat Enterprise Linux CoreOS (RHCOS)
:ProfileBundle$ oc get rules.compliance -n openshift-compliance -l compliance.openshift.io/profile-bundle=rhcos4Browse the available variables in the same
:ProfileBundle$ oc get variables.compliance -n openshift-compliance -l compliance.openshift.io/profile-bundle=rhcos4Create a tailored profile named
:nist-moderate-modifiedChoose which rules you want to add to the
tailored profile. This example extends thenist-moderate-modifiedprofile by disabling two rules and changing one value. Use therhcos4-moderatevalue to describe why these changes were made:rationaleExample
new-profile-node.yamlapiVersion: compliance.openshift.io/v1alpha1 kind: TailoredProfile metadata: name: nist-moderate-modified spec: extends: rhcos4-moderate description: NIST moderate profile title: My modified NIST moderate profile disableRules: - name: rhcos4-file-permissions-var-log-messages rationale: The file contains logs of error messages in the system - name: rhcos4-account-disable-post-pw-expiration rationale: No need to check this as it comes from the IdP setValues: - name: rhcos4-var-selinux-state rationale: Organizational requirements value: permissiveExpand Table 5.10. Attributes for spec variables Attribute Description extendsName of the
object upon which thisProfileis built.TailoredProfiletitleHuman-readable title of the
.TailoredProfiledisableRulesA list of name and rationale pairs. Each name refers to a name of a rule object that is to be disabled. The rationale value is human-readable text describing why the rule is disabled.
manualRulesA list of name and rationale pairs. When a manual rule is added, the check result status will always be
and remediation will not be generated. This attribute is automatic and by default has no values when set as a manual rule.manualenableRulesA list of name and rationale pairs. Each name refers to a name of a rule object that is to be enabled. The rationale value is human-readable text describing why the rule is enabled.
descriptionHuman-readable text describing the
.TailoredProfilesetValuesA list of name, rationale, and value groupings. Each name refers to a name of the value set. The rationale is human-readable text describing the set. The value is the actual setting.
Add the
attribute:tailoredProfile.spec.manualRulesExample
tailoredProfile.spec.manualRules.yamlapiVersion: compliance.openshift.io/v1alpha1 kind: TailoredProfile metadata: name: ocp4-manual-scc-check spec: extends: ocp4-cis description: This profile extends ocp4-cis by forcing the SCC check to always return MANUAL title: OCP4 CIS profile with manual SCC check manualRules: - name: ocp4-scc-limit-container-allowed-capabilities rationale: We use third party software that installs its own SCC with extra privilegesCreate the
object:TailoredProfile$ oc create -n openshift-compliance -f new-profile-node.yaml1 - 1
- The
TailoredProfileobject is created in the defaultopenshift-compliancenamespace.
Example output
tailoredprofile.compliance.openshift.io/nist-moderate-modified created
Define the
object to bind the newScanSettingBindingtailored profile to the defaultnist-moderate-modifiedobject.ScanSettingExample
new-scansettingbinding.yamlapiVersion: compliance.openshift.io/v1alpha1 kind: ScanSettingBinding metadata: name: nist-moderate-modified profiles: - apiGroup: compliance.openshift.io/v1alpha1 kind: Profile name: ocp4-moderate - apiGroup: compliance.openshift.io/v1alpha1 kind: TailoredProfile name: nist-moderate-modified settingsRef: apiGroup: compliance.openshift.io/v1alpha1 kind: ScanSetting name: defaultCreate the
object:ScanSettingBinding$ oc create -n openshift-compliance -f new-scansettingbinding.yamlExample output
scansettingbinding.compliance.openshift.io/nist-moderate-modified created
5.6.4. Retrieving Compliance Operator raw results Link kopierenLink in die Zwischenablage kopiert!
When proving compliance for your OpenShift Container Platform cluster, you might need to provide the scan results for auditing purposes.
5.6.4.1. Obtaining Compliance Operator raw results from a persistent volume Link kopierenLink in die Zwischenablage kopiert!
Procedure
The Compliance Operator generates and stores the raw results in a persistent volume. These results are in Asset Reporting Format (ARF).
Explore the
object:ComplianceSuite$ oc get compliancesuites nist-moderate-modified \ -o json -n openshift-compliance | jq '.status.scanStatuses[].resultsStorage'Example output
{ "name": "ocp4-moderate", "namespace": "openshift-compliance" } { "name": "nist-moderate-modified-master", "namespace": "openshift-compliance" } { "name": "nist-moderate-modified-worker", "namespace": "openshift-compliance" }This shows the persistent volume claims where the raw results are accessible.
Verify the raw data location by using the name and namespace of one of the results:
$ oc get pvc -n openshift-compliance rhcos4-moderate-workerExample output
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE rhcos4-moderate-worker Bound pvc-548f6cfe-164b-42fe-ba13-a07cfbc77f3a 1Gi RWO gp2 92mFetch the raw results by spawning a pod that mounts the volume and copying the results:
$ oc create -n openshift-compliance -f pod.yamlExample pod.yaml
apiVersion: "v1" kind: Pod metadata: name: pv-extract spec: containers: - name: pv-extract-pod image: registry.access.redhat.com/ubi9/ubi command: ["sleep", "3000"] volumeMounts: - mountPath: "/workers-scan-results" name: workers-scan-vol volumes: - name: workers-scan-vol persistentVolumeClaim: claimName: rhcos4-moderate-workerAfter the pod is running, download the results:
$ oc cp pv-extract:/workers-scan-results -n openshift-compliance .ImportantSpawning a pod that mounts the persistent volume will keep the claim as
. If the volume’s storage class in use has permissions set toBound, the volume is only mountable by one pod at a time. You must delete the pod upon completion, or it will not be possible for the Operator to schedule a pod and continue storing results in this location.ReadWriteOnceAfter the extraction is complete, the pod can be deleted:
$ oc delete pod pv-extract -n openshift-compliance
5.6.5. Managing Compliance Operator result and remediation Link kopierenLink in die Zwischenablage kopiert!
Each
ComplianceCheckResult
ComplianceRemediation
ComplianceCheckResult
Full remediation for Federal Information Processing Standards (FIPS) compliance requires enabling FIPS mode for the cluster. To enable FIPS mode, you must run the installation program from a Red Hat Enterprise Linux (RHEL) computer configured to operate in FIPS mode. For more information about configuring FIPS mode on RHEL, see Installing the system in FIPS mode.
FIPS mode is supported on the following architectures:
-
x86_64 -
ppc64le -
s390x
5.6.5.1. Filters for compliance check results Link kopierenLink in die Zwischenablage kopiert!
By default, the
ComplianceCheckResult
List checks that belong to a specific suite:
$ oc get -n openshift-compliance compliancecheckresults \
-l compliance.openshift.io/suite=workers-compliancesuite
List checks that belong to a specific scan:
$ oc get -n openshift-compliance compliancecheckresults \
-l compliance.openshift.io/scan=workers-scan
Not all
ComplianceCheckResult
ComplianceRemediation
ComplianceCheckResult
ComplianceCheckResult
compliance.openshift.io/automated-remediation
List all failing checks that can be remediated automatically:
$ oc get -n openshift-compliance compliancecheckresults \
-l 'compliance.openshift.io/check-status=FAIL,compliance.openshift.io/automated-remediation'
List all failing checks sorted by severity:
$ oc get compliancecheckresults -n openshift-compliance \
-l 'compliance.openshift.io/check-status=FAIL,compliance.openshift.io/check-severity=high'
Example output
NAME STATUS SEVERITY
nist-moderate-modified-master-configure-crypto-policy FAIL high
nist-moderate-modified-master-coreos-pti-kernel-argument FAIL high
nist-moderate-modified-master-disable-ctrlaltdel-burstaction FAIL high
nist-moderate-modified-master-disable-ctrlaltdel-reboot FAIL high
nist-moderate-modified-master-enable-fips-mode FAIL high
nist-moderate-modified-master-no-empty-passwords FAIL high
nist-moderate-modified-master-selinux-state FAIL high
nist-moderate-modified-worker-configure-crypto-policy FAIL high
nist-moderate-modified-worker-coreos-pti-kernel-argument FAIL high
nist-moderate-modified-worker-disable-ctrlaltdel-burstaction FAIL high
nist-moderate-modified-worker-disable-ctrlaltdel-reboot FAIL high
nist-moderate-modified-worker-enable-fips-mode FAIL high
nist-moderate-modified-worker-no-empty-passwords FAIL high
nist-moderate-modified-worker-selinux-state FAIL high
ocp4-moderate-configure-network-policies-namespaces FAIL high
ocp4-moderate-fips-mode-enabled-on-all-nodes FAIL high
List all failing checks that must be remediated manually:
$ oc get -n openshift-compliance compliancecheckresults \
-l 'compliance.openshift.io/check-status=FAIL,!compliance.openshift.io/automated-remediation'
The manual remediation steps are typically stored in the
description
ComplianceCheckResult
| ComplianceCheckResult Status | Description |
|---|---|
| PASS | Compliance check ran to completion and passed. |
| FAIL | Compliance check ran to completion and failed. |
| INFO | Compliance check ran to completion and found something not severe enough to be considered an error. |
| MANUAL | Compliance check does not have a way to automatically assess the success or failure and must be checked manually. |
| INCONSISTENT | Compliance check reports different results from different sources, typically cluster nodes. |
| ERROR | Compliance check ran, but could not complete properly. |
| NOT-APPLICABLE | Compliance check did not run because it is not applicable or not selected. |
5.6.5.2. Reviewing a remediation Link kopierenLink in die Zwischenablage kopiert!
Review both the
ComplianceRemediation
ComplianceCheckResult
ComplianceCheckResult
metadata
ComplianceRemediation
ComplianceCheckResult
MissingDependencies
Below is an example of a check and a remediation called
sysctl-net-ipv4-conf-all-accept-redirects
spec
status
metadata
spec:
apply: false
current:
object:
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
spec:
config:
ignition:
version: 3.2.0
storage:
files:
- path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_accept_redirects.conf
mode: 0644
contents:
source: data:,net.ipv4.conf.all.accept_redirects%3D0
outdated: {}
status:
applicationState: NotApplied
The remediation payload is stored in the
spec.current
MachineConfig
ConfigMap
Secret
To see exactly what the remediation does when applied, the
MachineConfig
the spec.config.storage.files[0].path
/etc/sysctl.d/75-sysctl_net_ipv4_conf_all_accept_redirects.conf
spec.config.storage.files[0].contents.source
The contents of the files are URL-encoded.
Use the following Python script to view the contents:
$ echo "net.ipv4.conf.all.accept_redirects%3D0" | python3 -c "import sys, urllib.parse; print(urllib.parse.unquote(''.join(sys.stdin.readlines())))"
Example output
net.ipv4.conf.all.accept_redirects=0
The Compliance Operator does not automatically resolve dependency issues that can occur between remediations. Users should perform a rescan after remediations are applied to ensure accurate results.
5.6.5.3. Applying remediation when using customized machine config pools Link kopierenLink in die Zwischenablage kopiert!
When you create a custom
MachineConfigPool
MachineConfigPool
machineConfigPoolSelector
KubeletConfig
MachineConfigPool
Do not set
protectKernelDefaults: false
KubeletConfig
MachineConfigPool
Procedure
List the nodes.
$ oc get nodes -n openshift-complianceExample output
NAME STATUS ROLES AGE VERSION ip-10-0-128-92.us-east-2.compute.internal Ready master 5h21m v1.27.3 ip-10-0-158-32.us-east-2.compute.internal Ready worker 5h17m v1.27.3 ip-10-0-166-81.us-east-2.compute.internal Ready worker 5h17m v1.27.3 ip-10-0-171-170.us-east-2.compute.internal Ready master 5h21m v1.27.3 ip-10-0-197-35.us-east-2.compute.internal Ready master 5h22m v1.27.3Add a label to nodes.
$ oc -n openshift-compliance \ label node ip-10-0-166-81.us-east-2.compute.internal \ node-role.kubernetes.io/<machine_config_pool_name>=Example output
node/ip-10-0-166-81.us-east-2.compute.internal labeledCreate custom
CR.MachineConfigPoolapiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfigPool metadata: name: <machine_config_pool_name> labels: pools.operator.machineconfiguration.openshift.io/<machine_config_pool_name>: ''1 spec: machineConfigSelector: matchExpressions: - {key: machineconfiguration.openshift.io/role, operator: In, values: [worker,<machine_config_pool_name>]} nodeSelector: matchLabels: node-role.kubernetes.io/<machine_config_pool_name>: ""- 1
- The
labelsfield defines label name to add for Machine config pool(MCP).
Verify MCP created successfully.
$ oc get mcp -w
5.6.5.4. Evaluating KubeletConfig rules against default configuration values Link kopierenLink in die Zwischenablage kopiert!
OpenShift Container Platform infrastructure might contain incomplete configuration files at run time, and nodes assume default configuration values for missing configuration options. Some configuration options can be passed as command-line arguments. As a result, the Compliance Operator cannot verify if the configuration file on the node is complete because it might be missing options used in the rule checks.
To prevent false negative results where the default configuration value passes a check, the Compliance Operator uses the Node/Proxy API to fetch the configuration for each node in a node pool, then all configuration options that are consistent across nodes in the node pool are stored in a file that represents the configuration for all nodes within that node pool. This increases the accuracy of the scan results.
No additional configuration changes are required to use this feature with default
master
worker
5.6.5.5. Scanning custom node pools Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator does not maintain a copy of each node pool configuration. The Compliance Operator aggregates consistent configuration options for all nodes within a single node pool into one copy of the configuration file. The Compliance Operator then uses the configuration file for a particular node pool to evaluate rules against nodes within that pool.
Procedure
Add the
role to theexampleobject that will be stored in theScanSettingCR:ScanSettingBindingapiVersion: compliance.openshift.io/v1alpha1 kind: ScanSetting metadata: name: default namespace: openshift-compliance rawResultStorage: rotation: 3 size: 1Gi roles: - worker - master - example scanTolerations: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists schedule: '0 1 * * *'Create a scan that uses the
CR:ScanSettingBindingapiVersion: compliance.openshift.io/v1alpha1 kind: ScanSettingBinding metadata: name: cis namespace: openshift-compliance profiles: - apiGroup: compliance.openshift.io/v1alpha1 kind: Profile name: ocp4-cis - apiGroup: compliance.openshift.io/v1alpha1 kind: Profile name: ocp4-cis-node settingsRef: apiGroup: compliance.openshift.io/v1alpha1 kind: ScanSetting name: default
Verification
The Platform KubeletConfig rules are checked through the
object. You can find those rules by running the following command:Node/Proxy$ oc get rules -o json | jq '.items[] | select(.checkType == "Platform") | select(.metadata.name | contains("ocp4-kubelet-")) | .metadata.name'
5.6.5.6. Remediating KubeletConfig sub pools Link kopierenLink in die Zwischenablage kopiert!
KubeletConfig
MachineConfigPool
Procedure
Add a label to the sub-pool
CR:MachineConfigPool$ oc label mcp <sub-pool-name> pools.operator.machineconfiguration.openshift.io/<sub-pool-name>=
5.6.5.7. Applying a remediation Link kopierenLink in die Zwischenablage kopiert!
The boolean attribute
spec.apply
true
$ oc -n openshift-compliance \
patch complianceremediations/<scan-name>-sysctl-net-ipv4-conf-all-accept-redirects \
--patch '{"spec":{"apply":true}}' --type=merge
After the Compliance Operator processes the applied remediation, the
status.ApplicationState
MachineConfig
75-$scan-name-$suite-name
MachineConfig
Note that when the Machine Config Operator applies a new
MachineConfig
75-$scan-name-$suite-name
MachineConfig
.spec.paused
MachineConfigPool
true
The Compliance Operator can apply remediations automatically. Set
autoApplyRemediations: true
ScanSetting
Applying remediations automatically should only be done with careful consideration.
The Compliance Operator does not automatically resolve dependency issues that can occur between remediations. Users should perform a rescan after remediations are applied to ensure accurate results.
5.6.5.8. Remediating a platform check manually Link kopierenLink in die Zwischenablage kopiert!
Checks for Platform scans typically have to be remediated manually by the administrator for two reasons:
- It is not always possible to automatically determine the value that must be set. One of the checks requires that a list of allowed registries is provided, but the scanner has no way of knowing which registries the organization wants to allow.
-
Different checks modify different API objects, requiring automated remediation to possess or superuser access to modify objects in the cluster, which is not advised.
root
Procedure
The example below uses the
rule, which would fail on a default OpenShift Container Platform installation. Inspect the ruleocp4-ocp-allowed-registries-for-import, the rule is to limit the registries the users are allowed to import images from by setting theoc get rule.compliance/ocp4-ocp-allowed-registries-for-import -oyamlattribute, The warning attribute of the rule also shows the API object checked, so it can be modified and remediate the issue:allowedRegistriesForImport$ oc edit image.config.openshift.io/clusterExample output
apiVersion: config.openshift.io/v1 kind: Image metadata: annotations: release.openshift.io/create-only: "true" creationTimestamp: "2020-09-10T10:12:54Z" generation: 2 name: cluster resourceVersion: "363096" selfLink: /apis/config.openshift.io/v1/images/cluster uid: 2dcb614e-2f8a-4a23-ba9a-8e33cd0ff77e spec: allowedRegistriesForImport: - domainName: registry.redhat.io status: externalRegistryHostnames: - default-route-openshift-image-registry.apps.user-cluster-09-10-12-07.devcluster.openshift.com internalRegistryHostname: image-registry.openshift-image-registry.svc:5000Re-run the scan:
$ oc -n openshift-compliance \ annotate compliancescans/rhcos4-e8-worker compliance.openshift.io/rescan=
5.6.5.9. Updating remediations Link kopierenLink in die Zwischenablage kopiert!
When a new version of compliance content is used, it might deliver a new and different version of a remediation than the previous version. The Compliance Operator will keep the old version of the remediation applied. The OpenShift Container Platform administrator is also notified of the new version to review and apply. A ComplianceRemediation object that had been applied earlier, but was updated changes its status to Outdated. The outdated objects are labeled so that they can be searched for easily.
The previously applied remediation contents would then be stored in the
spec.outdated
ComplianceRemediation
spec.current
spec.outdated
MachineConfig
spec.outdated
MachineConfig
Procedure
Search for any outdated remediations:
$ oc -n openshift-compliance get complianceremediations \ -l complianceoperator.openshift.io/outdated-remediation=Example output
NAME STATE workers-scan-no-empty-passwords OutdatedThe currently applied remediation is stored in the
attribute and the new, unapplied remediation is stored in theOutdatedattribute. If you are satisfied with the new version, remove theCurrentfield. If you want to keep the updated content, remove theOutdatedandCurrentattributes.OutdatedApply the newer version of the remediation:
$ oc -n openshift-compliance patch complianceremediations workers-scan-no-empty-passwords \ --type json -p '[{"op":"remove", "path":/spec/outdated}]'The remediation state will switch from
toOutdated:Applied$ oc get -n openshift-compliance complianceremediations workers-scan-no-empty-passwordsExample output
NAME STATE workers-scan-no-empty-passwords Applied- The nodes will apply the newer remediation version and reboot.
The Compliance Operator does not automatically resolve dependency issues that can occur between remediations. Users should perform a rescan after remediations are applied to ensure accurate results.
5.6.5.10. Unapplying a remediation Link kopierenLink in die Zwischenablage kopiert!
It might be required to unapply a remediation that was previously applied.
Procedure
Set the
flag toapply:false$ oc -n openshift-compliance \ patch complianceremediations/rhcos4-moderate-worker-sysctl-net-ipv4-conf-all-accept-redirects \ --patch '{"spec":{"apply":false}}' --type=mergeThe remediation status will change to
and the compositeNotAppliedobject would be re-rendered to not include the remediation.MachineConfigImportantAll affected nodes with the remediation will be rebooted.
The Compliance Operator does not automatically resolve dependency issues that can occur between remediations. Users should perform a rescan after remediations are applied to ensure accurate results.
5.6.5.11. Removing a KubeletConfig remediation Link kopierenLink in die Zwischenablage kopiert!
KubeletConfig
KubeletConfig
one-rule-tp-node-master-kubelet-eviction-thresholds-set-hard-imagefs-available
Procedure
Locate the
and compliance check for thescan-nameremediation:one-rule-tp-node-master-kubelet-eviction-thresholds-set-hard-imagefs-available$ oc -n openshift-compliance get remediation \ one-rule-tp-node-master-kubelet-eviction-thresholds-set-hard-imagefs-available -o yamlExample output
apiVersion: compliance.openshift.io/v1alpha1 kind: ComplianceRemediation metadata: annotations: compliance.openshift.io/xccdf-value-used: var-kubelet-evictionhard-imagefs-available creationTimestamp: "2022-01-05T19:52:27Z" generation: 1 labels: compliance.openshift.io/scan-name: one-rule-tp-node-master1 compliance.openshift.io/suite: one-rule-ssb-node name: one-rule-tp-node-master-kubelet-eviction-thresholds-set-hard-imagefs-available namespace: openshift-compliance ownerReferences: - apiVersion: compliance.openshift.io/v1alpha1 blockOwnerDeletion: true controller: true kind: ComplianceCheckResult name: one-rule-tp-node-master-kubelet-eviction-thresholds-set-hard-imagefs-available uid: fe8e1577-9060-4c59-95b2-3e2c51709adc resourceVersion: "84820" uid: 5339d21a-24d7-40cb-84d2-7a2ebb015355 spec: apply: true current: object: apiVersion: machineconfiguration.openshift.io/v1 kind: KubeletConfig spec: kubeletConfig: evictionHard: imagefs.available: 10%2 outdated: {} type: Configuration status: applicationState: AppliedNoteIf the remediation invokes an
kubelet configuration, you must specify all of theevictionHardparameters:evictionHard,memory.available,nodefs.available,nodefs.inodesFree, andimagefs.available. If you do not specify all parameters, only the specified parameters are applied and the remediation will not function properly.imagefs.inodesFreeRemove the remediation:
Set
to false for the remediation object:apply$ oc -n openshift-compliance patch \ complianceremediations/one-rule-tp-node-master-kubelet-eviction-thresholds-set-hard-imagefs-available \ -p '{"spec":{"apply":false}}' --type=mergeUsing the
, find thescan-nameobject that the remediation was applied to:KubeletConfig$ oc -n openshift-compliance get kubeletconfig \ --selector compliance.openshift.io/scan-name=one-rule-tp-node-masterExample output
NAME AGE compliance-operator-kubelet-master 2m34sManually remove the remediation,
, from theimagefs.available: 10%object:KubeletConfig$ oc edit -n openshift-compliance KubeletConfig compliance-operator-kubelet-masterImportantAll affected nodes with the remediation will be rebooted.
You must also exclude the rule from any scheduled scans in your tailored profiles that auto-applies the remediation, otherwise, the remediation will be re-applied during the next scheduled scan.
5.6.5.12. Inconsistent ComplianceScan Link kopierenLink in die Zwischenablage kopiert!
The
ScanSetting
ScanSetting
ScanSettingBinding
It is expected that all machines in a machine config pool are identical and all scan results from the nodes in a pool should be identical.
If some of the results are different from others, the Compliance Operator flags a
ComplianceCheckResult
INCONSISTENT
ComplianceCheckResult
compliance.openshift.io/inconsistent-check
Because the number of machines in a pool might be quite large, the Compliance Operator attempts to find the most common state and list the nodes that differ from the common state. The most common state is stored in the
compliance.openshift.io/most-common-status
compliance.openshift.io/inconsistent-source
hostname:status
hostname:status
compliance.openshift.io/inconsistent-source annotation
If possible, a remediation is still created so that the cluster can converge to a compliant status. However, this might not always be possible and correcting the difference between nodes must be done manually. The compliance scan must be re-run to get a consistent result by annotating the scan with the
compliance.openshift.io/rescan=
$ oc -n openshift-compliance \
annotate compliancescans/rhcos4-e8-worker compliance.openshift.io/rescan=
5.6.6. Performing advanced Compliance Operator tasks Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator includes options for advanced users for the purpose of debugging or integration with existing tooling.
5.6.6.1. Using the ComplianceSuite and ComplianceScan objects directly Link kopierenLink in die Zwischenablage kopiert!
While it is recommended that users take advantage of the
ScanSetting
ScanSettingBinding
ComplianceSuite
-
Specifying only a single rule to scan. This can be useful for debugging together with the attribute which increases the OpenSCAP scanner verbosity, as the debug mode tends to get quite verbose otherwise. Limiting the test to one rule helps to lower the amount of debug information.
debug: true - Providing a custom nodeSelector. In order for a remediation to be applicable, the nodeSelector must match a pool.
- Pointing the Scan to a bespoke config map with a tailoring file.
- For testing or development when the overhead of parsing profiles from bundles is not required.
The following example shows a
ComplianceSuite
apiVersion: compliance.openshift.io/v1alpha1
kind: ComplianceSuite
metadata:
name: workers-compliancesuite
spec:
scans:
- name: workers-scan
profile: xccdf_org.ssgproject.content_profile_moderate
content: ssg-rhcos4-ds.xml
contentImage: registry.redhat.io/compliance/openshift-compliance-content-rhel8@sha256:45dc...
debug: true
rule: xccdf_org.ssgproject.content_rule_no_direct_root_logins
nodeSelector:
node-role.kubernetes.io/worker: ""
The
ComplianceSuite
ComplianceScan
To find out the profile, content, or rule values, you can start by creating a similar Suite from
ScanSetting
ScanSettingBinding
ProfileBundle
xccdf_org
ComplianceSuite
5.6.6.2. Setting PriorityClass for ScanSetting scans Link kopierenLink in die Zwischenablage kopiert!
In large scale environments, the default
PriorityClass
PriorityClass
Prerequisites
-
Optional: You have created a object. For more information, see "Configuring priority and preemption" in the Additional resources.
PriorityClass
Procedure
Set the
variable:PriorityClassapiVersion: compliance.openshift.io/v1alpha1 strictNodeScan: true metadata: name: default namespace: openshift-compliance priorityClass: compliance-high-priority1 kind: ScanSetting showNotApplicable: false rawResultStorage: nodeSelector: node-role.kubernetes.io/master: '' pvAccessModes: - ReadWriteOnce rotation: 3 size: 1Gi tolerations: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists - effect: NoExecute key: node.kubernetes.io/not-ready operator: Exists tolerationSeconds: 300 - effect: NoExecute key: node.kubernetes.io/unreachable operator: Exists tolerationSeconds: 300 - effect: NoSchedule key: node.kubernetes.io/memory-pressure operator: Exists schedule: 0 1 * * * roles: - master - worker scanTolerations: - operator: Exists- 1
- If the
PriorityClassreferenced in theScanSettingcannot be found, the Operator will leave thePriorityClassempty, issue a warning, and continue scheduling scans without aPriorityClass.
5.6.6.3. Using raw tailored profiles Link kopierenLink in die Zwischenablage kopiert!
While the
TailoredProfile
The
ComplianceSuite
TailoringConfigMap
TailoringConfigMap
tailoring.xml
Procedure
Create the
object from a file:ConfigMap$ oc -n openshift-compliance \ create configmap nist-moderate-modified \ --from-file=tailoring.xml=/path/to/the/tailoringFile.xmlReference the tailoring file in a scan that belongs to a suite:
apiVersion: compliance.openshift.io/v1alpha1 kind: ComplianceSuite metadata: name: workers-compliancesuite spec: debug: true scans: - name: workers-scan profile: xccdf_org.ssgproject.content_profile_moderate content: ssg-rhcos4-ds.xml contentImage: registry.redhat.io/compliance/openshift-compliance-content-rhel8@sha256:45dc... debug: true tailoringConfigMap: name: nist-moderate-modified nodeSelector: node-role.kubernetes.io/worker: ""
5.6.6.4. Performing a rescan Link kopierenLink in die Zwischenablage kopiert!
Typically you will want to re-run a scan on a defined schedule, like every Monday or daily. It can also be useful to re-run a scan once after fixing a problem on a node. To perform a single scan, annotate the scan with the
compliance.openshift.io/rescan=
$ oc -n openshift-compliance \
annotate compliancescans/rhcos4-e8-worker compliance.openshift.io/rescan=
A rescan generates four additional
mc
rhcos-moderate
$ oc get mc
Example output
75-worker-scan-chronyd-or-ntpd-specify-remote-server
75-worker-scan-configure-usbguard-auditbackend
75-worker-scan-service-usbguard-enabled
75-worker-scan-usbguard-allow-hid-and-hub
When the scan setting
default-auto-apply
MachineConfig
5.6.6.5. Setting custom storage size for results Link kopierenLink in die Zwischenablage kopiert!
While the custom resources such as
ComplianceCheckResult
etcd
rawResultStorage.size
ScanSetting
ComplianceScan
A related parameter is
rawResultStorage.rotation
5.6.6.5.1. Using custom result storage values Link kopierenLink in die Zwischenablage kopiert!
Because OpenShift Container Platform can be deployed in a variety of public clouds or bare metal, the Compliance Operator cannot determine available storage configurations. By default, the Compliance Operator will try to create the PV for storing results using the default storage class of the cluster, but a custom storage class can be configured using the
rawResultStorage.StorageClassName
If your cluster does not specify a default storage class, this attribute must be set.
Configure the
ScanSetting
Example ScanSetting CR
apiVersion: compliance.openshift.io/v1alpha1
kind: ScanSetting
metadata:
name: default
namespace: openshift-compliance
rawResultStorage:
storageClassName: standard
rotation: 10
size: 10Gi
roles:
- worker
- master
scanTolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists
schedule: '0 1 * * *'
5.6.6.6. Applying remediations generated by suite scans Link kopierenLink in die Zwischenablage kopiert!
Although you can use the
autoApplyRemediations
ComplianceSuite
compliance.openshift.io/apply-remediations
Procedure
-
Apply the annotation by running:
compliance.openshift.io/apply-remediations
$ oc -n openshift-compliance \
annotate compliancesuites/workers-compliancesuite compliance.openshift.io/apply-remediations=
5.6.6.7. Automatically update remediations Link kopierenLink in die Zwischenablage kopiert!
In some cases, a scan with newer content might mark remediations as
OUTDATED
compliance.openshift.io/remove-outdated
Procedure
-
Apply the annotation:
compliance.openshift.io/remove-outdated
$ oc -n openshift-compliance \
annotate compliancesuites/workers-compliancesuite compliance.openshift.io/remove-outdated=
Alternatively, set the
autoUpdateRemediations
ScanSetting
ComplianceSuite
5.6.6.8. Creating a custom SCC for the Compliance Operator Link kopierenLink in die Zwischenablage kopiert!
In some environments, you must create a custom Security Context Constraints (SCC) file to ensure the correct permissions are available to the Compliance Operator
api-resource-collector
Prerequisites
-
You must have privileges.
admin
Procedure
Define the SCC in a YAML file named
:restricted-adjusted-compliance.yamlSecurityContextConstraintsobject definitionallowHostDirVolumePlugin: false allowHostIPC: false allowHostNetwork: false allowHostPID: false allowHostPorts: false allowPrivilegeEscalation: true allowPrivilegedContainer: false allowedCapabilities: null apiVersion: security.openshift.io/v1 defaultAddCapabilities: null fsGroup: type: MustRunAs kind: SecurityContextConstraints metadata: name: restricted-adjusted-compliance priority: 301 readOnlyRootFilesystem: false requiredDropCapabilities: - KILL - SETUID - SETGID - MKNOD runAsUser: type: MustRunAsRange seLinuxContext: type: MustRunAs supplementalGroups: type: RunAsAny users: - system:serviceaccount:openshift-compliance:api-resource-collector2 volumes: - configMap - downwardAPI - emptyDir - persistentVolumeClaim - projected - secretCreate the SCC:
$ oc create -n openshift-compliance -f restricted-adjusted-compliance.yamlExample output
securitycontextconstraints.security.openshift.io/restricted-adjusted-compliance created
Verification
Verify the SCC was created:
$ oc get -n openshift-compliance scc restricted-adjusted-complianceExample output
NAME PRIV CAPS SELINUX RUNASUSER FSGROUP SUPGROUP PRIORITY READONLYROOTFS VOLUMES restricted-adjusted-compliance false <no value> MustRunAs MustRunAsRange MustRunAs RunAsAny 30 false ["configMap","downwardAPI","emptyDir","persistentVolumeClaim","projected","secret"]
5.6.7. Troubleshooting Compliance Operator scans Link kopierenLink in die Zwischenablage kopiert!
This section describes how to troubleshoot the Compliance Operator. The information can be useful either to diagnose a problem or provide information in a bug report. Some general tips:
The Compliance Operator emits Kubernetes events when something important happens. You can either view all events in the cluster using the command:
$ oc get events -n openshift-complianceOr view events for an object like a scan using the command:
$ oc describe -n openshift-compliance compliancescan/cis-complianceThe Compliance Operator consists of several controllers, approximately one per API object. It could be useful to filter only those controllers that correspond to the API object having issues. If a
cannot be applied, view the messages from theComplianceRemediationcontroller. You can filter the messages from a single controller by parsing withremediationctrl:jq$ oc -n openshift-compliance logs compliance-operator-775d7bddbd-gj58f \ | jq -c 'select(.logger == "profilebundlectrl")'The timestamps are logged as seconds since UNIX epoch in UTC. To convert them to a human-readable date, use
, for example:date -d @timestamp --utc$ date -d @1596184628.955853 --utc-
Many custom resources, most importantly and
ComplianceSuite, allow theScanSettingoption to be set. Enabling this option increases verbosity of the OpenSCAP scanner pods, as well as some other helper pods.debug -
If a single rule is passing or failing unexpectedly, it could be helpful to run a single scan or a suite with only that rule to find the rule ID from the corresponding object and use it as the
ComplianceCheckResultattribute value in aruleCR. Then, together with theScanoption enabled, thedebugcontainer logs in the scanner pod would show the raw OpenSCAP logs.scanner
5.6.7.1. Anatomy of a scan Link kopierenLink in die Zwischenablage kopiert!
The following sections outline the components and stages of Compliance Operator scans.
5.6.7.1.1. Compliance sources Link kopierenLink in die Zwischenablage kopiert!
The compliance content is stored in
Profile
ProfileBundle
ProfileBundle
$ oc get -n openshift-compliance profilebundle.compliance
$ oc get -n openshift-compliance profile.compliance
The
ProfileBundle
Bundle
Bundle
$ oc logs -n openshift-compliance -lprofile-bundle=ocp4 -c profileparser
$ oc get -n openshift-compliance deployments,pods -lprofile-bundle=ocp4
$ oc logs -n openshift-compliance pods/<pod-name>
$ oc describe -n openshift-compliance pod/<pod-name> -c profileparser
5.6.7.1.2. The ScanSetting and ScanSettingBinding objects lifecycle and debugging Link kopierenLink in die Zwischenablage kopiert!
With valid compliance content sources, the high-level
ScanSetting
ScanSettingBinding
ComplianceSuite
ComplianceScan
apiVersion: compliance.openshift.io/v1alpha1
kind: ScanSetting
metadata:
name: my-companys-constraints
debug: true
# For each role, a separate scan will be created pointing
# to a node-role specified in roles
roles:
- worker
---
apiVersion: compliance.openshift.io/v1alpha1
kind: ScanSettingBinding
metadata:
name: my-companys-compliance-requirements
profiles:
# Node checks
- name: rhcos4-e8
kind: Profile
apiGroup: compliance.openshift.io/v1alpha1
# Cluster checks
- name: ocp4-e8
kind: Profile
apiGroup: compliance.openshift.io/v1alpha1
settingsRef:
name: my-companys-constraints
kind: ScanSetting
apiGroup: compliance.openshift.io/v1alpha1
Both
ScanSetting
ScanSettingBinding
logger=scansettingbindingctrl
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuiteCreated 9m52s scansettingbindingctrl ComplianceSuite openshift-compliance/my-companys-compliance-requirements created
Now a
ComplianceSuite
ComplianceSuite
5.6.7.1.3. ComplianceSuite custom resource lifecycle and debugging Link kopierenLink in die Zwischenablage kopiert!
The
ComplianceSuite
ComplianceScan
ComplianceSuite
logger=suitectrl
suitectrl
CronJob
$ oc get cronjobs
Example output
NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE
<cron_name> 0 1 * * * False 0 <none> 151m
For the most important issues, events are emitted. View them with
oc describe compliancesuites/<name>
Suite
Status
Scan
Status
5.6.7.1.4. ComplianceScan custom resource lifecycle and debugging Link kopierenLink in die Zwischenablage kopiert!
The
ComplianceScan
scanctrl
5.6.7.1.4.1. Pending phase Link kopierenLink in die Zwischenablage kopiert!
The scan is validated for correctness in this phase. If some parameters like storage size are invalid, the scan transitions to DONE with ERROR result, otherwise proceeds to the Launching phase.
5.6.7.1.4.2. Launching phase Link kopierenLink in die Zwischenablage kopiert!
In this phase, several config maps that contain either environment for the scanner pods or directly the script that the scanner pods will be evaluating. List the config maps:
$ oc -n openshift-compliance get cm \
-l compliance.openshift.io/scan-name=rhcos4-e8-worker,complianceoperator.openshift.io/scan-script=
These config maps will be used by the scanner pods. If you ever needed to modify the scanner behavior, change the scanner debug level or print the raw results, modifying the config maps is the way to go. Afterwards, a persistent volume claim is created per scan to store the raw ARF results:
$ oc get pvc -n openshift-compliance -lcompliance.openshift.io/scan-name=rhcos4-e8-worker
The PVCs are mounted by a per-scan
ResultServer
ResultServer
ResultServer
ResultServer
Finally, the scanner pods are launched in this phase; one scanner pod for a
Platform
node
ComplianceScan
$ oc get pods -lcompliance.openshift.io/scan-name=rhcos4-e8-worker,workload=scanner --show-labels
Example output
NAME READY STATUS RESTARTS AGE LABELS
rhcos4-e8-worker-ip-10-0-169-90.eu-north-1.compute.internal-pod 0/2 Completed 0 39m compliance.openshift.io/scan-name=rhcos4-e8-worker,targetNode=ip-10-0-169-90.eu-north-1.compute.internal,workload=scanner
+ The scan then proceeds to the Running phase.
5.6.7.1.4.3. Running phase Link kopierenLink in die Zwischenablage kopiert!
The running phase waits until the scanner pods finish. The following terms and processes are in use in the running phase:
-
init container: There is one init container called . It runs the contentImage container and executes a single command that copies the contentFile to the
content-containerdirectory shared with the other containers in this pod./content -
scanner: This container runs the scan. For node scans, the container mounts the node filesystem as and mounts the content delivered by the init container. The container also mounts the
/hostentrypointcreated in the Launching phase and executes it. The default script in the entrypointConfigMapexecutes OpenSCAP and stores the result files in theConfigMapdirectory shared between the pod’s containers. Logs from this pod can be viewed to determine what the OpenSCAP scanner checked. More verbose output can be viewed with the/resultsflag.debug logcollector: The logcollector container waits until the scanner container finishes. Then, it uploads the full ARF results to the
and separately uploads the XCCDF results along with scan result and OpenSCAP result code as aResultServerThese result config maps are labeled with the scan name (ConfigMap.):compliance.openshift.io/scan-name=rhcos4-e8-worker$ oc describe cm/rhcos4-e8-worker-ip-10-0-169-90.eu-north-1.compute.internal-podExample output
Name: rhcos4-e8-worker-ip-10-0-169-90.eu-north-1.compute.internal-pod Namespace: openshift-compliance Labels: compliance.openshift.io/scan-name-scan=rhcos4-e8-worker complianceoperator.openshift.io/scan-result= Annotations: compliance-remediations/processed: compliance.openshift.io/scan-error-msg: compliance.openshift.io/scan-result: NON-COMPLIANT OpenSCAP-scan-result/node: ip-10-0-169-90.eu-north-1.compute.internal Data ==== exit-code: ---- 2 results: ---- <?xml version="1.0" encoding="UTF-8"?> ...
Scanner pods for
Platform
-
There is one extra init container called that reads the OpenSCAP content provided by the content-container init, container, figures out which API resources the content needs to examine and stores those API resources to a shared directory where the
api-resource-collectorcontainer would read them from.scanner -
The container does not need to mount the host file system.
scanner
When the scanner pods are done, the scans move on to the Aggregating phase.
5.6.7.1.4.4. Aggregating phase Link kopierenLink in die Zwischenablage kopiert!
In the aggregating phase, the scan controller spawns yet another pod called the aggregator pod. Its purpose it to take the result
ConfigMap
ComplianceRemediation
When a config map is processed by an aggregator pod, it is labeled the
compliance-remediations/processed
ComplianceCheckResult
$ oc get compliancecheckresults -lcompliance.openshift.io/scan-name=rhcos4-e8-worker
Example output
NAME STATUS SEVERITY
rhcos4-e8-worker-accounts-no-uid-except-zero PASS high
rhcos4-e8-worker-audit-rules-dac-modification-chmod FAIL medium
and
ComplianceRemediation
$ oc get complianceremediations -lcompliance.openshift.io/scan-name=rhcos4-e8-worker
Example output
NAME STATE
rhcos4-e8-worker-audit-rules-dac-modification-chmod NotApplied
rhcos4-e8-worker-audit-rules-dac-modification-chown NotApplied
rhcos4-e8-worker-audit-rules-execution-chcon NotApplied
rhcos4-e8-worker-audit-rules-execution-restorecon NotApplied
rhcos4-e8-worker-audit-rules-execution-semanage NotApplied
rhcos4-e8-worker-audit-rules-execution-setfiles NotApplied
After these CRs are created, the aggregator pod exits and the scan moves on to the Done phase.
5.6.7.1.4.5. Done phase Link kopierenLink in die Zwischenablage kopiert!
In the final scan phase, the scan resources are cleaned up if needed and the
ResultServer
It is also possible to trigger a re-run of a scan in the Done phase by annotating it:
$ oc -n openshift-compliance \
annotate compliancescans/rhcos4-e8-worker compliance.openshift.io/rescan=
After the scan reaches the Done phase, nothing else happens on its own unless the remediations are set to be applied automatically with
autoApplyRemediations: true
ComplianceSuite
ComplianceRemediation
5.6.7.1.5. ComplianceRemediation controller lifecycle and debugging Link kopierenLink in die Zwischenablage kopiert!
The example scan has reported some findings. One of the remediations can be enabled by toggling its
apply
true
$ oc patch complianceremediations/rhcos4-e8-worker-audit-rules-dac-modification-chmod --patch '{"spec":{"apply":true}}' --type=merge
The
ComplianceRemediation
logger=remediationctrl
MachineConfig
The
MachineConfig
75-
$ oc get mc | grep 75-
Example output
75-rhcos4-e8-worker-my-companys-compliance-requirements 3.2.0 2m46s
The remediations the
mc
$ oc describe mc/75-rhcos4-e8-worker-my-companys-compliance-requirements
Example output
Name: 75-rhcos4-e8-worker-my-companys-compliance-requirements
Labels: machineconfiguration.openshift.io/role=worker
Annotations: remediation/rhcos4-e8-worker-audit-rules-dac-modification-chmod:
The
ComplianceRemediation
- All currently applied remediations are read into an initial remediation set.
- If the reconciled remediation is supposed to be applied, it is added to the set.
-
A object is rendered from the set and annotated with names of remediations in the set. If the set is empty (the last remediation was unapplied), the rendered
MachineConfigobject is removed.MachineConfig - If and only if the rendered machine config is different from the one already applied in the cluster, the applied MC is updated (or created, or deleted).
-
Creating or modifying a object triggers a reboot of nodes that match the
MachineConfiglabel - see the Machine Config Operator documentation for more details.machineconfiguration.openshift.io/role
The remediation loop ends once the rendered machine config is updated, if needed, and the reconciled remediation object status is updated. In our case, applying the remediation would trigger a reboot. After the reboot, annotate the scan to re-run it:
$ oc -n openshift-compliance \
annotate compliancescans/rhcos4-e8-worker compliance.openshift.io/rescan=
The scan will run and finish. Check for the remediation to pass:
$ oc -n openshift-compliance \
get compliancecheckresults/rhcos4-e8-worker-audit-rules-dac-modification-chmod
Example output
NAME STATUS SEVERITY
rhcos4-e8-worker-audit-rules-dac-modification-chmod PASS medium
5.6.7.1.6. Useful labels Link kopierenLink in die Zwischenablage kopiert!
Each pod that is spawned by the Compliance Operator is labeled specifically with the scan it belongs to and the work it does. The scan identifier is labeled with the
compliance.openshift.io/scan-name
workload
The Compliance Operator schedules the following workloads:
- scanner: Performs the compliance scan.
- resultserver: Stores the raw results for the compliance scan.
- aggregator: Aggregates the results, detects inconsistencies and outputs result objects (checkresults and remediations).
- suitererunner: Will tag a suite to be re-run (when a schedule is set).
- profileparser: Parses a datastream and creates the appropriate profiles, rules and variables.
When debugging and logs are required for a certain workload, run:
$ oc logs -l workload=<workload_name> -c <container_name>
5.6.7.2. Increasing Compliance Operator resource limits Link kopierenLink in die Zwischenablage kopiert!
In some cases, the Compliance Operator might require more memory than the default limits allow. The best way to mitigate this issue is to set custom resource limits.
To increase the default memory and CPU limits of scanner pods, see `ScanSetting` Custom resource.
Procedure
To increase the Operator’s memory limits to 500 Mi, create the following patch file named
:co-memlimit-patch.yamlspec: config: resources: limits: memory: 500MiApply the patch file:
$ oc patch sub compliance-operator -nopenshift-compliance --patch-file co-memlimit-patch.yaml --type=merge
5.6.7.3. Configuring Operator resource constraints Link kopierenLink in die Zwischenablage kopiert!
The
resources
Resource Constraints applied in this process overwrites the existing resource constraints.
Procedure
Inject a request of 0.25 cpu and 64 Mi of memory, and a limit of 0.5 cpu and 128 Mi of memory in each container by editing the
object:Subscriptionkind: Subscription metadata: name: compliance-operator namespace: openshift-compliance spec: package: package-name channel: stable config: resources: requests: memory: "64Mi" cpu: "250m" limits: memory: "128Mi" cpu: "500m"
5.6.7.4. Configuring ScanSetting resources Link kopierenLink in die Zwischenablage kopiert!
When using the Compliance Operator in a cluster that contains more than 500 MachineConfigs, the
ocp4-pci-dss-api-checks-pod
init
Platform
Resource constraints applied in this process overwrites the existing resource constraints.
Procedure
Confirm the
pod is stuck in theocp4-pci-dss-api-checks-podstatus:Init:OOMKilled$ oc get pod ocp4-pci-dss-api-checks-pod -wExample output
NAME READY STATUS RESTARTS AGE ocp4-pci-dss-api-checks-pod 0/2 Init:1/2 8 (5m56s ago) 25m ocp4-pci-dss-api-checks-pod 0/2 Init:OOMKilled 8 (6m19s ago) 26mEdit the
attribute in thescanLimitsCR to increase the available memory for theScanSettingpod:ocp4-pci-dss-api-checks-podtimeout: 30m strictNodeScan: true metadata: name: default namespace: openshift-compliance kind: ScanSetting showNotApplicable: false rawResultStorage: nodeSelector: node-role.kubernetes.io/master: '' pvAccessModes: - ReadWriteOnce rotation: 3 size: 1Gi tolerations: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists - effect: NoExecute key: node.kubernetes.io/not-ready operator: Exists tolerationSeconds: 300 - effect: NoExecute key: node.kubernetes.io/unreachable operator: Exists tolerationSeconds: 300 - effect: NoSchedule key: node.kubernetes.io/memory-pressure operator: Exists schedule: 0 1 * * * roles: - master - worker apiVersion: compliance.openshift.io/v1alpha1 maxRetryOnTimeout: 3 scanTolerations: - operator: Exists scanLimits: memory: 1024Mi1 - 1
- The default setting is
500Mi.
Apply the
CR to your cluster:ScanSetting$ oc apply -f scansetting.yaml
5.6.7.5. Configuring ScanSetting timeout Link kopierenLink in die Zwischenablage kopiert!
The
ScanSetting
ComplianceScanSetting
1h30m
maxRetryOnTimeout
Procedure
To set a
andtimeoutin ScanSetting, modify an existingmaxRetryOnTimeoutobject:ScanSettingapiVersion: compliance.openshift.io/v1alpha1 kind: ScanSetting metadata: name: default namespace: openshift-compliance rawResultStorage: rotation: 3 size: 1Gi roles: - worker - master scanTolerations: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists schedule: '0 1 * * *' timeout: '10m0s'1 maxRetryOnTimeout: 32
5.6.7.6. Getting support Link kopierenLink in die Zwischenablage kopiert!
If you experience difficulty with a procedure described in this documentation, or with OpenShift Container Platform in general, visit the Red Hat Customer Portal.
From the Customer Portal, you can:
- Search or browse through the Red Hat Knowledgebase of articles and solutions relating to Red Hat products.
- Submit a support case to Red Hat Support.
- Access other product documentation.
To identify issues with your cluster, you can use Insights in OpenShift Cluster Manager. Insights provides details about issues and, if available, information on how to solve a problem.
If you have a suggestion for improving this documentation or have found an error, submit a Jira issue for the most relevant documentation component. Please provide specific details, such as the section name and OpenShift Container Platform version.
5.6.8. Using the oc-compliance plugin Link kopierenLink in die Zwischenablage kopiert!
Although the Compliance Operator automates many of the checks and remediations for the cluster, the full process of bringing a cluster into compliance often requires administrator interaction with the Compliance Operator API and other components. The
oc-compliance
5.6.8.1. Installing the oc-compliance plugin Link kopierenLink in die Zwischenablage kopiert!
Procedure
Extract the
image to get theoc-compliancebinary:oc-compliance$ podman run --rm -v ~/.local/bin:/mnt/out:Z registry.redhat.io/compliance/oc-compliance-rhel8:stable /bin/cp /usr/bin/oc-compliance /mnt/out/Example output
W0611 20:35:46.486903 11354 manifest.go:440] Chose linux/amd64 manifest from the manifest list.You can now run
.oc-compliance
5.6.8.2. Fetching raw results Link kopierenLink in die Zwischenablage kopiert!
When a compliance scan finishes, the results of the individual checks are listed in the resulting
ComplianceCheckResult
Procedure
Fetching the results from the PV with the Compliance Operator is a four-step process. However, with the
plugin, you can use a single command:oc-compliance$ oc compliance fetch-raw <object-type> <object-name> -o <output-path>-
can be either
<object-type>,scansettingbindingorcompliancescan, depending on which of these objects the scans were launched with.compliancesuite - is the name of the binding, suite, or scan object to gather the ARF file for, and
<object-name>is the local directory to place the results.<output-path>For example:
$ oc compliance fetch-raw scansettingbindings my-binding -o /tmp/Example output
Fetching results for my-binding scans: ocp4-cis, ocp4-cis-node-worker, ocp4-cis-node-master Fetching raw compliance results for scan 'ocp4-cis'....... The raw compliance results are available in the following directory: /tmp/ocp4-cis Fetching raw compliance results for scan 'ocp4-cis-node-worker'........... The raw compliance results are available in the following directory: /tmp/ocp4-cis-node-worker Fetching raw compliance results for scan 'ocp4-cis-node-master'...... The raw compliance results are available in the following directory: /tmp/ocp4-cis-node-master
View the list of files in the directory:
$ ls /tmp/ocp4-cis-node-master/
Example output
ocp4-cis-node-master-ip-10-0-128-89.ec2.internal-pod.xml.bzip2 ocp4-cis-node-master-ip-10-0-150-5.ec2.internal-pod.xml.bzip2 ocp4-cis-node-master-ip-10-0-163-32.ec2.internal-pod.xml.bzip2
Extract the results:
$ bunzip2 -c resultsdir/worker-scan/worker-scan-stage-459-tqkg7-compute-0-pod.xml.bzip2 > resultsdir/worker-scan/worker-scan-ip-10-0-170-231.us-east-2.compute.internal-pod.xml
View the results:
$ ls resultsdir/worker-scan/
Example output
worker-scan-ip-10-0-170-231.us-east-2.compute.internal-pod.xml
worker-scan-stage-459-tqkg7-compute-0-pod.xml.bzip2
worker-scan-stage-459-tqkg7-compute-1-pod.xml.bzip2
5.6.8.3. Re-running scans Link kopierenLink in die Zwischenablage kopiert!
Although it is possible to run scans as scheduled jobs, you must often re-run a scan on demand, particularly after remediations are applied or when other changes to the cluster are made.
Procedure
Rerunning a scan with the Compliance Operator requires use of an annotation on the scan object. However, with the
plugin you can rerun a scan with a single command. Enter the following command to rerun the scans for theoc-complianceobject namedScanSettingBinding:my-binding$ oc compliance rerun-now scansettingbindings my-bindingExample output
Rerunning scans from 'my-binding': ocp4-cis Re-running scan 'openshift-compliance/ocp4-cis'
5.6.8.4. Using ScanSettingBinding custom resources Link kopierenLink in die Zwischenablage kopiert!
When using the
ScanSetting
ScanSettingBinding
schedule
machine roles
tolerations
ComplianceSuite
ComplianceScan
The
oc compliance bind
ScanSettingBinding
Procedure
Run:
$ oc compliance bind [--dry-run] -N <binding name> [-S <scansetting name>] <objtype/objname> [..<objtype/objname>]-
If you omit the flag, the
-Sscan setting provided by the Compliance Operator is used.default -
The object type is the Kubernetes object type, which can be or
profile. More than one object can be provided.tailoredprofile -
The object name is the name of the Kubernetes resource, such as .
.metadata.name Add the
option to display the YAML file of the objects that are created.--dry-runFor example, given the following profiles and scan settings:
$ oc get profile.compliance -n openshift-complianceExample output
NAME AGE VERSION ocp4-cis 3h49m 1.5.0 ocp4-cis-1-4 3h49m 1.4.0 ocp4-cis-1-5 3h49m 1.5.0 ocp4-cis-node 3h49m 1.5.0 ocp4-cis-node-1-4 3h49m 1.4.0 ocp4-cis-node-1-5 3h49m 1.5.0 ocp4-e8 3h49m ocp4-high 3h49m Revision 4 ocp4-high-node 3h49m Revision 4 ocp4-high-node-rev-4 3h49m Revision 4 ocp4-high-rev-4 3h49m Revision 4 ocp4-moderate 3h49m Revision 4 ocp4-moderate-node 3h49m Revision 4 ocp4-moderate-node-rev-4 3h49m Revision 4 ocp4-moderate-rev-4 3h49m Revision 4 ocp4-nerc-cip 3h49m ocp4-nerc-cip-node 3h49m ocp4-pci-dss 3h49m 3.2.1 ocp4-pci-dss-3-2 3h49m 3.2.1 ocp4-pci-dss-4-0 3h49m 4.0.0 ocp4-pci-dss-node 3h49m 3.2.1 ocp4-pci-dss-node-3-2 3h49m 3.2.1 ocp4-pci-dss-node-4-0 3h49m 4.0.0 ocp4-stig 3h49m V2R1 ocp4-stig-node 3h49m V2R1 ocp4-stig-node-v1r1 3h49m V1R1 ocp4-stig-node-v2r1 3h49m V2R1 ocp4-stig-v1r1 3h49m V1R1 ocp4-stig-v2r1 3h49m V2R1 rhcos4-e8 3h49m rhcos4-high 3h49m Revision 4 rhcos4-high-rev-4 3h49m Revision 4 rhcos4-moderate 3h49m Revision 4 rhcos4-moderate-rev-4 3h49m Revision 4 rhcos4-nerc-cip 3h49m rhcos4-stig 3h49m V2R1 rhcos4-stig-v1r1 3h49m V1R1 rhcos4-stig-v2r1 3h49m V2R1$ oc get scansettings -n openshift-complianceExample output
NAME AGE default 10m default-auto-apply 10m
-
If you omit the
To apply the
settings to thedefaultandocp4-cisprofiles, run:ocp4-cis-node$ oc compliance bind -N my-binding profile/ocp4-cis profile/ocp4-cis-nodeExample output
Creating ScanSettingBinding my-bindingAfter the
CR is created, the bound profile begins scanning for both profiles with the related settings. Overall, this is the fastest way to begin scanning with the Compliance Operator.ScanSettingBinding
5.6.8.5. Printing controls Link kopierenLink in die Zwischenablage kopiert!
Compliance standards are generally organized into a hierarchy as follows:
- A benchmark is the top-level definition of a set of controls for a particular standard. For example, FedRAMP Moderate or Center for Internet Security (CIS) v.1.6.0.
- A control describes a family of requirements that must be met in order to be in compliance with the benchmark. For example, FedRAMP AC-01 (access control policy and procedures).
- A rule is a single check that is specific for the system being brought into compliance, and one or more of these rules map to a control.
- The Compliance Operator handles the grouping of rules into a profile for a single benchmark. It can be difficult to determine which controls that the set of rules in a profile satisfy.
Procedure
The
oc compliancesubcommand provides a report of the standards and controls that a given profile satisfies:controls$ oc compliance controls profile ocp4-cis-nodeExample output
+-----------+----------+ | FRAMEWORK | CONTROLS | +-----------+----------+ | CIS-OCP | 1.1.1 | + +----------+ | | 1.1.10 | + +----------+ | | 1.1.11 | + +----------+ ...
5.6.8.6. Fetching compliance remediation details Link kopierenLink in die Zwischenablage kopiert!
The Compliance Operator provides remediation objects that are used to automate the changes required to make the cluster compliant. The
fetch-fixes
fetch-fixes
ComplianceRemediation
Procedure
View the remediations for a profile:
$ oc compliance fetch-fixes profile ocp4-cis -o /tmpExample output
No fixes to persist for rule 'ocp4-api-server-api-priority-flowschema-catch-all'1 No fixes to persist for rule 'ocp4-api-server-api-priority-gate-enabled' No fixes to persist for rule 'ocp4-api-server-audit-log-maxbackup' Persisted rule fix to /tmp/ocp4-api-server-audit-log-maxsize.yaml No fixes to persist for rule 'ocp4-api-server-audit-log-path' No fixes to persist for rule 'ocp4-api-server-auth-mode-no-aa' No fixes to persist for rule 'ocp4-api-server-auth-mode-node' No fixes to persist for rule 'ocp4-api-server-auth-mode-rbac' No fixes to persist for rule 'ocp4-api-server-basic-auth' No fixes to persist for rule 'ocp4-api-server-bind-address' No fixes to persist for rule 'ocp4-api-server-client-ca' Persisted rule fix to /tmp/ocp4-api-server-encryption-provider-cipher.yaml Persisted rule fix to /tmp/ocp4-api-server-encryption-provider-config.yaml- 1
- The
No fixes to persistwarning is expected whenever there are rules in a profile that do not have a corresponding remediation, because either the rule cannot be remediated automatically or a remediation was not provided.
You can view a sample of the YAML file. The
command will show you the first 10 lines:head$ head /tmp/ocp4-api-server-audit-log-maxsize.yamlExample output
apiVersion: config.openshift.io/v1 kind: APIServer metadata: name: cluster spec: maximumFileSizeMegabytes: 100View the remediation from a
object created after a scan:ComplianceRemediation$ oc get complianceremediations -n openshift-complianceExample output
NAME STATE ocp4-cis-api-server-encryption-provider-cipher NotApplied ocp4-cis-api-server-encryption-provider-config NotApplied$ oc compliance fetch-fixes complianceremediations ocp4-cis-api-server-encryption-provider-cipher -o /tmpExample output
Persisted compliance remediation fix to /tmp/ocp4-cis-api-server-encryption-provider-cipher.yamlYou can view a sample of the YAML file. The
command will show you the first 10 lines:head$ head /tmp/ocp4-cis-api-server-encryption-provider-cipher.yamlExample output
apiVersion: config.openshift.io/v1 kind: APIServer metadata: name: cluster spec: encryption: type: aescbc
Use caution before applying remediations directly. Some remediations might not be applicable in bulk, such as the usbguard rules in the moderate profile. In these cases, allow the Compliance Operator to apply the rules because it addresses the dependencies and ensures that the cluster remains in a good state.
5.6.8.7. Viewing ComplianceCheckResult object details Link kopierenLink in die Zwischenablage kopiert!
When scans are finished running,
ComplianceCheckResult
view-result
ComplianceCheckResult
Procedure
Run:
$ oc compliance view-result ocp4-cis-scheduler-no-bind-address