Bug 695698 - Wordpress needs a bit of SELinux love to run in the Enforcing mode
Wordpress needs a bit of SELinux love to run in the Enforcing mode
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy (Show other bugs)
6.3
All Linux
medium Severity unspecified
: rc
: ---
Assigned To: Miroslav Grepl
Michal Trunecka
: Reopened, SELinux
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-12 09:10 EDT by Matěj Cepl
Modified: 2014-09-30 19:33 EDT (History)
8 users (show)

See Also:
Fixed In Version: selinux-policy-3.7.19-156.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 03:34:25 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Matěj Cepl 2011-04-12 09:10:48 EDT
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 02:03:16 EDT
I added changes to the latest RHEL6.2 policy.
Comment 2 Matěj Cepl 2012-04-23 08:56:38 EDT
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 09:04:26 EDT
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 09:09:12 EDT
$ rpm -q selinux-policy
Comment 6 Matěj Cepl 2012-04-23 09:16:04 EDT
wycliff:~ $ ssh luther rpm -q selinux-policy
selinux-policy-3.7.19-145.el6.noarch
wycliff:~ $
Comment 7 Miroslav Grepl 2012-04-24 06:49:52 EDT
[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 09:34:13 EDT
Thank you
Comment 15 errata-xmlrpc 2013-02-21 03:34:25 EST
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.