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.
Bug 1821725 - AVCs seen when rsyslog is configured to read or write to non-standard places
Summary: AVCs seen when rsyslog is configured to read or write to non-standard places
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.7
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Zdenek Pytela
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-07 13:15 UTC by Renaud Métrich
Modified: 2023-09-07 22:43 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-08 09:11:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 4998201 0 None None None 2020-04-20 09:24:10 UTC

Description Renaud Métrich 2020-04-07 13:15:18 UTC
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.

Comment 2 Renaud Métrich 2020-04-07 14:32:33 UTC
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.

Comment 3 Lukas Vrabec 2020-04-07 15:04:21 UTC
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.

Comment 4 Renaud Métrich 2020-04-08 08:31:39 UTC
I cannot accept this decision, please reconsider this.
rsyslog BZ 1763746 which was Urgent/Urgent needs this fix to function properly.


Note You need to log in before you can comment on or make changes to this bug.