Bug 970857

Summary: SELinux is preventing /usr/bin/mongod from 'name_connect' accesses on the tcp_socket .
Product: [Fedora] Fedora Reporter: Raman Gupta <rocketraman>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:7ad296e650e0d3237a70ab5625d350b1fb2de375ef3d1e7447a6778d74cc99b2
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-04 14:28:48 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 Raman Gupta 2013-06-05 06:20:49 UTC
Description of problem:
When I tried to use the cloneDatabase function of mongo, my mongodb raised this SELinux alert.
SELinux is preventing /usr/bin/mongod from 'name_connect' accesses on the tcp_socket .

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that mongod 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 mongod /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:mongod_t:s0
Target Context                system_u:object_r:mongod_port_t:s0
Target Objects                 [ tcp_socket ]
Source                        mongod
Source Path                   /usr/bin/mongod
Port                          27017
Host                          (removed)
Source RPM Packages           mongodb-server-2.2.3-4.fc17.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.10.0-169.fc17.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.8.13-100.fc17.x86_64 #1 SMP Mon
                              May 13 13:36:17 UTC 2013 x86_64 x86_64
Alert Count                   4
First Seen                    2013-06-05 02:14:12 EDT
Last Seen                     2013-06-05 02:17:14 EDT
Local ID                      3484e248-21fa-4953-a98c-5dcf60d20147

Raw Audit Messages
type=AVC msg=audit(1370413034.287:268): avc:  denied  { name_connect } for  pid=6675 comm="mongod" dest=27017 scontext=system_u:system_r:mongod_t:s0 tcontext=system_u:object_r:mongod_port_t:s0 tclass=tcp_socket


type=SYSCALL msg=audit(1370413034.287:268): arch=x86_64 syscall=connect success=no exit=EACCES a0=f a1=7fa257cf5008 a2=10 a3=0 items=0 ppid=1 pid=6675 auid=4294967295 uid=184 gid=989 euid=184 suid=184 fsuid=184 egid=989 sgid=989 fsgid=989 ses=4294967295 tty=(none) comm=mongod exe=/usr/bin/mongod subj=system_u:system_r:mongod_t:s0 key=(null)

Hash: mongod,mongod_t,mongod_port_t,tcp_socket,name_connect

audit2allow

#============= mongod_t ==============
allow mongod_t mongod_port_t:tcp_socket name_connect;

audit2allow -R

#============= mongod_t ==============
allow mongod_t mongod_port_t:tcp_socket name_connect;


Additional info:
hashmarkername: setroubleshoot
kernel:         3.8.13-100.fc17.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-06-07 09:37:42 UTC
Added to all Fedora releases.

Comment 2 Fedora End Of Life 2013-07-04 07:02:10 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.