Bug 1821725
| Summary: | AVCs seen when rsyslog is configured to read or write to non-standard places | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Renaud Métrich <rmetrich> |
| Component: | selinux-policy | Assignee: | Zdenek Pytela <zpytela> |
| Status: | CLOSED WONTFIX | QA Contact: | BaseOS QE Security Team <qe-baseos-security> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.7 | CC: | lvrabec, mmalik, mmatsuya, plautrba, ssekidde, vmojzis |
| Target Milestone: | rc | Keywords: | Reopened, Triaged |
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-04-08 09:11:27 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
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. I cannot accept this decision, please reconsider this. rsyslog BZ 1763746 which was Urgent/Urgent needs this fix to function properly. |
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.