Bug 1393649

Summary: ejabberd's unit file should not launch ejabberdctl with /usr/bin/bash
Product: [Fedora] Fedora Reporter: Randy Barlow <randy>
Component: ejabberdAssignee: Peter Lemenkov <lemenkov>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 26CC: erlang, jeremy, lemenkov, martin, randy
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ejabberd-18.01-2.fc27 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-06 11:22:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1393643    
Bug Blocks:    

Description Randy Barlow 2016-11-10 05:34:39 UTC
Description of problem:
Currently, ejabberdctl is launched by systemd with /usr/bin/bash instead of being launched directly. This causes the process to run in the initrc_t context which is very permissive. Instead, systemd should launch ejabberdctl directly.

However, there are two blockers to getting this change done and working, as we get these AVC denials with this change in place:

type=AVC msg=audit(1478751171.862:648): avc:  denied  { write } for  pid=2989 comm="async_2" name="ejabberd.pem" dev="dm-1" ino=44546 scontext=system_u:system_r:rabbitmq_t:s0 tcontext=unconfined_u:object_r:etc_t:s0 tclass=file permissive=0
type=AVC msg=audit(1478751171.863:649): avc:  denied  { write } for  pid=2989 comm="async_2" name="ejabberd.pem" dev="dm-1" ino=44546 scontext=system_u:system_r:rabbitmq_t:s0 tcontext=unconfined_u:object_r:etc_t:s0 tclass=file permissive=0
type=AVC msg=audit(1478751171.865:650): avc:  denied  { name_bind } for  pid=2986 comm="beam" src=5349 scontext=system_u:system_r:rabbitmq_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket permissive=0

I've filed a bug upstream to request that they stop trying to open the certfile in write mode[0], and I've filed a bug against selinux-policy to request that ejabberd be allowed to use tcp port 5349[1]. Once both of those bugs are fixed, we can proceed with dropping /usr/bin/bash presuming that we don't then hit further AVC denials (which could happen).


Version-Release number of selected component (if applicable):
ejabberd-16.08-2.fc25.x86_64


Additional info:
[0] https://github.com/processone/ejabberd/issues/1375
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1393643

Comment 1 Randy Barlow 2016-11-10 05:49:24 UTC
When we do this, we will probably also need to add a restorecon -R /var/lib/ejabberd to the %post section, or something similar. We may need something for /etc/ejabberd as well.

Comment 2 Fedora End Of Life 2017-02-28 10:35:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 3 Fedora Update System 2018-01-16 19:30:44 UTC
erlang-xmpp-1.1.19-1.fc27 erlang-esip-1.0.21-1.fc27 erlang-stun-1.0.20-1.fc27 erlang-jose-1.8.4-1.fc27 erlang-base64url-1.0-1.fc27 erlang-fs-4.1-2.fc27 erlang-fast_xml-1.1.28-1.fc27 erlang-fast_yaml-1.0.12-1.fc27 erlang-fast_tls-1.0.20-1.fc27 erlang-ezlib-1.0.3-1.fc27 erlang-cache_tab-1.0.12-1.fc27 ejabberd-18.01-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-8d1658ffde

Comment 4 Fedora Update System 2018-01-21 10:40:25 UTC
ejabberd-18.01-1.fc27, erlang-base64url-1.0-1.fc27, erlang-cache_tab-1.0.12-1.fc27, erlang-esip-1.0.21-1.fc27, erlang-ezlib-1.0.3-1.fc27, erlang-fast_tls-1.0.20-1.fc27, erlang-fast_xml-1.1.28-1.fc27, erlang-fast_yaml-1.0.12-1.fc27, erlang-fs-4.1-2.fc27, erlang-jose-1.8.4-1.fc27, erlang-stun-1.0.20-1.fc27, erlang-xmpp-1.1.19-1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-8d1658ffde

Comment 5 Fedora Update System 2018-01-22 17:25:21 UTC
ejabberd-18.01-2.fc27 erlang-base64url-1.0-1.fc27 erlang-cache_tab-1.0.12-1.fc27 erlang-esip-1.0.21-1.fc27 erlang-ezlib-1.0.3-1.fc27 erlang-fast_tls-1.0.20-1.fc27 erlang-fast_xml-1.1.28-1.fc27 erlang-fast_yaml-1.0.12-1.fc27 erlang-fs-4.1-2.fc27 erlang-jose-1.8.4-1.fc27 erlang-stun-1.0.20-1.fc27 erlang-xmpp-1.1.19-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-8d1658ffde

Comment 6 Fedora Update System 2018-01-23 23:39:27 UTC
ejabberd-18.01-2.fc27, erlang-base64url-1.0-1.fc27, erlang-cache_tab-1.0.12-1.fc27, erlang-esip-1.0.21-1.fc27, erlang-ezlib-1.0.3-1.fc27, erlang-fast_tls-1.0.20-1.fc27, erlang-fast_xml-1.1.28-1.fc27, erlang-fast_yaml-1.0.12-1.fc27, erlang-fs-4.1-2.fc27, erlang-jose-1.8.4-1.fc27, erlang-stun-1.0.20-1.fc27, erlang-xmpp-1.1.19-1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-8d1658ffde

Comment 7 Fedora Update System 2018-02-06 11:22:02 UTC
ejabberd-18.01-2.fc27, erlang-base64url-1.0-1.fc27, erlang-cache_tab-1.0.12-1.fc27, erlang-esip-1.0.21-1.fc27, erlang-ezlib-1.0.3-1.fc27, erlang-fast_tls-1.0.20-1.fc27, erlang-fast_xml-1.1.28-1.fc27, erlang-fast_yaml-1.0.12-1.fc27, erlang-fs-4.1-2.fc27, erlang-jose-1.8.4-1.fc27, erlang-stun-1.0.20-1.fc27, erlang-xmpp-1.1.19-1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2018-02-06 15:27:36 UTC
ejabberd-18.01-2.fc27, erlang-base64url-1.0-1.fc27, erlang-cache_tab-1.0.12-1.fc27, erlang-esip-1.0.21-1.fc27, erlang-ezlib-1.0.3-1.fc27, erlang-fast_tls-1.0.20-1.fc27, erlang-fast_xml-1.1.28-1.fc27, erlang-fast_yaml-1.0.12-1.fc27, erlang-fs-4.1-2.fc27, erlang-jose-1.8.4-1.fc27, erlang-stun-1.0.20-1.fc27, erlang-xmpp-1.1.19-1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.