Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
On a default installation of collectd there isn't a default place to write to a log file using logfile plugin.
On collectd's website: https://collectd.org/wiki/index.php/Plugin:LogFile
They suggest:
File "/var/log/collectd.log"
If you enable that and start collectd, the file won't be created because the daemon can't write to that location since the file will get the default context of var_log_t.
It should also be able for logrotate to be able to rotate that file with the new context (if you decide on changing it)
Log files could also be in their own subdirectory of /var/log (like /var/log/collectd like other daemons writing there. This would be the best in my opinion)
Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-229.el7_6.6.noarch
How reproducible:
100%
Steps to Reproduce:
1. Install collectd
2. configure logfile in /etc/collectd.conf
<Plugin logfile>
LogLevel info
File "/var/log/collectd.log"
Timestamp true
PrintSeverity false
</Plugin>
3.systemctl start collectd
4 In /var/log/audit/audit.log:
type=PROCTITLE msg=audit(1544551925.528:4919): proctitle="/usr/sbin/collectd"
type=AVC msg=audit(1544551925.528:4920): avc: denied { write } for pid=31778 comm="writer#1" name="log" dev="vda1" ino=4239454 scontext=system_u:system_r:collectd_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir permissive=0
type=SYSCALL msg=audit(1544551925.528:4920): arch=c000003e syscall=2 success=no exit=-13 a0=561cd53f51d0 a1=441 a2=1b6 a3=24 items=0 ppid=1 pid=31778 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="writer#1" exe="/usr/sbin/collectd" subj=system_u:system_r:collectd_t:s0 key=(null)
Actual results:
The "default" log file can't be created or written into (after a logrotate) since the default context for /var/log is var_log_t and the daemon can't write to it.
Expected results:
Create some kind of standard so files gets created and logrotated properly with SELinux Enforcing.
Additional info:
Either we can use collectd policy from Fedora / RHEL-8 as inspiration, because it defines the type and rules:
# seinfo -t | grep 'collectd.*log'
collectd_log_t
#
Or we can use collectd_var_lib_t as workaround:
# mkdir /var/log/collectd
# semanage fcontext -a -t collectd_var_lib_t '/var/log/collectd(/.*)?'
# restorecon -Rv /var/log/collectd
but the /etc/collectd.conf file must contain "/var/log/collectd/collectd.log" instead of "/var/log/collectd.log".
I believe that Lukas Vrabec will be able to create a new type for it.
This issue was not selected to be included in Red Hat Enterprise Linux 7.7 because it is seen either as low or moderate impact to a small number of use-cases. The next release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available.
We will now close this issue, but if you believe that it qualifies for the Maintenance Support 1 Phase, please re-open; otherwise, we recommend moving the request to Red Hat Enterprise Linux 8 if applicable.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2020:1007