Bug 666142

Summary: SELinux is preventing /usr/sbin/httpd from 'write' accesses on the directory /var/www/mod_pagespeed/cache.
Product: [Fedora] Fedora Reporter: Paul Campbell <pcsnow>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: dwalsh, maithanhan, mgrepl, pcsnow, Todsimar
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:7d83f26cce0b3eee53a7fa2e75a29dc206f3d9438dc4a4fcd1290b067c69b94f
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-26 20:38: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 Paul Campbell 2010-12-29 06:56:53 UTC
SELinux is preventing /usr/sbin/httpd from 'write' accesses on the directory /var/www/mod_pagespeed/cache.

*****  Plugin httpd_write_content (92.2 confidence) suggests  ****************

If you want to allow httpd to have write access on the cache directory
Then you need to change the label on '/var/www/mod_pagespeed/cache'
Do
# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/mod_pagespeed/cache'
# restorecon -v '/var/www/mod_pagespeed/cache'

*****  Plugin catchall_boolean (7.83 confidence) suggests  *******************

If you want to unify HTTPD handling of all content files.
Then you must tell SELinux about this by enabling the 'httpd_unified' boolean.
Do
setsebool -P httpd_unified 1

*****  Plugin catchall (1.41 confidence) suggests  ***************************

If you believe that httpd should be allowed write access on the cache 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                unconfined_u:system_r:httpd_t:s0
Target Context                system_u:object_r:httpd_sys_content_t:s0
Target Objects                /var/www/mod_pagespeed/cache [ dir ]
Source                        httpd
Source Path                   /usr/sbin/httpd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           httpd-2.2.17-1.fc14
Target RPM Packages           mod-pagespeed-beta-0.9.8.1-215
Policy RPM                    selinux-policy-3.9.7-18.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.35.10-74.fc14.i686 #1 SMP Thu Dec
                              23 16:17:40 UTC 2010 i686 i686
Alert Count                   39
First Seen                    Tue 28 Dec 2010 10:50:22 PM PST
Last Seen                     Tue 28 Dec 2010 10:50:25 PM PST
Local ID                      49e4329e-1ad9-4ba6-92e4-19ca0f3262aa

Raw Audit Messages
type=AVC msg=audit(1293605425.691:18135): avc:  denied  { write } for  pid=14233 comm="httpd" name="cache" dev=dm-0 ino=136159 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=dir

httpd,httpd_t,httpd_sys_content_t,dir,write
type=SYSCALL msg=audit(1293605425.691:18135): arch=i386 syscall=mkdir success=no exit=EACCES a0=b5d91c54 a1=1ff a2=ecb1e4 a3=b5d91c54 items=0 ppid=14086 pid=14233 auid=500 uid=48 gid=488 euid=48 suid=48 fsuid=48 egid=488 sgid=488 fsgid=488 tty=(none) ses=14 comm=httpd exe=/usr/sbin/httpd subj=unconfined_u:system_r:httpd_t:s0 key=(null)
httpd,httpd_t,httpd_sys_content_t,dir,write

#============= httpd_t ==============
#!!!! This avc can be allowed using the boolean 'httpd_unified'

allow httpd_t httpd_sys_content_t:dir write;

Comment 1 Miroslav Grepl 2011-01-03 11:54:53 UTC
If you execute 

# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/mod_pagespeed/cache(/.*)?'

# restorecon -R -v '/var/www/mod_pagespeed/cache'


Does mod_pagespeed work then?

Comment 2 Paul Campbell 2011-03-09 02:05:54 UTC
NO it does not work

1. Removed mod-pagespeed
2. Ran commands in your comment of 2011-01-03
3. Installed mod-pagespeed
4. Started httpd
5. Got the errors again.
6. I am erasing mod-pagespeed AGAIN
Thanks


[root@dell pwc]# yum erase mod-pagespeed
Loaded plugins: auto-update-debuginfo, presto, refresh-packagekit, remove-with-
              : leaves
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package mod-pagespeed-beta.i386 0:0.9.15.3-404 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch      Version            Repository           Size
================================================================================
Removing:
 mod-pagespeed-beta      i386      0.9.15.3-404       @mod-pagespeed      1.7 M

Transaction Summary
================================================================================
Remove        1 Package(s)

Installed size: 1.7 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : mod-pagespeed-beta-0.9.15.3-404.i386                     1/1 
warning: /etc/httpd/conf.d/pagespeed.conf saved as /etc/httpd/conf.d/pagespeed.conf.rpmsave

Removed:
  mod-pagespeed-beta.i386 0:0.9.15.3-404                                        

Complete!
[root@dell pwc]# semanage fcontext -a -t httpd_sys_rw_content_t

/usr/sbin/semanage: bad option
[root@dell pwc]# '/var/www/mod_pagespeed/cache(/.*)?'
bash: /var/www/mod_pagespeed/cache(/.*)?: No such file or directory
[root@dell pwc]# 
[root@dell pwc]# semanage fcontext -a -t httpd_sys_rw_content_t
/usr/sbin/semanage: bad option
[root@dell pwc]# '/var/www/mod_pagespeed/cache(/.*)?'
bash: /var/www/mod_pagespeed/cache(/.*)?: No such file or directory
[root@dell pwc]# yum install  mod-pagespeed
Loaded plugins: auto-update-debuginfo, presto, refresh-packagekit, remove-with-
              : leaves
Found 57 installed debuginfo package(s)
Enabling fedora-debuginfo: Fedora 14 - i386 - Debug
Enabling rpmfusion-free-updates-debuginfo: RPM Fusion for Fedora 14 - Free - Updates Debug
Enabling rpmfusion-free-debuginfo: RPM Fusion for Fedora 14 - Free - Debug
Enabling updates-debuginfo: Fedora 14 - i386 - Updates - Debug
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mod-pagespeed-beta.i386 0:0.9.15.3-404 set to be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch      Version             Repository          Size
================================================================================
Installing:
 mod-pagespeed-beta      i386      0.9.15.3-404        mod-pagespeed      732 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 732 k
Installed size: 1.7 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 732 k
mod-pagespeed-beta-0.9.15.3-404.i386.rpm                 | 732 kB     00:05     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : mod-pagespeed-beta-0.9.15.3-404.i386                     1/1 
job 28 at Tue Mar  8 18:02:00 2011

Installed:
  mod-pagespeed-beta.i386 0:0.9.15.3-404                                        

Complete!
[root@dell pwc]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/mod_pagespeed/cache(/.*)?'
[root@dell pwc]# restorecon -R -v '/var/www/mod_pagespeed/cache'
[root@dell pwc]# /etc/init.d/httpd stop
Stopping httpd:                                            [FAILED]
[root@dell pwc]# /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]
[root@dell pwc]# cd /var/log
[root@dell log]# tail logs
tail: cannot open `logs' for reading: No such file or directory
[root@dell log]# tail messages
Mar  8 18:02:49 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:02:49 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:02:49 dell setroubleshoot: SELinux is preventing /usr/lib/firefox-3.6/firefox from using the execstack access on a process. For complete SELinux messages. run sealert -l 8aac3fbe-30a2-48fb-ae9f-3eeb7255c6d8
Mar  8 18:02:49 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:02:49 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:02:49 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:02:49 dell setroubleshoot: SELinux is preventing /usr/lib/firefox-3.6/firefox from using the execstack access on a process. For complete SELinux messages. run sealert -l 8aac3fbe-30a2-48fb-ae9f-3eeb7255c6d8
Mar  8 18:02:49 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:02:49 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:02:49 dell setroubleshoot: SELinux is preventing /usr/lib/firefox-3.6/firefox from using the execstack access on a process. For complete SELinux messages. run sealert -l 8aac3fbe-30a2-48fb-ae9f-3eeb7255c6d8
[root@dell log]# tail messages
Mar  8 18:03:02 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:03:02 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:03:02 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:03:02 dell setroubleshoot: SELinux is preventing /usr/lib/firefox-3.6/firefox from using the execstack access on a process. For complete SELinux messages. run sealert -l 8aac3fbe-30a2-48fb-ae9f-3eeb7255c6d8
Mar  8 18:03:03 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:03:03 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:03:03 dell setroubleshoot: SELinux is preventing /usr/lib/firefox-3.6/firefox from using the execstack access on a process. For complete SELinux messages. run sealert -l 8aac3fbe-30a2-48fb-ae9f-3eeb7255c6d8
Mar  8 18:03:03 dell sedispatch: AVC Message for setroubleshoot, dropping message
Mar  8 18:03:03 dell setroubleshoot: SELinux is preventing /usr/lib/firefox-3.6/firefox from using the execstack access on a process. For complete SELinux messages. run sealert -l 8aac3fbe-30a2-48fb-ae9f-3eeb7255c6d8
Mar  8 18:03:03 dell sedispatch: AVC Message for setroubleshoot, dropping message

Comment 3 Daniel Walsh 2011-03-09 22:23:09 UTC
Those messages look like you need to turn on allow_execstack in order to allow firefox to probably run oracle java?