Description of problem: In my /var/log/httpd/error_log: /usr/share/mediawiki/bin/ulimit4.sh: line 3: ulimit: cpu time: cannot modify lim it: Permission denied In my /var/log/messages: Jul 4 12:26:01 test2 setroubleshoot: SELinux is preventing /bin/bash "setrlimit" access . For complete SELinux messages. run sealert -l 36689457-5bdb-490f-a22c-1fa211a9a772 [root@test2 log]# sealert -l 36689457-5bdb-490f-a22c-1fa211a9a772 Summary: SELinux is preventing /bin/bash "setrlimit" access . Detailed Description: [ulimit4.sh has a permissive type (httpd_t). This access was not denied.] SELinux denied access requested by ulimit4.sh. It is not expected that this access is required by ulimit4.sh and this access may signal an intrusion attempt. It is also possible that the specific version or configuration of the application is causing it to require additional access. Allowing Access: You can generate a local policy module to allow this access - see FAQ (http://docs.fedoraproject.org/selinux-faq-fc5/#id2961385) Please file a bug report. Additional Information: Source Context unconfined_u:system_r:httpd_t:s0 Target Context unconfined_u:system_r:httpd_t:s0 Target Objects None [ process ] Source ulimit4.sh Source Path /bin/bash Port <Unknown> Host test2.nomic.net Source RPM Packages bash-4.1.7-1.fc13 Target RPM Packages Policy RPM selinux-policy-3.7.19-28.fc13 Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Plugin Name catchall Host Name test2.nomic.net Platform Linux test2.nomic.net 2.6.33.5-124.fc13.x86_64 #1 SMP Fri Jun 11 09:38:12 UTC 2010 x86_64 x86_64 Alert Count 192 First Seen Sat Jul 3 16:15:21 2010 Last Seen Sun Jul 4 12:51:19 2010 Local ID 36689457-5bdb-490f-a22c-1fa211a9a772 Line Numbers Raw Audit Messages node=test2.nomic.net type=AVC msg=audit(1278273079.252:2470): avc: denied { setrlimit } for pid=29044 comm="ulimit4.sh" scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:system_r:httpd_t:s0 tclass=process node=test2.nomic.net type=SYSCALL msg=audit(1278273079.252:2470): arch=c000003e syscall=160 success=yes exit=128 a0=0 a1=7fff8c7455f0 a2=0 a3=100 items=0 ppid=15336 pid=29044 auid=500 uid=48 gid=489 euid=48 suid=48 fsuid=48 egid=489 sgid=489 fsgid=489 tty=(none) ses=7 comm="ulimit4.sh" exe="/bin/bash" subj=unconfined_u:system_r:httpd_t:s0 key=(null) The ulimit4.sh script is used by MediaWiki to apply $wgMaxShellTime and $wgMaxShellMemory when it has to execute commands (e.g., this happens when thumbnailing images). On a busy wiki, you'll end up with tons of these warnings. Since this is normal behavior, it would be nice if SELinux didn't warn about it. Version-Release number of selected component (if applicable): selinux-policy-targeted-3.7.19-28.fc13.noarch How reproducible: Always. Steps to Reproduce: 1. Brows to the wiki. 2. Request an image thumbnail which doesn't yet exist. Actual results: An SELinux warning. Expected results: No SELinux warning.
You can add these rules for now using # grep avc /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp I think it might be best to add policy for mediawiki. We really do not want to start granting setrlimit to all apache processes.
Actually Miroslav lets add a boolean. ## <desc> ## <p> ## Allow httpd daemon to change system limits ## </p> ## </desc> gen_tunable(httpd_setrlimit, false) tunable_policy(`httpd_setrlimit',` allow httpd_t self:process setrlimit; ')
Fixed in selinux-policy-3.7.19-36.fc13
This seems not to work: 1. I got this error messasge when I installed selinux-policy-targeted-3.7.19-36.fc13: /etc/selinux/targeted/contexts/files/file_contexts: Multiple different specifications for /usr/libexec/telepathy-sofiasip (system_u:object_r:telepathysofiasip_exec_t:s0 and system_u:object_r:telepathy_sofiasip_exec_t:s0). /etc/selinux/targeted/contexts/files/file_contexts: Invalid argument libsemanage.semanage_install_active: setfiles returned error code 1. semodule: Failed! 2. setsebool -P httpd_setrlimit 1 libsemanage.dbase_llist_set: record not found in the database libsemanage.dbase_llist_set: could not set record value Could not change boolean httpd_setrlimit Could not change policy booleans 3. The new boolean isn't documented in httpd_selinux(8).
I am fixing this issue. Please run # semodule -r telepathysofiasip and then install selinux-policy-targeted package from Koji again. Thanks. Updated selinux-policy packages will be available today.
It seems to work now. Thanks.
selinux-policy-3.7.19-37.fc13 has been submitted as an update for Fedora 13. http://admin.fedoraproject.org/updates/selinux-policy-3.7.19-37.fc13
Hmm. Now that I've had time to test a bit more, I can see that turning on httpd_setrlimit causes a new problem: There's no SELinux denials now, but when ulimit4.sh calls convert, now it seg faults! This is 100% repeatable with httpd_setrlimit turned on, and never happens with httpd_setrlimit turned off (that is, convert always makes the image thumbnail properly). Here's what I see in my apache error_log: /usr/share/mediawiki/bin/ulimit4.sh: line 4: 12339 Segmentation fault (core dumped) '/usr/bin/convert' -quality 80 -background white -size 120 '/var/www/mediawiki/images/3/3f/Space_infantry_screenshot.jpg' -thumbnail '120x81!' -depth 8 -sharpen '0x0.4' '/var/www/mediawiki/images/thumb/3/3f/Space_infantry_screenshot.jpg/120px-Space_infantry_screenshot.jpg' 2>&1
The crash of convert is reported in Bug 614638.
selinux-policy-3.7.19-37.fc13 has been pushed to the Fedora 13 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update selinux-policy'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/selinux-policy-3.7.19-37.fc13
This message is a reminder that Fedora 13 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 13. 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 WONTFIX if it remains open with a Fedora 'version' of '13'. 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 prior to Fedora 13's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 13 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 please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. 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. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Fedora 13 changed to end-of-life (EOL) status on 2011-06-25. Fedora 13 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. Thank you for reporting this bug and we are sorry it could not be fixed.