Bug 1933164

Summary: Selinux blocks websockify, vnc console is blocked
Product: Red Hat Satellite Reporter: James Jeffers <jjeffers>
Component: SELinuxAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.7.0CC: ktordeur, lzap, zhunting
Target Milestone: 6.8.5Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-selinux-2.1.2.4-1,foreman-selinux-2.1.2.5-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1868005 Environment:
Last Closed: 2021-03-31 19:48:19 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:

Comment 3 Lukas Pramuk 2021-03-16 02:47:40 UTC
FailedQA.

@Satellite 6.8.5 Snap1
foreman-selinux-2.1.2.4-1.el7sat.noarch

by the reproducer described in comment#0

1) Select any provisioned host

2) Click [Console] button

(x) Failed to set console: Permission denied - /usr/share/foreman/extras/noVNC/websockify.py

# grep websockify /var/log/audit/audit.log
type=AVC msg=audit(1615862142.932:222): avc:  denied  { execute } for  pid=11591 comm="diagnostic_con*" name="websockify.py" dev="dm-0" ino=604173190 scontext=system_u:system_r:passenger_t:s0 tcontext=system_u:object_r:websockify_exec_t:s0 tclass=file permissive=0

# semodule -l | grep foreman
foreman	2.1.2.4

# grep -C3 'corecmd_exec_ls(websockify_t)' /usr/share/doc/foreman-selinux-2.1.2.4/foreman.te
read_files_pattern(websockify_t, puppet_var_lib_t, puppet_var_lib_t)
files_search_etc(websockify_t)
read_files_pattern(websockify_t, puppet_etc_t, puppet_etc_t)
corecmd_exec_ls(websockify_t)

tunable_policy(`websockify_can_connect_all',`
    corenet_tcp_connect_all_ports(websockify_t)

# audit2allow -a

#============= passenger_t ==============
allow passenger_t websockify_exec_t:file execute;


>>> the fix is present however there is another selinux denial (passenger 6.8  vs. puma 6.9)

Comment 4 Lukas Zapletal 2021-03-16 14:18:53 UTC
We need this patch:

https://projects.theforeman.org/issues/32110

Comment 7 Lukas Pramuk 2021-03-24 09:42:23 UTC
VERIFIED.

@Satellite 6.8.5 Snap2
foreman-selinux-2.1.2.5-1.el7sat.noarch

by the reproducer described in comment#0

1) Select any provisioned host

2) Click [Console] button

# semodule -l | grep foreman
foreman	2.1.2.5

# grep websockify /var/log/audit/audit.log
<empty>

>>> no selinux denials

Comment 11 errata-xmlrpc 2021-03-31 19:48:19 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 (Satellite 6.8.5 Async Bug Fix Update), 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://access.redhat.com/errata/RHBA-2021:1057