Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
SElinux won't allow tomcat7 to connect to remote mysql server
Version-Release number of selected component (if applicable):
libselinux-2.5-11.el7.x86_64
libselinux-python-2.5-11.el7.x86_64
libselinux-utils-2.5-11.el7.x86_64
selinux-policy-3.13.1-166.el7.noarch
selinux-policy-targeted-3.13.1-166.el7.noarch
tomcat-7.0.76-2.el7.noarch
tomcat-el-2.2-api-7.0.76-2.el7.noarch
tomcat-jsp-2.2-api-7.0.76-2.el7.noarch
tomcat-lib-7.0.76-2.el7.noarch
tomcat-servlet-3.0-api-7.0.76-2.el7.noarch
Additional info:
# sealert -a /var/log/audit/audit.log
100% done
found 1 alerts in audit.log
--------------------------------------------------------------------------------
SELinux is preventing /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-2.b16.el7_4.x86_64/jre/bin/java from name_connect access on the tcp_socket port 3306.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that java 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 'java' --raw | audit2allow -M my-java
# semodule -i my-java.pp
Additional Information:
Source Context system_u:system_r:tomcat_t:s0
Target Context system_u:object_r:mysqld_port_t:s0
Target Objects port 3306 [ tcp_socket ]
Source java
Source Path /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-2.b16.el
7_4.x86_64/jre/bin/java
Port 3306
Host <Unknown>
Source RPM Packages
Target RPM Packages
Policy RPM selinux-policy-3.13.1-166.el7_4.4.noarch
Selinux Enabled True
Policy Type targeted
Enforcing Mode Enforcing
Host Name tester2.testlab.org
Platform Linux tester2.testlab.org
3.10.0-693.2.2.el7.x86_64 #1 SMP Sat Sep 9
03:55:24 EDT 2017 x86_64 x86_64
Alert Count 2460
First Seen 2017-09-12 13:38:37 UTC
Last Seen 2017-09-12 13:54:48 UTC
Local ID cb80c78b-996f-465b-9748-19bab2303a2b
Raw Audit Messages
type=AVC msg=audit(1505224488.414:7660): avc: denied { name_connect } for pid=2380 comm="java" dest=3306 scontext=system_u:system_r:tomcat_t:s0 tcontext=system_u:object_r:mysqld_port_t:s0 tclass=tcp_socket
type=SYSCALL msg=audit(1505224488.414:7660): arch=x86_64 syscall=connect success=no exit=EACCES a0=35 a1=7f29d34fa800 a2=10 a3=8ca items=0 ppid=1 pid=2380 auid=4294967295 uid=91 gid=91 euid=91 suid=91 fsuid=91 egid=91 sgid=91 fsgid=91 tty=(none) ses=4294967295 comm=java exe=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-2.b16.el7_4.x86_64/jre/bin/java subj=system_u:system_r:tomcat_t:s0 key=(null)
Hash: java,tomcat_t,mysqld_port_t,tcp_socket,name_connect
Description of problem: SElinux won't allow tomcat7 to connect to remote mysql server Version-Release number of selected component (if applicable): libselinux-2.5-11.el7.x86_64 libselinux-python-2.5-11.el7.x86_64 libselinux-utils-2.5-11.el7.x86_64 selinux-policy-3.13.1-166.el7.noarch selinux-policy-targeted-3.13.1-166.el7.noarch tomcat-7.0.76-2.el7.noarch tomcat-el-2.2-api-7.0.76-2.el7.noarch tomcat-jsp-2.2-api-7.0.76-2.el7.noarch tomcat-lib-7.0.76-2.el7.noarch tomcat-servlet-3.0-api-7.0.76-2.el7.noarch Additional info: # sealert -a /var/log/audit/audit.log 100% done found 1 alerts in audit.log -------------------------------------------------------------------------------- SELinux is preventing /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-2.b16.el7_4.x86_64/jre/bin/java from name_connect access on the tcp_socket port 3306. ***** Plugin catchall (100. confidence) suggests ************************** If you believe that java 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 'java' --raw | audit2allow -M my-java # semodule -i my-java.pp Additional Information: Source Context system_u:system_r:tomcat_t:s0 Target Context system_u:object_r:mysqld_port_t:s0 Target Objects port 3306 [ tcp_socket ] Source java Source Path /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-2.b16.el 7_4.x86_64/jre/bin/java Port 3306 Host <Unknown> Source RPM Packages Target RPM Packages Policy RPM selinux-policy-3.13.1-166.el7_4.4.noarch Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Host Name tester2.testlab.org Platform Linux tester2.testlab.org 3.10.0-693.2.2.el7.x86_64 #1 SMP Sat Sep 9 03:55:24 EDT 2017 x86_64 x86_64 Alert Count 2460 First Seen 2017-09-12 13:38:37 UTC Last Seen 2017-09-12 13:54:48 UTC Local ID cb80c78b-996f-465b-9748-19bab2303a2b Raw Audit Messages type=AVC msg=audit(1505224488.414:7660): avc: denied { name_connect } for pid=2380 comm="java" dest=3306 scontext=system_u:system_r:tomcat_t:s0 tcontext=system_u:object_r:mysqld_port_t:s0 tclass=tcp_socket type=SYSCALL msg=audit(1505224488.414:7660): arch=x86_64 syscall=connect success=no exit=EACCES a0=35 a1=7f29d34fa800 a2=10 a3=8ca items=0 ppid=1 pid=2380 auid=4294967295 uid=91 gid=91 euid=91 suid=91 fsuid=91 egid=91 sgid=91 fsgid=91 tty=(none) ses=4294967295 comm=java exe=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-2.b16.el7_4.x86_64/jre/bin/java subj=system_u:system_r:tomcat_t:s0 key=(null) Hash: java,tomcat_t,mysqld_port_t,tcp_socket,name_connect