Bug 1046864 - SELinux is preventing /usr/sbin/httpd from 'write' accesses on the directory /var/www/html/simple-php-photo-gallery/uploads.
Summary: SELinux is preventing /usr/sbin/httpd from 'write' accesses on the directory ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 20
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:bc7c5ffd082651a7a8ebe3f9796...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-27 07:19 UTC by Sayak Sarkar
Modified: 2014-01-16 07:11 UTC (History)
4 users (show)

Fixed In Version: selinux-policy-3.12.1-116.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-16 07:11:39 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Sayak Sarkar 2013-12-27 07:19:18 UTC
Description of problem:
SELinux is preventing /usr/sbin/httpd from 'write' accesses on the directory /var/www/html/simple-php-photo-gallery/uploads.

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

If you want to allow httpd to have write access on the uploads directory
Then you need to change the label on '/var/www/html/simple-php-photo-gallery/uploads'
Do
# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/simple-php-photo-gallery/uploads'
# restorecon -v '/var/www/html/simple-php-photo-gallery/uploads'

*****  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.
You can read 'httpd_selinux' man page for more details.
Do
setsebool -P httpd_unified 1

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

If you believe that httpd should be allowed write access on the uploads 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:httpd_sys_content_t:s0
Target Objects                /var/www/html/simple-php-photo-gallery/uploads [
                              dir ]
Source                        /usr/sbin/httpd
Source Path                   /usr/sbin/httpd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           httpd-2.4.6-2.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-74.4.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.11.1-200.fc19.x86_64 #1 SMP Sat
                              Sep 14 15:04:51 UTC 2013 x86_64 x86_64
Alert Count                   15
First Seen                    2013-10-01 05:51:00 IST
Last Seen                     2013-10-02 05:28:33 IST
Local ID                      1e2b1cf6-11fe-42ff-8a9c-34bf0e703b31

Raw Audit Messages
type=AVC msg=audit(1380671913.537:1484): avc:  denied  { write } for  pid=29411 comm="/usr/sbin/httpd" name="uploads" dev="dm-1" ino=2371584 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:httpd_sys_content_t:s0 tclass=dir


type=SYSCALL msg=audit(1380671913.537:1484): arch=x86_64 syscall=open success=no exit=EACCES a0=7f3bf71e68a0 a1=241 a2=1b6 a3=0 items=0 ppid=1993 pid=29411 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,httpd_sys_content_t,dir,write

Additional info:
reporter:       libreport-2.1.10
hashmarkername: setroubleshoot
kernel:         3.12.5-302.fc20.x86_64
type:           libreport

Comment 1 Daniel Walsh 2014-01-03 19:54:16 UTC
f456fe943e6b68cd39720807d10e9167f49125f5 fixes this in git.


You can fix it for now by executing.

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

If you want to allow httpd to have write access on the uploads directory
Then you need to change the label on '/var/www/html/simple-php-photo-gallery/uploads'
Do
# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/simple-php-photo-gallery/uploads(/.*)?'
# restorecon -v '/var/www/html/simple-php-photo-gallery/uploads'

Comment 2 Fedora Update System 2014-01-13 22:57:07 UTC
selinux-policy-3.12.1-116.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-116.fc20

Comment 3 Fedora Update System 2014-01-15 05:58:39 UTC
Package selinux-policy-3.12.1-116.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-116.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-0806/selinux-policy-3.12.1-116.fc20
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2014-01-16 07:11:39 UTC
selinux-policy-3.12.1-116.fc20 has been pushed to the Fedora 20 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.