Bug 966313

Summary: SELinux is preventing /usr/sbin/httpd from 'getattr' accesses on the directory /var/www/html/bugzilla.
Product: [Fedora] Fedora Reporter: Moez Roy <moez.roy>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:0e4fbeb7a2cc6fbe74c010c0620454607a9620e4307be72b6f7ae07dc86c2a09
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-23 08:16:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Moez Roy 2013-05-23 03:29:07 UTC
Description of problem:
SELinux is preventing /usr/sbin/httpd from 'getattr' accesses on the directory /var/www/html/bugzilla.

*****  Plugin restorecon (85.9 confidence) suggests  *************************

If you want to fix the label. 
/var/www/html/bugzilla default label should be httpd_sys_content_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /var/www/html/bugzilla

*****  Plugin catchall_boolean (7.33 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 'user_selinux' man page for more details.
Do
setsebool -P httpd_read_user_content 1

*****  Plugin catchall_boolean (7.33 confidence) suggests  *******************

If you want to allow httpd to read home directories
Then you must tell SELinux about this by enabling the 'httpd_enable_homedirs' boolean.
You can read 'user_selinux' man page for more details.
Do
setsebool -P httpd_enable_homedirs 1

*****  Plugin catchall (1.35 confidence) suggests  ***************************

If you believe that httpd should be allowed getattr access on the bugzilla directory 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:
# grep /usr/sbin/httpd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:httpd_t:s0
Target Context                unconfined_u:object_r:user_home_t:s0
Target Objects                /var/www/html/bugzilla [ dir ]
Source                        /usr/sbin/httpd
Source Path                   /usr/sbin/httpd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           httpd-2.4.4-3.fc18.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-96.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.9.2-200.fc18.x86_64 #1 SMP Mon
                              May 13 13:59:47 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-05-22 20:27:57 PDT
Last Seen                     2013-05-22 20:27:57 PDT
Local ID                      e9344c77-4c48-42a2-bafd-cbdb7aac7a82

Raw Audit Messages
type=AVC msg=audit(1369279677.276:390): avc:  denied  { getattr } for  pid=2390 comm="/usr/sbin/httpd" path="/var/www/html/bugzilla" dev="sda2" ino=1318935 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=dir


type=SYSCALL msg=audit(1369279677.276:390): arch=x86_64 syscall=lstat success=no exit=EACCES a0=7ff5822572f0 a1=7fff8a20a8c0 a2=7fff8a20a8c0 a3=0 items=0 ppid=2389 pid=2390 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 ses=4294967295 tty=(none) comm=/usr/sbin/httpd exe=/usr/sbin/httpd subj=system_u:system_r:httpd_t:s0 key=(null)

Hash: /usr/sbin/httpd,httpd_t,user_home_t,dir,getattr

audit2allow

#============= httpd_t ==============
#!!!! This avc can be allowed using one of the these booleans:
#     httpd_read_user_content, httpd_enable_homedirs

allow httpd_t user_home_t:dir getattr;

audit2allow -R
require {
	type httpd_t;
}

#============= httpd_t ==============
userdom_mmap_user_home_content_files(httpd_t)


Additional info:
hashmarkername: setroubleshoot
kernel:         3.9.2-200.fc18.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-05-23 08:16:17 UTC
# matchpathcon /var/www/html/bugzilla
/var/www/html/bugzill	system_u:object_r:httpd_sys_content_t:s0

tell us that this dir should be labeled as httpd_sys_content_t. So you need to fix labeling using

# restorecon -R -v /var/www/html/bugzilla

Comment 2 Miroslav Grepl 2013-05-23 08:16:33 UTC
*** Bug 966315 has been marked as a duplicate of this bug. ***

Comment 3 Miroslav Grepl 2013-05-23 08:16:45 UTC
*** Bug 966317 has been marked as a duplicate of this bug. ***