OpenShift must protect log directory from any type of unauthorized access by setting file permissions.

STIG ID: CNTR-OS-000280  |  SRG: SRG-APP-000118-CTR-000240 | Severity: medium |  CCI: CCI-000162

Vulnerability Discussion

Log files contain sensitive information such as user credentials, system configurations, and potentially even security-related events. Unauthorized access to log files can expose this sensitive data to malicious actors. By protecting the log directory, OpenShift ensures that only authorized users or processes can access the log files, preserving the confidentiality of the information contained within them.

Check

Verify the "/var/log" directory has a mode of "0755" or less by executing the following:

for node in $(oc get node -oname); do oc debug $node -- chroot /host /bin/bash -c 'echo -n "$HOSTNAME "; stat -c "%a %n" /var/log' 2>/dev/null; done

If a value of "0755" or less permissive is not returned, this is a finding.

Fix

Correct log directory permissions by executing the following:

for node in $(oc get node -oname); do oc debug $node -- chroot /host /bin/bash -c 'echo -n "$HOSTNAME "; chmod 755 /var/log/' 2>/dev/null; done