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 1059930 - SELinux is preventing /usr/lib64/erlang/erts-5.10.4/bin/beam.smp from name_bind access on the tcp_socket resulting in ejabberd.service failed to start
Summary: SELinux is preventing /usr/lib64/erlang/erts-5.10.4/bin/beam.smp from name_bi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 20
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-31 00:49 UTC by Vladislav Grigoryev
Modified: 2014-12-07 04:31 UTC (History)
6 users (show)

Fixed In Version: selinux-policy-3.12.1-196.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-12-07 04:31:42 UTC


Attachments (Terms of Use)

Description Vladislav Grigoryev 2014-01-31 00:49:19 UTC
Description of problem:
SELinux is preventing /usr/lib64/erlang/erts-5.10.4/bin/beam.smp from name_bind access on the tcp_socket resulting in ejabberd.service failed to start.

Version-Release number of selected component (if applicable):
ejabberd-2.1.13-7.fc20.x86_64
selinux-policy-3.12.1-119.fc20.noarch

How reproducible:
Always.

Steps to Reproduce:
1. yum install ejabberd
2. systemctl start ejabberd.service

Actual results:
SELinux is preventing /usr/lib64/erlang/erts-5.10.4/bin/beam.smp from name_bind access on the tcp_socket .

*****  Plugin bind_ports (92.2 confidence) suggests   ************************

If you want to allow /usr/lib64/erlang/erts-5.10.4/bin/beam.smp to bind to network port 5280
Then you need to modify the port type.
Do
# semanage port -a -t PORT_TYPE -p tcp 5280
    where PORT_TYPE is one of the following: amqp_port_t, couchdb_port_t, jabber_client_port_t, jabber_interserver_port_t.

*****  Plugin catchall_boolean (7.83 confidence) suggests   ******************

If you want to allow nis to enabled
Then you must tell SELinux about this by enabling the 'nis_enabled' boolean.
You can read 'None' man page for more details.
Do
setsebool -P nis_enabled 1

*****  Plugin catchall (1.41 confidence) suggests   **************************

If you believe that beam.smp should be allowed name_bind 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 beam.smp /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp


Additional Information:
Source Context                system_u:system_r:rabbitmq_beam_t:s0
Target Context                system_u:object_r:unreserved_port_t:s0
Target Objects                 [ tcp_socket ]
Source                        beam.smp
Source Path                   /usr/lib64/erlang/erts-5.10.4/bin/beam.smp
Port                          5280
Host                          srv9.kola.fad.ru
Source RPM Packages           erlang-erts-R16B-03.1.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-119.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     srv9.kola.fad.ru
Platform                      Linux srv9.kola.fad.ru 3.12.7-300.fc20.x86_64 #1
                              SMP Fri Jan 10 15:35:31 UTC 2014 x86_64 x86_64
Alert Count                   2
First Seen                    2014-01-31 03:45:45 MSK
Last Seen                     2014-01-31 03:57:01 MSK
Local ID                      2224fce7-a18c-4fea-b21a-c51da09807d4

Raw Audit Messages
type=AVC msg=audit(1391126221.107:17780): avc:  denied  { name_bind } for  pid=11054 comm="beam.smp" src=5280 scontext=system_u:system_r:rabbitmq_beam_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket


type=SYSCALL msg=audit(1391126221.107:17780): arch=x86_64 syscall=bind success=no exit=EACCES a0=15 a1=7f2568eaf980 a2=10 a3=1 items=0 ppid=1 pid=11054 auid=4294967295 uid=994 gid=993 euid=994 suid=994 fsuid=994 egid=993 sgid=993 fsgid=993 ses=4294967295 tty=(none) comm=beam.smp exe=/usr/lib64/erlang/erts-5.10.4/bin/beam.smp subj=system_u:system_r:rabbitmq_beam_t:s0 key=(null)

Hash: beam.smp,rabbitmq_beam_t,unreserved_port_t,tcp_socket,name_bind

Additional info:
Port 5280/tcp - ejabberd web interface (captcha, http_bind, http_poll, register, web_admin) by default.

Supposed to resolve with
> semanage port -a -t PORT_TYPE -p tcp 5280
But can't decide what port type should I use.
Setroubleshoot proposed port types don't match the purpose well.

Comment 1 Miroslav Grepl 2014-01-31 14:13:41 UTC
Is this port used by default?

Comment 2 Vladislav Grigoryev 2014-01-31 15:50:12 UTC
(In reply to Miroslav Grepl from comment #1)
> Is this port used by default?
Yes.

Enabled by default in ejabberd configuration:
> # grep -A5 5280 /etc/ejabberd/ejabberd.cfg
>	{5280, ejabberd_http, [
>		captcha,
>		http_bind,
>		http_poll,
>		web_admin
>	]}

Also described in documentation:
http://www.ejabberd.im/files/doc/guide.html#htoc20

Comment 3 Lukas Vrabec 2014-11-24 11:23:51 UTC
commit 49debee433de6b0411b92210a88b0d753a176973
Author: Lukas Vrabec <lvrabec@redhat.com>
Date:   Mon Nov 24 12:22:47 2014 +0100

    Label tcp port 5280 as ejabberd port. BZ(1059930)

Comment 4 Fedora Update System 2014-12-03 12:50:12 UTC
selinux-policy-3.12.1-196.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-196.fc20

Comment 5 Fedora Update System 2014-12-04 06:21:28 UTC
Package selinux-policy-3.12.1-196.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-196.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-16229/selinux-policy-3.12.1-196.fc20
then log in and leave karma (feedback).

Comment 6 lnie 2014-12-05 04:37:01 UTC
selinux-policy-3.12.1-196.fc20 works

Comment 7 Fedora Update System 2014-12-07 04:31:42 UTC
selinux-policy-3.12.1-196.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


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