Bug 472699

Summary: AVC denail with httpd_unified
Product: [Fedora] Fedora Reporter: Christopher Stone <chris.stone>
Component: selinux-policyAssignee: Daniel Walsh <dwalsh>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 10CC: djuran, dwalsh, jkubin, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-11-18 12:59:59 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 Christopher Stone 2008-11-23 20:17:58 UTC
Summary:

SELinux prevented httpd reading and writing access to http files.

Detailed Description:

SELinux prevented httpd reading and writing access to http files. Ordinarily
httpd is allowed full access to all files labeled with http file context. This
machine has a tightened security policy with the httpd_unified turned off, this
requires explicit labeling of all files. If a file is a cgi script it needs to
be labeled with httpd_TYPE_script_exec_t in order to be executed. If it is
read-only content, it needs to be labeled httpd_TYPE_content_t, it is writable
content. it needs to be labeled httpd_TYPE_script_rw_t or
httpd_TYPE_script_ra_t. You can use the chcon command to change these contexts.
Please refer to the man page "man httpd_selinux" or FAQ
(http://fedora.redhat.com/docs/selinux-apache-fc3) "TYPE" refers to one of
"sys", "user" or "staff" or potentially other script types.

Allowing Access:

Changing the "httpd_unified" boolean to true will allow this access: "setsebool
-P httpd_unified=1"

Fix Command:

setsebool -P httpd_unified=1

Additional Information:

Source Context                system_u:system_r:httpd_t:s0
Target Context                system_u:object_r:httpd_sys_content_t:s0
Target Objects                ./WFR_85.56.png [ file ]
Source                        httpd
Source Path                   /usr/sbin/httpd
Port                          <Unknown>
Host                          localhost.localdomain
Source RPM Packages           httpd-2.2.10-2
Target RPM Packages           
Policy RPM                    selinux-policy-3.5.13-18.fc10
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   httpd_unified
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain
                              2.6.27.5-117.fc10.x86_64 #1 SMP Tue Nov 18
                              11:58:53 EST 2008 x86_64 x86_64
Alert Count                   1
First Seen                    Sun 23 Nov 2008 12:13:28 PM PST
Last Seen                     Sun 23 Nov 2008 12:13:28 PM PST
Local ID                      5ed3af45-597a-4734-a436-309859bdb22d
Line Numbers                  

Raw Audit Messages            

node=localhost.localdomain type=AVC msg=audit(1227471208.388:47): avc:  denied  { create } for  pid=2690 comm="httpd" name="WFR_85.56.png" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=file

node=localhost.localdomain type=SYSCALL msg=audit(1227471208.388:47): arch=c000003e syscall=2 success=no exit=-13 a0=7ffc9500c1e0 a1=241 a2=1b6 a3=7ffc928dc7d0 items=0 ppid=2515 pid=2690 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="httpd" exe="/usr/sbin/httpd" subj=system_u:system_r:httpd_t:s0 key=(null)

# # apache is attempting to write a new file to /var/www/html/images
# ll -aZ images/
drwxrwxr-x  root apache system_u:object_r:httpd_sys_content_t:s0 .
drwxrwxr-x  root apache system_u:object_r:httpd_sys_content_t:s0 ..
-rw-rw-r--  root apache unconfined_u:object_r:httpd_sys_content_t:s0 background.jpg

I have already set "setsebool -P httpd_unified=1" and I still get this error.

Comment 1 Daniel Walsh 2008-11-24 14:32:16 UTC
Fixed in selinux-policy-3.5.13-21.fc10.noarch

Comment 2 Bug Zapper 2008-11-26 05:49:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 David Juran 2009-02-05 12:51:32 UTC
I just got the following avc denial although I do have httpd_unified on. This with selinux-policy-targeted-3.5.13-41.fc10.noarch

 The web application I'm accessing is gallery2.

Summary:

SELinux prevented httpd reading and writing access to http files.

Detailed Description:

SELinux prevented httpd reading and writing access to http files. Ordinarily
httpd is allowed full access to all files labeled with http file context. This
machine has a tightened security policy with the httpd_unified turned off, this
requires explicit labeling of all files. If a file is a cgi script it needs to
be labeled with httpd_TYPE_script_exec_t in order to be executed. If it is
read-only content, it needs to be labeled httpd_TYPE_content_t, it is writable
content. it needs to be labeled httpd_TYPE_script_rw_t or
httpd_TYPE_script_ra_t. You can use the chcon command to change these contexts.
Please refer to the man page "man httpd_selinux" or FAQ
(http://fedora.redhat.com/docs/selinux-apache-fc3) "TYPE" refers to one of
"sys", "user" or "staff" or potentially other script types.

Allowing Access:

Changing the "httpd_unified" boolean to true will allow this access: "setsebool
-P httpd_unified=1"

Fix Command:

setsebool -P httpd_unified=1

Additional Information:

Source Context                system_u:system_r:httpd_t
Target Context                system_u:object_r:httpd_sys_content_t
Target Objects                ./6 [ dir ]
Source                        httpd
Source Path                   /usr/sbin/httpd
Port                          <Unknown>
Host                          mail.juran.se
Source RPM Packages           httpd-2.2.10-2
Target RPM Packages           
Policy RPM                    selinux-policy-3.5.13-41.fc10
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   httpd_unified
Host Name                     mail.juran.se
Platform                      Linux mail.juran.se 2.6.27.12-170.2.5.fc10.i686 #1
                              SMP Wed Jan 21 02:09:37 EST 2009 i686 i686
Alert Count                   20
First Seen                    Fri Jan 30 14:36:51 2009
Last Seen                     Thu Feb  5 14:14:30 2009
Local ID                      4dc2e026-1f8d-4c8a-b34b-8a95cfd789c0
Line Numbers                  

Raw Audit Messages            

node=mail.juran.se type=AVC msg=audit(1233836070.145:21835): avc:  denied  { create } for  pid=12963 comm="httpd" name="6" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=dir

node=mail.juran.se type=SYSCALL msg=audit(1233836070.145:21835): arch=40000003 syscall=39 success=no exit=-13 a0=27b7c24 a1=1ed a2=5194938 a3=27b7c24 items=0 ppid=2097 pid=12963 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="httpd" exe="/usr/sbin/httpd" subj=system_u:system_r:httpd_t:s0 key=(null)

Comment 4 Daniel Walsh 2009-02-06 16:44:24 UTC
Do you have httpd_enable_cgi turned on?

Comment 5 David Juran 2009-02-09 12:18:56 UTC
Sorry, I should have mentioned it's a PHP script that was running. And after labelling the relevant directory with httpd_sys_content_rw_t (see bug 481443) the problem went away.

Comment 6 Bug Zapper 2009-11-18 08:56:41 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 7 Daniel Walsh 2009-11-18 12:59:59 UTC
Closing as current release