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:
- When rsyslog is configured to read logs from a file ("imfile" module) and the file's parent directories are non-standard (e.g. /var/www/prod/host/logs/access_log), AVCs related to browsing the parent directories are seen but rsyslog is still functional:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
allow syslogd_t httpd_sys_content_t:dir read;
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
This is new with latest rsyslog-8.24.0-52.el7.x86_64
- When rsyslog is configured to write logs to a file in a non-standard place (e.g. /my/custom/log directory labeled "public_content_rw_t"), AVCs related to browsing the parent directories are seen *and* rsyslog is not functional:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
allow syslogd_t public_content_rw_t:dir search;
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
In the logs we can see a lot of Permission denies:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
omfile: creating parent directories for file 'Permission denied' failed: /my/custom/log/messages [v8.24.0-52.el7]
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
Version-Release number of selected component (if applicable):
rsyslog-8.24.0-52.el7.x86_64 & selinux-policy-3.13.1-266.el7.noarch
How reproducible:
Always
Steps to Reproduce:
1. Configure "omfile" to write to some alternate directory
in /etc/rsyslog.conf:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
*.info;mail.none;authpriv.none;cron.none;local2.none /my/custom/log/messages
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
custom contexts:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# semanage fcontext -a -t public_content_rw_t "/my/custom(/.*)?"
# semanage fcontext -a -t var_log_t "/my/custom/log(/.*)?"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
2. Configure "imfile" to read from some alternate directory (regular path under /var/www):
in /etc/rsyslog.d/web.conf:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
$ModLoad imfile
$InputFileName /var/www/prod/host/logs/access_log
$InputFileTag www_tag
$InputFileSeverity notice
$InputFileFacility local6
$InputFilePersistStateInterval 0
$InputRunFileMonitor
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
create the dirs:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# mkdir -p /var/www/prod/host/logs
# restorecon -Frv /var/www/prod
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
3. Restart rsyslog
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# systemctl restart rsyslog
# ausearch -m avc -ts recent | grep -w syslogd_t | audit2allow
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
Actual results:
#============= syslogd_t ==============
allow syslogd_t httpd_sys_content_t:dir read;
allow syslogd_t public_content_rw_t:dir search;
Expected results:
No AVCs
Additional info:
In the example above, "omfile" logs were to be placed in a directory under public_content_rw_t (but logs still labeled var_log_t).
This comes from a real case from customer.
The wish fix is to allow syslogd_t to read/search any directory except secure content, it shouldn't be limited to httpd/public_content stuff.
The fix for rsyslog BZ 1763746 really needs rsyslog to be able to open parent directories when imfile is used, e.g. "allow syslogd_t httpd_sys_content_t:dir read;"
This should apply to any possible type allowed for directories.
An alternative is to have a "dontaudit" rule for this since upon failure and in case of directories, the imfile module will still be functional.
This issue was not selected to be included in Red Hat Enterprise Linux 7 because it is seen either as low or moderate impact to a small number of use-cases. Current minor 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.
Description of problem: - When rsyslog is configured to read logs from a file ("imfile" module) and the file's parent directories are non-standard (e.g. /var/www/prod/host/logs/access_log), AVCs related to browsing the parent directories are seen but rsyslog is still functional: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- allow syslogd_t httpd_sys_content_t:dir read; -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- This is new with latest rsyslog-8.24.0-52.el7.x86_64 - When rsyslog is configured to write logs to a file in a non-standard place (e.g. /my/custom/log directory labeled "public_content_rw_t"), AVCs related to browsing the parent directories are seen *and* rsyslog is not functional: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- allow syslogd_t public_content_rw_t:dir search; -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- In the logs we can see a lot of Permission denies: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- omfile: creating parent directories for file 'Permission denied' failed: /my/custom/log/messages [v8.24.0-52.el7] -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- Version-Release number of selected component (if applicable): rsyslog-8.24.0-52.el7.x86_64 & selinux-policy-3.13.1-266.el7.noarch How reproducible: Always Steps to Reproduce: 1. Configure "omfile" to write to some alternate directory in /etc/rsyslog.conf: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- *.info;mail.none;authpriv.none;cron.none;local2.none /my/custom/log/messages -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- custom contexts: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # semanage fcontext -a -t public_content_rw_t "/my/custom(/.*)?" # semanage fcontext -a -t var_log_t "/my/custom/log(/.*)?" -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- 2. Configure "imfile" to read from some alternate directory (regular path under /var/www): in /etc/rsyslog.d/web.conf: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- $ModLoad imfile $InputFileName /var/www/prod/host/logs/access_log $InputFileTag www_tag $InputFileSeverity notice $InputFileFacility local6 $InputFilePersistStateInterval 0 $InputRunFileMonitor -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- create the dirs: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # mkdir -p /var/www/prod/host/logs # restorecon -Frv /var/www/prod -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- 3. Restart rsyslog -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # systemctl restart rsyslog # ausearch -m avc -ts recent | grep -w syslogd_t | audit2allow -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- Actual results: #============= syslogd_t ============== allow syslogd_t httpd_sys_content_t:dir read; allow syslogd_t public_content_rw_t:dir search; Expected results: No AVCs Additional info: In the example above, "omfile" logs were to be placed in a directory under public_content_rw_t (but logs still labeled var_log_t). This comes from a real case from customer. The wish fix is to allow syslogd_t to read/search any directory except secure content, it shouldn't be limited to httpd/public_content stuff.