
title: Ensure that Audit Log Forwarding Is Enabled

description: |-
  OpenShift audit works at the API server level, logging all requests coming to the server.
  Audit is on by default and the best practice is to ship audit logs off the cluster for retention.
  The cluster-logging-operator is able to do this with the <pre>ClusterLogForwarders</pre> resource.
  The forementioned resource can be configured to logs to different third party systems.
  For more information on this, please reference the official documentation:
  {{{ weblink(link="https://docs.openshift.com/container-platform/latest/observability/logging/logging-6.0/log6x-clf.html") }}}

rationale: |-
  Retaining logs ensures the ability to go back in time to investigate or correlate any events.
  Offloading audit logs from the cluster ensures that an attacker that has access to the cluster will not be able to
  tamper with the logs because of the logs being stored off-site.

severity: medium

identifiers:
  cce@ocp4: CCE-84076-9

references:
  cis@ocp4: 1.2.21
  nerc-cip: CIP-003-8 R5.2,CIP-004-6 R2.2.2,CIP-004-6 R2.2.3,CIP-004-6 R3.3,CIP-007-3 R.1.3,CIP-007-3 R5,CIP-007-3 R5.1.1,CIP-007-3 R5.2,CIP-007-3 R5.3.1,CIP-007-3 R5.3.2,CIP-007-3 R5.3.3,CIP-007-3 R6.5
  nist: AC-2(12),AU-3(2),AU-5(1),AU-6,AU-6(1),AU-6(3),AU-9(2),SI-4(16),AU-4(1),AU-11,AU-7,AU-7(1),SI-4(20)
  pcidss: Req-2.2,Req-10.5.3,Req-10.5.4
  srg: SRG-APP-000092-CTR-000165,SRG-APP-000111-CTR-000220,SRG-APP-000358-CTR-000805

platform: not ocp4-on-hypershift and not ocp4-on-hypershift-hosted and not aarch64_arch


ocil_clause: 'Logs are not forwarded outside the cluster'

ocil: |-
    Run the following command:
    <pre>oc get clusterlogforwarders -n openshift-logging -ojson | jq -r '.items[].spec.pipelines[].inputRefs | contains(["audit"])'</pre>
    The output should return <pre>true</pre>.

warnings:
- general: |-
    {{{ openshift_cluster_setting(["/apis/observability.openshift.io/v1/namespaces/openshift-logging/clusterlogforwarders", "/apis/logging.openshift.io/v1/namespaces/openshift-logging/clusterlogforwarders/instance"], true) | indent(4) }}}
