Bug 695698 - Wordpress needs a bit of SELinux love to run in the Enforcing mode
Summary: Wordpress needs a bit of SELinux love to run in the Enforcing mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy
Version: 6.3
Hardware: All
OS: Linux
medium
unspecified
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: Michal Trunecka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-12 13:10 UTC by Matěj Cepl
Modified: 2014-09-30 23:33 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-3.7.19-156.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-21 08:34:25 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0314 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2013-02-20 20:35:01 UTC

Description Matěj Cepl 2011-04-12 13:10:48 UTC
Description of problem:
In order to make wordpress as packaged for RHEL 6 (in EPEL) I needed to do these little changes.

Special module mywordpress:
[root@luther selinux]# cat mywordpress.te

module mywordpress 1.0;

require {
	type httpd_t;
	type httpd_sys_script_exec_t;
	class lnk_file { read getattr };
}

#============= httpd_t ==============
allow httpd_t httpd_sys_script_exec_t:lnk_file { read getattr };

(/etc/wordpress/wp-config.php is a symlink to /usr/share/wordpress/wp-config.php).

Also I added these fcontext patterns:

[root@luther selinux]# semanage fcontext -l -C
SELinux fcontext                                   type               Context

/usr/share/wordpress/.*\.php$                      all files          system_u:object_r:httpd_sys_script_exec_t:s0 

SELinux fcontext Equivalence 

/usr/share/wordpress/wp-content/upgrade(/.*)? = /usr/share/wordpress/wp-content/uploads/
[root@luther selinux]# 



Version-Release number of selected component (if applicable):
wordpress-3.1-1.el6.noarch
selinux-policy-3.7.19-54.el6_0.5.noarch

Comment 1 Miroslav Grepl 2011-08-22 06:03:16 UTC
I added changes to the latest RHEL6.2 policy.

Comment 2 Matěj Cepl 2012-04-23 12:56:38 UTC
Not good. After removing all my local fixes, I still have

[root@luther ~]# restorecon -v -R /usr/share/wordpress/
restorecon reset /usr/share/wordpress/wp-config.php context system_u:object_r:httpd_sys_script_exec_t:s0->system_u:object_r:usr_t:s0
restorecon reset /usr/share/wordpress/wp-content/plugins/akismet/index.php context unconfined_u:object_r:usr_t:s0->unconfined_u:object_r:httpd_sys_script_exec_t:s0
restorecon reset /usr/share/wordpress/wp-content/plugins/browserid/browserid.php context system_u:object_r:usr_t:s0->system_u:object_r:httpd_sys_script_exec_t:s0
restorecon reset /usr/share/wordpress/wp-includes/class-simplepie.php context system_u:object_r:httpd_sys_script_exec_t:s0->system_u:object_r:usr_t:s0
[root@luther ~]#

Comment 3 Matěj Cepl 2012-04-23 13:04:26 UTC
Specifically I am missing

[root@luther ~]# semanage fcontext -a -t httpd_sys_script_exec_t '/usr/share/wordpress/.*\.php$'
[root@luther ~]# restorecon -v -R /usr/share/wordpress/restorecon reset /usr/share/wordpress/wp-config.php context system_u:object_r:usr_t:s0->system_u:object_r:httpd_sys_script_exec_t:s0
restorecon reset /usr/share/wordpress/wp-includes/class-simplepie.php context system_u:object_r:usr_t:s0->system_u:object_r:httpd_sys_script_exec_t:s0
[root@luther ~]#

Comment 4 Miroslav Grepl 2012-04-23 13:09:12 UTC
$ rpm -q selinux-policy

Comment 6 Matěj Cepl 2012-04-23 13:16:04 UTC
wycliff:~ $ ssh luther rpm -q selinux-policy
selinux-policy-3.7.19-145.el6.noarch
wycliff:~ $

Comment 7 Miroslav Grepl 2012-04-24 10:49:52 UTC
[root@localhost ~]# matchpathcon /usr/share/wordpress/wp-config.php
/usr/share/wordpress/wp-config.php	system_u:object_r:httpd_sys_script_exec_t:s0

[root@localhost ~]# matchpathcon /usr/share/wordpress/wp-ine.phes/class-simplepi 
/usr/share/wordpress/wp-includes/class-simplepie.ph	system_u:object_r:usr_t:s0


I am fixing the second path.

Comment 8 Matěj Cepl 2012-04-24 13:34:13 UTC
Thank you

Comment 15 errata-xmlrpc 2013-02-21 08:34:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0314.html


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