TMAegis
More rules for linux

TMA-ROCKY8-6.2.2.4

Ensure rsyslog log file creation mode is configured

MediumLevel 1Automatedlinux

Description

rsyslog will create logfiles that do not already exist on the system. The global() configuration object umask, available in rsyslog 8.26.0+, sets the rsyslogd process’ umask. If not specified, the system-provided default is used. The value given must always be a 4-digit octal number, with the initial digit being zero. The legacy $umask parameter sets the rsyslogd process' umask. If not specified, the system-provided default is used. The value given must always be a 4-digit octal number, with the initial digit being zero. The legacy $FileCreateMode parameter allows the setting of the mode with

How it is checked

Audit method: Shell command

shell
alt0() { command -v grep >/dev/null 2>&1 || { echo "step1: grep not installed"; return 1; }; o=$(bash -c 'grep -Ps '"'"'^\h*\$FileCreateMode\h+0[0,2,4,6][0,2,4]0\b'"'"' /etc/rsyslog.conf /etc/rsyslog.d/*.conf' 2>&1); printf '%s\n' "$o" | tr -s ' \t' '  ' | sed 's/^ //;s/ $//' | grep -Fxq -- '$FileCreateMode 0640' || { echo step1: missing '$FileCreateMode 0640'; return 1; }; }; if alt0; then echo compliant; fi
Expected output
compliant

How it is fixed

Fix method: Guidance or infrastructure patch

Edit either /etc/rsyslog.conf or a dedicated .conf file in /etc/rsyslog.d/ and set $FileCreateMode to 0640 or more restrictive: $FileCreateMode 0640 Restart the service: # systemctl restart rsyslog

Properties

Operating systems
rocky-8
Tags
cis-convertedlinux
Reference
CIS Rocky Linux 8 Benchmark v3.0.0 - 6.2.2.4

Check this host

Run this on a machine you are allowed to audit. The scan is read-only.

shell
tmaegis scan --target linux