| Summary: | Missing Type Enforcement rules for webalizer | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Vicente <vtorres> |
| Component: | selinux-policy | Assignee: | Lukas Vrabec <lvrabec> |
| Status: | CLOSED EOL | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 24 | CC: | dominick.grift, dwalsh, lvrabec, mgrepl, plautrba, pmoore |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-08-08 19:21:19 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: | |
I reproduced from scratch, and after the first run of webalizer with SElinux set to permissive, I get the following audit:
type=AVC msg=audit(1476779941.922:242): avc: denied { write } for pid=1867 comm="webalizer" name="usage" dev="dm-0" ino=16807402 scontext=system_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=system_u:object_r:webalizer_rw_content_t:s0 tclass=dir permissive=1
type=AVC msg=audit(1476779941.922:243): avc: denied { add_name } for pid=1867 comm="webalizer" name="daily_usage_201610.png" scontext=system_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=system_u:object_r:webalizer_rw_content_t:s0 tclass=dir permissive=1
type=AVC msg=audit(1476779941.923:244): avc: denied { create } for pid=1867 comm="webalizer" name="daily_usage_201610.png" scontext=system_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=system_u:object_r:webalizer_rw_content_t:s0 tclass=file permissive=1
type=AVC msg=audit(1476779941.923:245): avc: denied { write open } for pid=1867 comm="webalizer" path="/var/www/usage/daily_usage_201610.png" dev="dm-0" ino=16807408 scontext=system_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=system_u:object_r:webalizer_rw_content_t:s0 tclass=file permissive=1
type=AVC msg=audit(1476779941.923:246): avc: denied { getattr } for pid=1867 comm="webalizer" path="/var/www/usage/daily_usage_201610.png" dev="dm-0" ino=16807408 scontext=system_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=system_u:object_r:webalizer_rw_content_t:s0 tclass=file permissive=1
This message is a reminder that Fedora 24 is nearing its end of life. Approximately 2 (two) weeks from now Fedora will stop maintaining and issuing updates for Fedora 24. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '24'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 24 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed. |
Description of problem: Submitting bug according to RedHat documentation. When webalizer is run as a cron job to analyze squid logs and generate the output in /var/www/usage, it does not work (it issues the error shown below). On the other hand, if webalizer is run manually as root, it runs OK and generates the expected output in /var/www/usage. In addition, if I change SELinux mode from enforcing to permissive, the cron job works as expected. Log entries found in /var/log/cron (SELinux mode is enforcing): Oct 7 09:55:01 proxy2 CROND[1137]: (root) CMD (run-parts /etc/cron.daily) Oct 7 09:55:01 proxy2 run-parts[1137]: (/etc/cron.daily) starting 00webalizer Oct 7 09:55:01 proxy2 CROND[1136]: (root) CMDOUT (/etc/cron.daily/00webalizer:) Oct 7 09:55:01 proxy2 CROND[1136]: (root) CMDOUT () Oct 7 09:55:01 proxy2 CROND[1136]: (root) CMDOUT (Error: Can't change directory to /var/www/usage) Oct 7 09:55:01 proxy2 run-parts[1137]: (/etc/cron.daily) finished 00webalizer Log entries found in /var/log/audit/audit.log (SELinux mode is permissive): type=AVC msg=audit(1475853301.494:183): avc: denied { getattr } for pid=1063 comm="webalizer" path="/var/www/usage/daily_usage_201610.png" dev="dm-0" ino= 510047 scontext=system_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:webalizer_rw_content_t:s0 tclass=file permissive=1 type=AVC msg=audit(1475853301.495:184): avc: denied { write } for pid=1063 comm="webalizer" name="daily_usage_201610.png" dev="dm-0" ino=510047 scontext=s ystem_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:webalizer_rw_content_t:s0 tclass=file permissive=1 type=AVC msg=audit(1475853301.495:185): avc: denied { open } for pid=1063 comm="webalizer" path="/var/www/usage/daily_usage_201610.png" dev="dm-0" ino=510 047 scontext=system_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:webalizer_rw_content_t:s0 tclass=file permissive=1 Version-Release number of selected component (if applicable): Source RPM : webalizer-2.23_08-3.fc24.src.rpm Source RPM : selinux-policy-3.13.1-191.16.fc24.src.rpm Source RPM : squid-3.5.20-1.fc24.src.rpm Source RPM : httpd-2.4.23-4.fc24.src.rpm Source RPM : kernel-4.7.3-200.fc24.src.rpm How reproducible: 100% Steps to Reproduce: 1. Install and upgrade required packages with dnf: dnf upgrade dnf install squid dnf install webalizer 2. Configure services as needed (squid, httpd, webalizer) vi /etc/webalizer.conf #LogFile /var/log/httpd/access_log LogFile /var/log/squid/access.log LogType squid 3. Start and enable services systemctl start squid.service systemctl enable squid.service systemctl start httpd.service systemctl enable httpd.service 4. Enable webalizer in cron vi /etc/sysconfig/webalizer WEBALIZER_CRON=yes vi /etc/crontab 35 10 * * * root run-parts /etc/cron.daily cat /etc/cron.daily/00webalizer #!/bin/bash NAME=webalizer [ -f /etc/sysconfig/$NAME ] || exit 0 source /etc/sysconfig/$NAME [ "z$WEBALIZER_CRON" != "zyes" ] && exit 0 exec /usr/bin/webalizer -Q Actual results: Failure to run by cron as noted above unless SELinux changed to permissive or run manual. Expected results: Should run as a cron job with SELinux mode is enforcing. Additional info: audit2allow -a #============= webalizer_t ============== allow webalizer_t webalizer_rw_content_t:file { getattr open write }; audit2allow -w -a type=AVC msg=audit(1475853301.494:183): avc: denied { getattr } for pid=1063 comm="webalizer" path="/var/www/usage/daily_usage_201610.png" dev="dm-0" ino=510047 scontext=system_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:webalizer_rw_content_t:s0 tclass=file permissive=1 Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access. type=AVC msg=audit(1475853301.495:184): avc: denied { write } for pid=1063 comm="webalizer" name="daily_usage_201610.png" dev="dm-0" ino=510047 scontext=system_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:webalizer_rw_content_t:s0 tclass=file permissive=1 Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access. type=AVC msg=audit(1475853301.495:185): avc: denied { open } for pid=1063 comm="webalizer" path="/var/www/usage/daily_usage_201610.png" dev="dm-0" ino=510047 scontext=system_u:system_r:webalizer_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:webalizer_rw_content_t:s0 tclass=file permissive=1 Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access. # ls -laZ /var/www drwxr-xr-x. 5 root root system_u:object_r:httpd_sys_content_t:s0 46 Sep 22 18:57 . drwxr-xr-x. 22 root root system_u:object_r:var_t:s0 4096 Oct 7 10:30 .. drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_script_exec_t:s0 6 Jul 18 10:47 cgi-bin drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_content_t:s0 6 Jul 18 10:47 html drwxr-xr-x. 2 webalizer root system_u:object_r:webalizer_rw_content_t:s0 4096 Oct 3 18:06 usage # ls -laZ /var/www/usage drwxr-xr-x. 2 webalizer root system_u:object_r:webalizer_rw_content_t:s0 4096 Oct 3 18:06 . drwxr-xr-x. 5 root root system_u:object_r:httpd_sys_content_t:s0 46 Sep 22 18:57 .. -rw-r--r--. 1 root root unconfined_u:object_r:webalizer_rw_content_t:s0 2330 Sep 30 10:21 ctry_usage_201609.png -rw-r--r--. 1 root root unconfined_u:object_r:webalizer_rw_content_t:s0 2771 Oct 7 10:15 ctry_usage_201610.png -rw-r--r--. 1 root root unconfined_u:object_r:webalizer_rw_content_t:s0 2576 Sep 30 10:21 daily_usage_201609.png -rw-r--r--. 1 root root unconfined_u:object_r:webalizer_rw_content_t:s0 2796 Oct 7 10:15 daily_usage_201610.png -rw-r--r--. 1 root root unconfined_u:object_r:webalizer_rw_content_t:s0 1692 Sep 30 10:21 hourly_usage_201609.png -rw-r--r--. 1 root root unconfined_u:object_r:webalizer_rw_content_t:s0 1864 Oct 7 10:15 hourly_usage_201610.png -rw-r--r--. 1 root root unconfined_u:object_r:webalizer_rw_content_t:s0 4235 Oct 7 10:15 index.html -rw-r--r--. 1 webalizer root system_u:object_r:webalizer_rw_content_t:s0 1478 Mar 21 2008 msfree.png -rw-r--r--. 1 root root unconfined_u:object_r:webalizer_rw_content_t:s0 48691 Sep 30 10:21 usage_201609.html -rw-r--r--. 1 root root unconfined_u:object_r:webalizer_rw_content_t:s0 59716 Oct 7 10:15 usage_201610.html -rw-r--r--. 1 root root unconfined_u:object_r:webalizer_rw_content_t:s0 2264 Oct 7 10:15 usage.png -rw-r--r--. 1 webalizer root system_u:object_r:webalizer_rw_content_t:s0 1253 Mar 21 2008 webalizer.png