Bug 541958 - SELinux is preventing /usr/sbin/httpd from using potentially mislabeled files /var/cache.
Summary: SELinux is preventing /usr/sbin/httpd from using potentially mislabeled files...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 12
Hardware: i386
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:74a79f4b1c8...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-11-27 17:32 UTC by Daniel
Modified: 2010-08-20 01:47 UTC (History)
4 users (show)

Fixed In Version: selinux-policy-3.6.32-120.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-12-07 22:47:06 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Daniel 2009-11-27 17:32:21 UTC
Summary:

SELinux is preventing /usr/sbin/httpd from using potentially mislabeled files
/var/cache.

Detailed Description:

SELinux has denied the httpd access to potentially mislabeled files /var/cache.
This means that SELinux will not allow httpd to use these files. If httpd should
be allowed this access to these files you should change the file context to one
of the following types, var_lock_t, httpd_var_lib_t, httpd_var_run_t, tmp_t,
squirrelmail_spool_t, httpd_log_t, httpd_rw_content, tmpfs_t, httpd_cache_t,
httpd_tmpfs_t, var_lib_t, var_run_t, httpdcontent, httpd_tmp_t,
httpd_squirrelmail_t, var_log_t, httpd_apcupsd_cgi_content_ra_t,
httpd_apcupsd_cgi_content_rw_t, httpd_sys_content_t,
httpd_prewikka_content_ra_t, httpd_prewikka_content_rw_t,
httpd_awstats_content_ra_t, httpd_awstats_content_rw_t,
httpd_w3c_validator_content_ra_t, httpd_w3c_validator_content_rw_t,
httpd_user_content_ra_t, httpd_user_content_rw_t, httpdcontent,
httpd_munin_content_ra_t, httpd_munin_content_rw_t, root_t,
httpd_bugzilla_content_ra_t, httpd_bugzilla_content_rw_t,
httpd_nagios_content_ra_t, httpd_nagios_content_rw_t, httpd_sys_content_ra_t,
httpd_sys_content_rw_t, httpd_sys_content_rw_t, httpd_cvs_content_ra_t,
httpd_cvs_content_rw_t, httpd_git_content_ra_t, httpd_git_content_rw_t,
httpd_squid_content_ra_t, httpd_squid_content_rw_t. Many third party apps
install html files in directories that SELinux policy cannot predict. These
directories have to be labeled with a file context which httpd can access.

Allowing Access:

If you want to change the file context of /var/cache so that the httpd daemon
can access it, you need to execute it using semanage fcontext -a -t FILE_TYPE
'/var/cache'.
where FILE_TYPE is one of the following: var_lock_t, httpd_var_lib_t,
httpd_var_run_t, tmp_t, squirrelmail_spool_t, httpd_log_t, httpd_rw_content,
tmpfs_t, httpd_cache_t, httpd_tmpfs_t, var_lib_t, var_run_t, httpdcontent,
httpd_tmp_t, httpd_squirrelmail_t, var_log_t, httpd_apcupsd_cgi_content_ra_t,
httpd_apcupsd_cgi_content_rw_t, httpd_sys_content_t,
httpd_prewikka_content_ra_t, httpd_prewikka_content_rw_t,
httpd_awstats_content_ra_t, httpd_awstats_content_rw_t,
httpd_w3c_validator_content_ra_t, httpd_w3c_validator_content_rw_t,
httpd_user_content_ra_t, httpd_user_content_rw_t, httpdcontent,
httpd_munin_content_ra_t, httpd_munin_content_rw_t, root_t,
httpd_bugzilla_content_ra_t, httpd_bugzilla_content_rw_t,
httpd_nagios_content_ra_t, httpd_nagios_content_rw_t, httpd_sys_content_ra_t,
httpd_sys_content_rw_t, httpd_sys_content_rw_t, httpd_cvs_content_ra_t,
httpd_cvs_content_rw_t, httpd_git_content_ra_t, httpd_git_content_rw_t,
httpd_squid_content_ra_t, httpd_squid_content_rw_t. You can look at the
httpd_selinux man page for additional information.

Additional Information:

Source Context                unconfined_u:system_r:httpd_t:s0
Target Context                system_u:object_r:var_t:s0
Target Objects                /var/cache [ dir ]
Source                        httpd
Source Path                   /usr/sbin/httpd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           httpd-2.2.13-4.fc12
Target RPM Packages           filesystem-2.4.30-2.fc12
Policy RPM                    selinux-policy-3.6.32-46.fc12
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Plugin Name                   httpd_bad_labels
Host Name                     (removed)
Platform                      Linux (removed) 2.6.31.5-127.fc12.i686
                              #1 SMP Sat Nov 7 21:41:45 EST 2009 i686 i686
Alert Count                   1
First Seen                    Fri 27 Nov 2009 09:28:45 AM PST
Last Seen                     Fri 27 Nov 2009 09:28:45 AM PST
Local ID                      19944acb-89e4-47fb-8122-7e98b0b191f3
Line Numbers                  

Raw Audit Messages            

node=(removed) type=AVC msg=audit(1259342925.182:26722): avc:  denied  { write } for  pid=3348 comm="httpd" name="cache" dev=dm-0 ino=32770 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=dir

node=(removed) type=SYSCALL msg=audit(1259342925.182:26722): arch=40000003 syscall=5 success=no exit=-13 a0=16e37c0 a1=88042 a2=1a4 a3=27 items=0 ppid=3347 pid=3348 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)



Hash String generated from  selinux-policy-3.6.32-46.fc12,httpd_bad_labels,httpd,httpd_t,var_t,dir,write
audit2allow suggests:

#============= httpd_t ==============
allow httpd_t var_t:dir write;

Comment 1 Daniel Walsh 2009-11-30 22:38:35 UTC
Do you know what directory it is trying to create?  Did you remove a directory from /var/cache?

Comment 2 Daniel 2009-11-30 23:17:08 UTC
This was a fresh install of Fedora 12 32bit. If the directory was created it was either the fresh install or using the add/remove GUI interface. I went ahead and downloaded the apache source and did a configure and make installed. It is running with no problems.

Comment 3 Daniel Walsh 2009-12-01 15:02:18 UTC
You can add these rules for now using

# grep avc /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Fixed in selinux-policy-3.6.32-52.fc12.noarch

Comment 4 Fedora Update System 2009-12-01 16:53:23 UTC
selinux-policy-3.6.32-52.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/selinux-policy-3.6.32-52.fc12

Comment 5 Fedora Update System 2009-12-03 05:00:39 UTC
selinux-policy-3.6.32-52.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update selinux-policy'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-12549

Comment 6 Fedora Update System 2009-12-03 20:25:25 UTC
selinux-policy-3.6.32-55.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/selinux-policy-3.6.32-55.fc12

Comment 7 Fedora Update System 2009-12-04 23:43:31 UTC
selinux-policy-3.6.32-55.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update selinux-policy'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-12650

Comment 8 Fedora Update System 2009-12-08 07:50:09 UTC
selinux-policy-3.6.32-55.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2010-08-05 13:22:31 UTC
selinux-policy-3.6.32-120.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/selinux-policy-3.6.32-120.fc12

Comment 10 Fedora Update System 2010-08-20 01:42:28 UTC
selinux-policy-3.6.32-120.fc12 has been pushed to the Fedora 12 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.