Bug 677826

Summary: SELinux is preventing /usr/bin/mono from 'name_connect' accesses on the tcp_socket port 1433.
Product: [Fedora] Fedora Reporter: Vinayak Kumbhakern <kvinayaks>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 14CC: dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:4f0724708971cd6c1ed3a32cad02c3146a6dba7e0fd5e1d2719d2b85b3c99968
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-16 14:34:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Vinayak Kumbhakern 2011-02-16 00:03:58 UTC
SELinux is preventing /usr/bin/mono from 'name_connect' accesses on the tcp_socket port 1433.

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

If you want to allow HTTPD scripts and modules to connect to the network using any TCP port.
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect' boolean.
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.
Do
setsebool -P httpd_can_network_connect_db 1

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

If you believe that mono should be allowed name_connect access on the port 1433 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 mono /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                unconfined_u:system_r:httpd_t:s0
Target Context                system_u:object_r:mssql_port_t:s0
Target Objects                port 1433 [ tcp_socket ]
Source                        mono
Source Path                   /usr/bin/mono
Port                          1433
Host                          (removed)
Source RPM Packages           mono-core-2.6.7-3.fc14
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.7-29.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.35.11-83.fc14.i686 #1 SMP
                              Mon Feb 7 07:04:18 UTC 2011 i686 i686
Alert Count                   5
First Seen                    Mon 14 Feb 2011 11:22:08 PM EST
Last Seen                     Mon 14 Feb 2011 11:29:37 PM EST
Local ID                      11706a00-e59a-431a-8149-fd7743483870

Raw Audit Messages
type=AVC msg=audit(1297744177.626:23743): avc:  denied  { name_connect } for  pid=5797 comm="mono" dest=1433 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:mssql_port_t:s0 tclass=tcp_socket


type=SYSCALL msg=audit(1297744177.626:23743): arch=i386 syscall=socketcall per=400000 success=no exit=EACCES a0=3 a1=79c2ec0 a2=830658c a3=0 items=0 ppid=1 pid=5797 auid=500 uid=48 gid=488 euid=48 suid=48 fsuid=48 egid=488 sgid=488 fsgid=488 tty=(none) ses=1 comm=mono exe=/usr/bin/mono subj=unconfined_u:system_r:httpd_t:s0 key=(null)

Hash: mono,httpd_t,mssql_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 mssql_port_t:tcp_socket name_connect;

audit2allow -R

#============= 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 mssql_port_t:tcp_socket name_connect;

Comment 1 Miroslav Grepl 2011-02-16 14:34:56 UTC
*****  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.
Do

setsebool -P httpd_can_network_connect_db 1

Comment 2 Daniel Walsh 2011-02-16 20:10:16 UTC
Did you read the alert, the first and especially the second solution solved your problem.  Why did you report this as a bug?