Bug 964378

Summary: SELinux is preventing /usr/sbin/php-fpm from 'name_connect' accesses on the tcp_socket .
Product: [Fedora] Fedora Reporter: Mikhail <mikhail.v.gavrilov>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Unspecified   
Whiteboard: abrt_hash:c456e909424f89a947b19fd35cf53b99f48966f4bf6ccd09764c99b0cdcd9da8
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-18 10:24:50 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 Mikhail 2013-05-18 06:50:11 UTC
Description of problem:
SELinux is preventing /usr/sbin/php-fpm from 'name_connect' accesses on the tcp_socket .

*****  Plugin catchall_boolean (47.5 confidence) suggests  *******************

If you want to allow HTTPD scripts and modules to connect to the network using TCP.
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect' boolean.
You can read 'mysqld_selinux' man page for more details.
Do
setsebool -P httpd_can_network_connect 1

*****  Plugin catchall_boolean (47.5 confidence) suggests  *******************

If you want to allow HTTPD scripts and modules to connect to databases over the network.
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect_db' boolean.
You can read 'mysqld_selinux' man page for more details.
Do
setsebool -P httpd_can_network_connect_db 1

*****  Plugin catchall (6.38 confidence) suggests  ***************************

If you believe that php-fpm should be allowed name_connect access on the  tcp_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                system_u:object_r:mysqld_port_t:s0
Target Objects                 [ tcp_socket ]
Source                        php-fpm
Source Path                   /usr/sbin/php-fpm
Port                          3306
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                   5
First Seen                    2013-05-10 11:38:09 YEKT
Last Seen                     2013-05-17 12:20:28 YEKT
Local ID                      1f82f3b9-6409-4975-b695-7bd70f3d63b1

Raw Audit Messages
type=AVC msg=audit(1368771628.113:905): avc:  denied  { name_connect } for  pid=1154 comm="php-fpm" dest=3306 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:mysqld_port_t:s0 tclass=tcp_socket


type=SYSCALL msg=audit(1368771628.113:905): arch=i386 syscall=socketcall success=no exit=EACCES a0=3 a1=bfe93d30 a2=b776b618 a3=8 items=0 ppid=1024 pid=1154 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,mysqld_port_t,tcp_socket,name_connect

audit2allow

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

#!!!! This avc can be allowed using one of the these booleans:
#     httpd_can_network_connect, httpd_can_network_connect_db
allow httpd_t mysqld_port_t:tcp_socket name_connect;

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

Potential duplicate: bug 887774

Comment 1 Daniel Walsh 2013-05-18 10:24:50 UTC
The alert above tells you what to do.

*****  Plugin catchall_boolean (47.5 confidence) suggests  *******************

If you want to allow HTTPD scripts and modules to connect to the network using TCP.
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect' boolean.
You can read 'mysqld_selinux' man page for more details.
Do
setsebool -P httpd_can_network_connect 1