6.2.3.4 Ensure rsyslog log file creation mode is configured

Information

rsyslog will create logfiles that do not already exist on the system.

The $FileCreateMode parameter allows you to specify the creation mode with which rsyslog creates new files. If not specified, the value 0644 is used (which retains backward-compatibility with earlier releases). The value given must always be a 4-digit octal number, with the initial digit being zero.

Please note that the actual permission depend on rsyslogd's process umask.

$FileCreateMode may be specified multiple times. If so, it specifies the creation mode for all selector lines that follow until the next $FileCreateMode parameter. Order of lines is vitally important.

It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected.

Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used.

Solution

Edit either /etc/rsyslog.conf or a dedicatedconf file in /etc/rsyslog.d/ and set $FileCreateMode to 0640 or more restrictive:

$FileCreateMode 0640

Restart the service:

# systemctl restart rsyslog

See Also

https://workbench.cisecurity.org/benchmarks/18210