Bug 860746

Summary: SELinux is preventing /usr/sbin/php-fpm from 'write' accesses on the sock_file /var/lib/mysql/mysql.sock.
Product: [Fedora] Fedora Reporter: Jonathan VK <od0nto>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:12c2add575c0ff9ac5aae142f78d048cd01f413a6580f071036c5202a6cd2509
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-05 08:37:55 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:
Attachments:
Description Flags
File: type
none
File: hashmarkername none

Description Jonathan VK 2012-09-26 15:41:26 UTC
Additional info:
libreport version: 2.0.13
kernel:         3.6.0-0.rc6.git0.2.fc18.x86_64

description:
:SELinux is preventing /usr/sbin/php-fpm from 'write' accesses on the sock_file /var/lib/mysql/mysql.sock.
:
:*****  Plugin catchall (100. confidence) suggests  ***************************
:
:If you believe that php-fpm should be allowed write access on the mysql.sock sock_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:phpfpm_t:s0
:Target Context                system_u:object_r:mysqld_var_run_t:s0
:Target Objects                /var/lib/mysql/mysql.sock [ sock_file ]
:Source                        php-fpm
:Source Path                   /usr/sbin/php-fpm
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           php-fpm-5.4.7-5.fc18.x86_64
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.11.1-21.fc18.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Permissive
:Host Name                     (removed)
:Platform                      Linux (removed) 3.6.0-0.rc6.git0.2.fc18.x86_64 #1
:                              SMP Mon Sep 17 17:29:08 UTC 2012 x86_64 x86_64
:Alert Count                   1
:First Seen                    2012-09-26 11:30:02 EDT
:Last Seen                     2012-09-26 11:30:02 EDT
:Local ID                      73571307-d649-4feb-8b31-b1b52ebac118
:
:Raw Audit Messages
:type=AVC msg=audit(1348673402.335:1074): avc:  denied  { write } for  pid=22995 comm="php-fpm" name="mysql.sock" dev="sdb3" ino=1840001 scontext=system_u:system_r:phpfpm_t:s0 tcontext=system_u:object_r:mysqld_var_run_t:s0 tclass=sock_file
:
:
:type=AVC msg=audit(1348673402.335:1074): avc:  denied  { connectto } for  pid=22995 comm="php-fpm" path="/var/lib/mysql/mysql.sock" scontext=system_u:system_r:phpfpm_t:s0 tcontext=system_u:system_r:mysqld_t:s0 tclass=unix_stream_socket
:
:
:type=SYSCALL msg=audit(1348673402.335:1074): arch=x86_64 syscall=connect success=yes exit=0 a0=4 a1=7fff72793490 a2=6e a3=4000 items=0 ppid=22990 pid=22995 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm=php-fpm exe=/usr/sbin/php-fpm subj=system_u:system_r:phpfpm_t:s0 key=(null)
:
:Hash: php-fpm,phpfpm_t,mysqld_var_run_t,sock_file,write
:
:audit2allow
:
:#============= phpfpm_t ==============
:allow phpfpm_t mysqld_t:unix_stream_socket connectto;
:allow phpfpm_t mysqld_var_run_t:sock_file write;
:
:audit2allow -R
:
:#============= phpfpm_t ==============
:allow phpfpm_t mysqld_t:unix_stream_socket connectto;
:allow phpfpm_t mysqld_var_run_t:sock_file write;
:

Comment 1 Jonathan VK 2012-09-26 15:41:32 UTC
Created attachment 617614 [details]
File: type

Comment 2 Jonathan VK 2012-09-26 15:41:34 UTC
Created attachment 617615 [details]
File: hashmarkername

Comment 3 Miroslav Grepl 2012-09-26 18:02:53 UTC
*** Bug 860724 has been marked as a duplicate of this bug. ***

Comment 4 Jonathan VK 2012-09-26 18:40:07 UTC
Bug 860724 happens when php-fpm tries to connect to a MySQL server through a tcp socket "mysql_connect('X.X.X.X:3306')", whereas this bug affects php-fpm when connecting to a unix socket. "mysql_connect(':/var/lib/mysql/mysql.sock')".

There are a few more of these policy issues with php-fpm that I'm running into as I set my development environment up. Would it be preferable if I compile them into a single bug report, and what should I include, or should I continue using the SELinux alert tool to submit them individually?

Comment 5 Daniel Walsh 2012-09-26 20:21:54 UTC
No bundle them together into this report is fine.

Comment 6 Miroslav Grepl 2012-11-05 08:37:55 UTC

*** This bug has been marked as a duplicate of bug 861975 ***