Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1513975 - Tomcat can't connect to local maria db
Summary: Tomcat can't connect to local maria db
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.4
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-16 12:16 UTC by Frank Büttner
Modified: 2017-11-21 12:41 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-11-16 14:02:17 UTC


Attachments (Terms of Use)

Description Frank Büttner 2017-11-16 12:16:53 UTC
Description of problem:
An boolean is missing that can allow tomcat webapps to connect to an mariadb database. By default tomcat can't connect to it.

Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-166.el7_4.5.noarch


Error:
type=AVC msg=audit(1510834084.006:293): avc:  denied  { name_connect } for  pid=17374 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(1510834084.006:293): arch=c000003e syscall=42 success=no exit=-13 a0=9b a1=7f8500cdab80 a2=1c a3=7f8500cda7a0 items=0 ppid=1 pid=17374 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.151-1.b12.el7_4.x86_64/jre/bin/java" subj=system_u:system_r:tomcat_t:s0 key=(null)
type=PROCTITLE msg=audit(1510834084.006:293): proctitle=2F7573722F6C69622F6A766D2F6A72652F62696E2F6A617661002D6167656E74706174683A2F7573722F6C69622F616272742D6A6176612D636F6E6E6563746F722F6C6962616272742D6A6176612D636F6E6E6563746F722E736F3D616272743D6F6E002D636C61737370617468002F7573722F73686172652F746F6D636174
type=AVC msg=audit(1510834084.006:294): avc:  denied  { name_connect } for  pid=17374 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(1510834084.006:294): arch=c000003e syscall=42 success=no exit=-13 a0=9b a1=7f8500cdab80 a2=1c a3=d8 items=0 ppid=1 pid=17374 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.151-1.b12.el7_4.x86_64/jre/bin/java" subj=system_u:system_r:tomcat_t:s0 key=(null)
type=PROCTITLE msg=audit(1510834084.006:294): proctitle=2F7573722F6C69622F6A766D2F6A72652F62696E2F6A617661002D6167656E74706174683A2F7573722F6C69622F616272742D6A6176612D636F6E6E6563746F722F6C6962616272742D6A6176612D636F6E6E6563746F722E736F3D616272743D6F6E002D636C61737370617468002F7573722F73686172652F746F6D636174
type=AVC msg=audit(1510834091.275:295): avc:  denied  { name_connect } for  pid=17374 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(1510834091.275:295): arch=c000003e syscall=42 success=no exit=-13 a0=9b a1=7f8500cdb770 a2=1c a3=122 items=0 ppid=1 pid=17374 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.151-1.b12.el7_4.x86_64/jre/bin/java" subj=system_u:system_r:tomcat_t:s0 key=(null)
type=PROCTITLE msg=audit(1510834091.275:295): proctitle=2F7573722F6C69622F6A766D2F6A72652F62696E2F6A617661002D6167656E74706174683A2F7573722F6C69622F616272742D6A6176612D636F6E6E6563746F722F6C6962616272742D6A6176612D636F6E6E6563746F722E736F3D616272743D6F6E002D636C61737370617468002F7573722F73686172652F746F6D636174
type=AVC msg=audit(1510834091.275:296): avc:  denied  { name_connect } for  pid=17374 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(1510834091.275:296): arch=c000003e syscall=42 success=no exit=-13 a0=9b a1=7f8500cdb770 a2=1c a3=122 items=0 ppid=1 pid=17374 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.151-1.b12.el7_4.x86_64/jre/bin/java" subj=system_u:system_r:tomcat_t:s0 key=(null)
type=PROCTITLE msg=audit(1510834091.275:296): proctitle=2F7573722F6C69622F6A766D2F6A72652F62696E2F6A617661002D6167656E74706174683A2F7573722F6C69622F616272742D6A6176612D636F6E6E6563746F722F6C6962616272742D6A6176612D636F6E6E6563746F722E736F3D616272743D6F6E002D636C61737370617468002F7573722F73686172652F746F6D636174




Additional info:
Source code for it

bool tomcat_can_network_connect_mariadb false;

require {
        type mysqld_port_t;
        type tomcat_t;
        class tcp_socket name_connect;
}

if (tomcat_can_network_connect_mariadb) {
        allow tomcat_t mysqld_port_t:tcp_socket name_connect;
}

Comment 2 Lukas Vrabec 2017-11-16 14:02:17 UTC
This fix will be adressed in next minor release.

Comment 3 Milos Malik 2017-11-16 19:51:39 UTC
I believe this bug is a duplicate of BZ#1491747.


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