Bug 1388805

Summary: SELinux is preventing httpd from 'getattr' accesses on the file /var/www/html/gcf/html5/ph5p2ed/L0308/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:d0c5696500b50514fc0df463f1a95107448f9c149753dd7187bed76fe7ed84c1;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-02 13:33:34 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:31:18 UTC
Description of problem:
Using firefox to display an html page on loclahostthat refered to a jpg file in the same directory
SELinux is preventing httpd from 'getattr' accesses on the file /var/www/html/gcf/html5/ph5p2ed/L0308/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 getattr 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                /var/www/html/gcf/html5/ph5p2ed/L0308/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                   45
First Seen                    2016-10-26 18:34:08 NZDT
Last Seen                     2016-10-26 20:56:04 NZDT
Local ID                      089cb97b-936b-421b-9aa9-b4dfdb3f8da6

Raw Audit Messages
type=AVC msg=audit(1477468564.821:4311): avc:  denied  { getattr } for  pid=31838 comm="httpd" path="/var/www/html/gcf/html5/ph5p2ed/L0308/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,getattr


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:33:34 UTC
Please run:
# restorecon -Rv /var/www/html/

To fix your issue.