Bug 964399 - SELinux is preventing /usr/sbin/php-fpm from 'write' accesses on the file /home/mikhail/www/crm5/file_storage/thumbs/174.jpg.
Summary: SELinux is preventing /usr/sbin/php-fpm from 'write' accesses on the file /ho...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 19
Hardware: i686
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:a3700a1be3a16bae0a2c20a929a...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-18 08:00 UTC by Mikhail
Modified: 2013-05-18 10:27 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-05-18 10:27:01 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mikhail 2013-05-18 08:00:19 UTC
Description of problem:
SELinux is preventing /usr/sbin/php-fpm from 'write' accesses on the file /home/mikhail/www/crm5/file_storage/thumbs/174.jpg.

*****  Plugin catchall_boolean (89.3 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 (11.6 confidence) suggests  ***************************

If you believe that php-fpm should be allowed write access on the 174.jpg file 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 php-fpm /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                system_u:object_r:httpd_user_ra_content_t:s0
Target Objects                /home/mikhail/www/crm5/file_storage/thumbs/174.jpg
                              [ file ]
Source                        php-fpm
Source Path                   /usr/sbin/php-fpm
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           php-fpm-5.5.0-0.6.RC1.fc19.i686
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-44.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.9.2-301.fc19.i686.PAE #1 SMP Mon
                              May 13 12:47:57 UTC 2013 i686 i686
Alert Count                   2
First Seen                    2013-05-18 13:56:27 YEKT
Last Seen                     2013-05-18 13:58:25 YEKT
Local ID                      1f9e7b6e-157b-498c-9388-d9b84f683552

Raw Audit Messages
type=AVC msg=audit(1368863905.796:536): avc:  denied  { write } for  pid=1093 comm="php-fpm" path="/home/mikhail/www/crm5/file_storage/thumbs/174.jpg" dev="sdb" ino=72876059 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_user_ra_content_t:s0 tclass=file


type=SYSCALL msg=audit(1368863905.796:536): arch=i386 syscall=open success=no exit=EACCES a0=bfb13f5c a1=8242 a2=1b6 a3=b7a691c8 items=0 ppid=1016 pid=1093 auid=4294967295 uid=991 gid=989 euid=991 suid=991 fsuid=991 egid=989 sgid=989 fsgid=989 ses=4294967295 tty=(none) comm=php-fpm exe=/usr/sbin/php-fpm subj=system_u:system_r:httpd_t:s0 key=(null)

Hash: php-fpm,httpd_t,httpd_user_ra_content_t,file,write

audit2allow

#============= httpd_t ==============

#!!!! This avc can be allowed using the boolean 'httpd_unified'
allow httpd_t httpd_user_ra_content_t:file write;

audit2allow -RYou must regenerate interface info by running /usr/bin/sepolgen-ifgen


Additional info:
reporter:       libreport-2.1.4
hashmarkername: setroubleshoot
kernel:         3.9.2-301.fc19.i686.PAE
type:           libreport

Comment 1 Daniel Walsh 2013-05-18 10:27:01 UTC
If you want to allow apache to write to content in your homedir you would need to label it httpd_user_rw_content_t not httpd_user_ra_content_t


Note You need to log in before you can comment on or make changes to this bug.