Bug 1035899 - SELinux is preventing /usr/sbin/php-fpm from 'connectto' accesses on the unix_stream_socket /var/lib/mysql/mysql.sock.
Summary: SELinux is preventing /usr/sbin/php-fpm from 'connectto' accesses on the unix...
Keywords:
Status: CLOSED NOTABUG
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:be2d5268d5bdc7b9104eb330b28...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-28 18:57 UTC by Mikhail
Modified: 2013-12-02 22:19 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-12-02 22:19:39 UTC
Type: ---


Attachments (Terms of Use)

Description Mikhail 2013-11-28 18:57:47 UTC
Description of problem:
SELinux is preventing /usr/sbin/php-fpm from 'connectto' accesses on the unix_stream_socket /var/lib/mysql/mysql.sock.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that php-fpm should be allowed connectto access on the mysql.sock unix_stream_socket 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                unconfined_u:system_r:unconfined_t:s0-s0:c0.c1023
Target Objects                /var/lib/mysql/mysql.sock [ unix_stream_socket ]
Source                        php-fpm
Source Path                   /usr/sbin/php-fpm
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           php-fpm-5.5.6-1.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-105.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.12.0-2.fc21.x86_64+debug #1 SMP
                              Sat Nov 9 21:12:03 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-11-29 00:56:45 YEKT
Last Seen                     2013-11-29 00:56:45 YEKT
Local ID                      27cd0583-7aa6-482f-a6f3-739d2913e182

Raw Audit Messages
type=AVC msg=audit(1385665005.649:563): avc:  denied  { connectto } for  pid=761 comm="php-fpm" path="/var/lib/mysql/mysql.sock" scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:system_r:unconfined_t:s0-s0:c0.c1023 tclass=unix_stream_socket


type=SYSCALL msg=audit(1385665005.649:563): arch=x86_64 syscall=connect success=yes exit=0 a0=7 a1=7fff153b98b0 a2=1b a3=4 items=0 ppid=672 pid=761 auid=4294967295 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 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,unconfined_t,unix_stream_socket,connectto

Additional info:
reporter:       libreport-2.1.9
hashmarkername: setroubleshoot
kernel:         3.12.0-2.fc21.x86_64+debug
type:           libreport

Comment 1 Daniel Walsh 2013-12-02 22:19:39 UTC
Looks like you were running mysql as unconfined_t rather then from the service script.

If you start mysql via sytemctl this will not happen.


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