Bug 1572369 - SELinux is preventing httpd from 'map' accesses on public_content_t
Summary: SELinux is preventing httpd from 'map' accesses on public_content_t
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 27
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 1481454
TreeView+ depends on / blocked
Reported: 2018-04-26 20:20 UTC by Jason Tibbitts
Modified: 2018-07-06 15:43 UTC (History)
6 users (show)

Fixed In Version: selinux-policy-3.13.1-283.35.fc27
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-07-06 15:43:59 UTC
Type: Bug

Attachments (Terms of Use)

Description Jason Tibbitts 2018-04-26 20:20:01 UTC
I happened to take a look at the audit logs for my two public Fedora mirrors today and found hundreds of thousands of of the following denials:

type=AVC msg=audit(1524757500.315:63341066): avc:  denied  { map } for  pid=29361 comm="httpd" path="/srv/mirror/pub/fedora-buffet/epel/7/x86_64/Packages/o/openmx-data-3.8.1-9.el7.noarch.rpm" dev="bcache0" ino=32664828575 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:public_content_t:s0 tclass=file permissive=0

I can't tell when this started because the audit log fills completely in a few hours as it happens for every URL accessed.  I figure someone would have reported it by now if it was a common occurrence but my bugzilla searching failed to turn anything up.  All I see in the policy with sesearch -A -s httpd_t -t public_content_t is:

allow httpd_t file_type:dir { getattr open search };
allow httpd_t file_type:filesystem getattr;
allow httpd_t public_content_t:dir { getattr ioctl lock open read search };
allow httpd_t public_content_t:file { getattr ioctl lock open read };
allow httpd_t public_content_t:lnk_file { getattr read };

so maybe this is another instance where the map privilege needs to be added?  I see that, assuming I can use sesearch correctly, map is allowed for httpd_sys_content_t and user_home_t (with the appropriate boolean set).  I'm not sure why public_content_t would be different.

I am currently running selinux-policy-3.13.1-283.32.fc27.noarch from updates-testing.

Comment 1 Jason Tibbitts 2018-04-26 20:26:34 UTC
I should add that doing the following quiets things down, in case someone else runs into this:

echo "(allow httpd_t public_content_t (file (map)))" > /tmp/httpd-quiet.cil
semodule -i /tmp/httpd-quiet.cil

Comment 2 Todd Zullinger 2018-04-26 22:05:22 UTC
I'm not entirely sure if a more limited map interface for public_content_t is needed or if adding this to the existing miscfiles_read_public_files interface is reasonable.

diff --git i/policy/modules/system/miscfiles.if w/policy/modules/system/miscfiles.if
index 73fc71dbc..71638a80d 100644
--- i/policy/modules/system/miscfiles.if
+++ w/policy/modules/system/miscfiles.if
@@ -771,6 +771,7 @@ interface(`miscfiles_read_public_files',`
 	allow $1 { public_content_t public_content_rw_t }:dir list_dir_perms;
+	allow $1 { public_content_t public_content_rw_t }:file map;
 	read_files_pattern($1, { public_content_t public_content_rw_t }, { public_content_t public_content_rw_t })
 	read_lnk_files_pattern($1, { public_content_t public_content_rw_t }, { public_content_t public_content_rw_t })

This diff is against the rawhide branch of the https://github.com/fedora-selinux/selinux-policy repo.  I filed it as https://github.com/fedora-selinux/selinux-policy/pull/213 in the hope that it helps speed up a fix.

Comment 3 Jason Tibbitts 2018-04-30 17:41:33 UTC
I'm not sure if the changes in the 3.13.1-283.34 package were supposed to help with this, but I did test that package and found that the denials are still present.

Comment 4 Fedora Update System 2018-05-28 07:42:06 UTC
selinux-policy-3.13.1-283.35.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-2a57dc63c1

Comment 5 Fedora Update System 2018-05-28 14:24:50 UTC
selinux-policy-3.13.1-283.35.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-2018-2a57dc63c1

Comment 6 Fedora Update System 2018-07-06 15:43:59 UTC
selinux-policy-3.13.1-283.35.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

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