Bug 1514866

Summary: selinux prevents php-fpm from mapping php files
Product: [Fedora] Fedora Reporter: Scott Shambarger <scott-fedora>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: david, dwalsh, lvrabec, mgrepl, plautrba, pmoore
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-283.17.fc27 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-28 23:54:10 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:

Description Scott Shambarger 2017-11-19 01:35:31 UTC
Description of problem:
type=AVC msg=audit(1511054730.690:881): avc:  denied  { map } for  pid=3309 comm="php-fpm" path="/etc/owncloud/config.php" dev="dm-0" ino=2098033 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_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(1511054747.037:886): avc:  denied  { map } for  pid=4865 comm="php-fpm" path="/usr/share/wordpress/index.php" dev="dm-0" ino=8129643 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_script_exec_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.

Both httpd_sys_rw_content_t and httpd_sys_script_exec_t are used as labels for files php-fpm is trying to map (from standard package files).

The following silenced the denials:

allow httpd_t httpd_sys_rw_content_t:file map;
allow httpd_t httpd_sys_script_exec_t:file map;

Version-Release number of selected component (if applicable):

selinux-policy-3.13.1-283.14.fc27.noarch
php-fpm-7.1.11-1.fc27.x86_64

Comment 1 Scott Shambarger 2017-11-19 02:16:19 UTC
I'm also getting similar errors for mediawiki:

type=AVC msg=audit(1511057097.645:521): avc:  denied  { map } for  pid=1419 comm="php-fpm" path="/usr/share/mediawiki/includes/json/FormatJson.php" dev="dm-0" ino=796729 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:mediawiki_content_t:s0 tclass=file permissive=0

and

type=AVC msg=audit(1511057096.275:411): avc:  denied  { map } for  pid=1419 comm="php-fpm" path="/var/www/wiki/LocalSettings.php" dev="dm-5" ino=280771614 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:mediawiki_rw_content_t:s0 tclass=file permissive=0

Adding the following silenced the denials:

allow httpd_t mediawiki_content_t:file map;
allow httpd_t mediawiki_rw_content_t:file map;

Comment 2 Fedora Update System 2017-11-22 08:55:55 UTC
selinux-policy-3.13.1-283.17.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d05b1a2ab9

Comment 3 Fedora Update System 2017-11-22 21:41:44 UTC
selinux-policy-3.13.1-283.17.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-d05b1a2ab9

Comment 4 Scott Shambarger 2017-11-23 00:43:08 UTC
Works in latest release, adding karma!

Comment 5 Fedora Update System 2017-11-28 23:54:10 UTC
selinux-policy-3.13.1-283.17.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.