Information
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 which rsyslogd creates new files. If not specified, the value 0644 is used. 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 process umask If in doubt, use $umask 0000 right at the beginning of the configuration file to remove any restrictions.
The legacy $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.
Solution
Edit either /etc/rsyslog.conf or a dedicatedconf file in /etc/rsyslog.d/ and set $FileCreateMode to 0640 or more restrictive:
$FileCreateMode 0640
Example script to create a drop-in configuration file in the default include location:
#!/usr/bin/env bash
{
[ ! -d "/etc/rsyslog.d/" ] && mkdir /etc/rsyslog.d/
printf '%s
' "" "$FileCreateMode 0640" >> /etc/rsyslog.d/60-rsyslog.conf
}
Reload the service:
# systemctl reload-or-restart rsyslog
Item Details
Category: ACCESS CONTROL, AUDIT AND ACCOUNTABILITY, MEDIA PROTECTION
References: 800-53|AC-3, 800-53|AC-5, 800-53|AC-6, 800-53|AU-2, 800-53|AU-7, 800-53|AU-12, 800-53|MP-2, CSCv7|5.1, CSCv7|6.2, CSCv7|6.3
Control ID: 0ce6584047283866b77f520a7242b70c3caa52fd0039d3de28d004e7465024bb