Bug 1304664

Summary: Prosody SELinux policy (bind port 5281)
Product: Red Hat Enterprise Linux 7 Reporter: Etienne CHAMPETIER <champetier.etienne>
Component: selinux-policyAssignee: Simon Sekidde <ssekidde>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: low Docs Contact:
Priority: low    
Version: 7.2CC: kwizart, lvrabec, mgrepl, mmalik, plautrba, pvrabec, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-83.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 02:41:45 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:

Description Etienne CHAMPETIER 2016-02-04 09:49:37 UTC
Hi,

default prosody policy deny bind on port 5281 (https port, 5280 is http)

Audit:
type=AVC msg=audit(1454572521.584:3314): avc:  denied  { name_bind } for  pid=10248 comm="lua" src=5281 scontext=system_u:system_r:prosody_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=SYSCALL msg=audit(1454572521.584:3314): arch=c000003e syscall=49 success=no exit=-13 a0=b a1=15bfa80 a2=1c a3=6 items=0 ppid=10247 pid=10248 auid=4294967295 uid=991 gid=988 euid=991 suid=991 fsuid=991 egid=988 sgid=988 fsgid=988 tty=(none) ses=4294967295 comm="lua" exe="/usr/bin/lua" subj=system_u:system_r:prosody_t:s0 key=(null)
type=AVC msg=audit(1454572521.596:3315): avc:  denied  { name_bind } for  pid=10248 comm="lua" src=5281 scontext=system_u:system_r:prosody_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=SYSCALL msg=audit(1454572521.596:3315): arch=c000003e syscall=49 success=no exit=-13 a0=b a1=169ff80 a2=10 a3=5 items=0 ppid=10247 pid=10248 auid=4294967295 uid=991 gid=988 euid=991 suid=991 fsuid=991 egid=988 sgid=988 fsgid=988 tty=(none) ses=4294967295 comm="lua" exe="/usr/bin/lua" subj=system_u:system_r:prosody_t:s0 key=(null)


Links:

https://prosody.im/doc/http?s[]=https#port_configuration

https://github.com/fedora-selinux/selinux-policy/blob/02ed86515f00f9226eb99ec0b979632d353389b6/policy/modules/kernel/corenetwork.te.in#L198

https://github.com/fedora-selinux/selinux-policy/blob/7f1112b10c78e6a0df7e2637b2218decbf279129/prosody.te#L73

Regards
Etienne

Comment 2 Milos Malik 2016-02-04 10:14:12 UTC
modules_enabled = {
                "http";

Above-mentioned lines in /etc/prosody/prosody.cfg.lua trigger following AVCs:
----
type=SOCKADDR msg=audit(02/04/2016 11:08:08.971:211) : saddr=inet6 host::: serv:5281 
type=SYSCALL msg=audit(02/04/2016 11:08:08.971:211) : arch=x86_64 syscall=bind success=no exit=-13(Permission denied) a0=0x10 a1=0x24002b0 a2=0x1c a3=0x6 items=0 ppid=1 pid=4745 auid=unset uid=prosody gid=prosody euid=prosody suid=prosody fsuid=prosody egid=prosody sgid=prosody fsgid=prosody tty=(none) ses=unset comm=lua exe=/usr/bin/lua subj=system_u:system_r:prosody_t:s0 key=(null) 
type=AVC msg=audit(02/04/2016 11:08:08.971:211) : avc:  denied  { name_bind } for  pid=4745 comm=lua src=5281 scontext=system_u:system_r:prosody_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket 
----
type=SOCKADDR msg=audit(02/04/2016 11:08:08.978:212) : saddr=inet host:0.0.0.0 serv:5281 
type=SYSCALL msg=audit(02/04/2016 11:08:08.978:212) : arch=x86_64 syscall=bind success=no exit=-13(Permission denied) a0=0x10 a1=0x24e9d70 a2=0x10 a3=0x5 items=0 ppid=1 pid=4745 auid=unset uid=prosody gid=prosody euid=prosody suid=prosody fsuid=prosody egid=prosody sgid=prosody fsgid=prosody tty=(none) ses=unset comm=lua exe=/usr/bin/lua subj=system_u:system_r:prosody_t:s0 key=(null) 
type=AVC msg=audit(02/04/2016 11:08:08.978:212) : avc:  denied  { name_bind } for  pid=4745 comm=lua src=5281 scontext=system_u:system_r:prosody_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket 
----

The AVCs did not appear when the nis_enabled boolean is enabled. Unfortunately, effects of this boolean are too large. This scenario has nothing to do with NIS/YP configuration.

Comment 10 errata-xmlrpc 2016-11-04 02:41:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2283.html