Bug 1387284 - SELinux is preventing php-fpm from 'name_connect' accesses on the tcp_socket port 3306.
Summary: SELinux is preventing php-fpm from 'name_connect' accesses on the tcp_socket ...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 25
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:c456e909424f89a947b19fd35cf...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-20 14:25 UTC by Mikhail
Modified: 2016-11-07 21:32 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-07 21:32:47 UTC
Type: ---


Attachments (Terms of Use)

Description Mikhail 2016-10-20 14:25:45 UTC
Description of problem:
SELinux is preventing php-fpm from 'name_connect' accesses on the tcp_socket port 3306.

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

If you want to allow httpd to can network connect
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect' boolean.
You can read 'None' 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 to can network connect db
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect_db' boolean.
You can read 'None' 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 port 3306 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:
# ausearch -c 'php-fpm' --raw | audit2allow -M my-phpfpm
# semodule -X 300 -i my-phpfpm.pp

Additional Information:
Source Context                system_u:system_r:httpd_t:s0
Target Context                system_u:object_r:mysqld_port_t:s0
Target Objects                port 3306 [ tcp_socket ]
Source                        php-fpm
Source Path                   php-fpm
Port                          3306
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-219.fc25.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.8.1-1.fc25.x86_64+debug #1 SMP
                              Fri Oct 7 14:16:39 UTC 2016 x86_64 x86_64
Alert Count                   1
First Seen                    2016-10-16 13:28:20 +05
Last Seen                     2016-10-16 13:28:20 +05
Local ID                      a1fe229f-a450-4134-817f-5c98246bfc6e

Raw Audit Messages
type=AVC msg=audit(1476606500.277:2659): avc:  denied  { name_connect } for  pid=1115 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 permissive=0


Hash: php-fpm,httpd_t,mysqld_port_t,tcp_socket,name_connect

Version-Release number of selected component:
selinux-policy-3.13.1-219.fc25.noarch

Additional info:
reporter:       libreport-2.8.0
hashmarkername: setroubleshoot
kernel:         4.8.2-300.fc25.x86_64+debug
type:           libreport

Potential duplicate: bug 887774

Comment 1 Lukas Vrabec 2016-11-07 21:32:47 UTC
*****  Plugin catchall_boolean (47.5 confidence) suggests   ******************

If you want to allow httpd to can network connect db
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect_db' boolean.
You can read 'None' man page for more details.
Do
setsebool -P httpd_can_network_connect_db 1


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