Bug 1388811

Summary: SELinux is preventing httpd from 'read' accesses on the file gravel.jpg.
Product: [Fedora] Fedora Reporter: Nivag <gavinflower>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: dominick.grift, dwalsh, lvrabec, mgrepl, plautrba, pmoore
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:8620d8f1e783a42af79fb95a30381040c9bc4c3d64cead89edd4cdbc4a750a29;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-02 13:34:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Nivag 2016-10-26 08:36:28 UTC
Description of problem:
Using firefox to display an html page on loclahostthat refered to a jpg file in
the same directory
(this should find that I've reported it as https://bugzilla.redhat.com/show_bug.cgi?id=1388805
SELinux is preventing httpd from 'read' accesses on the file gravel.jpg.

*****  Plugin catchall_boolean (89.3 confidence) suggests   ******************

If you want to allow httpd to read user content
Then you must tell SELinux about this by enabling the 'httpd_read_user_content' boolean.
You can read 'None' man page for more details.
Do
setsebool -P httpd_read_user_content 1

*****  Plugin catchall (11.6 confidence) suggests   **************************

If you believe that httpd should be allowed read access on the gravel.jpg file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'httpd' --raw | audit2allow -M my-httpd
# semodule -X 300 -i my-httpd.pp

Additional Information:
Source Context                system_u:system_r:httpd_t:s0
Target Context                unconfined_u:object_r:home_bin_t:s0
Target Objects                gravel.jpg [ file ]
Source                        httpd
Source Path                   httpd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    <Unknown>
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.7.9-200.fc24.x86_64 #1 SMP Thu
                              Oct 20 14:26:16 UTC 2016 x86_64 x86_64
Alert Count                   1
First Seen                    2016-10-26 21:32:08 NZDT
Last Seen                     2016-10-26 21:32:08 NZDT
Local ID                      e80da5f0-0d75-4455-98a4-88392ce365dd

Raw Audit Messages
type=AVC msg=audit(1477470728.884:4348): avc:  denied  { read } for  pid=31839 comm="httpd" name="gravel.jpg" dev="dm-0" ino=527480 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:home_bin_t:s0 tclass=file permissive=0


Hash: httpd,httpd_t,home_bin_t,file,read


Additional info:
reporter:       libreport-2.7.2
hashmarkername: setroubleshoot
kernel:         4.7.9-200.fc24.x86_64
type:           libreport

Comment 1 Lukas Vrabec 2016-11-02 13:34:05 UTC
Please run:
# restorecon -Rv /var/www/html/

To fix your issue.