Applying a remediation
The boolean attribute spec.apply controls whether the remediation should be applied by the Compliance Operator. You can apply the remediation by setting the attribute to true.
-
Apply the remediation by setting the attribute to
true:$ oc -n openshift-compliance \ patch complianceremediations/<scan-name>-sysctl-net-ipv4-conf-all-accept-redirects \ --patch '{"spec":{"apply":true}}' --type=mergeAfter the Compliance Operator processes the applied remediation, the
status.ApplicationStateattribute would change to Applied or to Error if incorrect. When a machine config remediation is applied, that remediation along with all other applied remediations are rendered into aMachineConfigobject named75-$scan-name-$suite-name. ThatMachineConfigobject is subsequently rendered by the Machine Config Operator and finally applied to all the nodes in a machine config pool by an instance of the machine control daemon running on each node.Note that when the Machine Config Operator applies a new
MachineConfigobject to nodes in a pool, all the nodes belonging to the pool are rebooted. This might be inconvenient when applying multiple remediations, each of which re-renders the composite75-$scan-name-$suite-nameMachineConfigobject. To prevent applying the remediation immediately, you can pause the machine config pool by setting the.spec.pausedattribute of aMachineConfigPoolobject totrue. -
Optionally, the Compliance Operator can apply remediations automatically. Set
autoApplyRemediations: truein theScanSettingtop-level object.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.