Bug 1971051

Summary: Katello ping controller calls /usr/bin/systemctl which cannot be allowed by SELinux
Product: Red Hat Satellite Reporter: Partha Aji <paji>
Component: SELinuxAssignee: Lukas Zapletal <lzap>
Status: CLOSED CURRENTRELEASE QA Contact: Lukas Pramuk <lpramuk>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.9.0CC: lzap, satellite6-bugs, swadeley
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1967856 Environment:
Last Closed: 2022-12-16 21:05:40 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:
Bug Depends On: 1967856    
Bug Blocks:    

Description Partha Aji 2021-06-11 18:22:07 UTC
Description of problem:

After running automated tests I found:

 ~]# ausearch -m AVC,USER_AVC -ts today
----
time->Fri Jun  4 09:36:43 2021
type=PROCTITLE msg=audit(1622792203.625:40405): proctitle=7368002D630073797374656D63746C2069732D656E61626C65642070756C70636F72652D6170692E7365727669636520263E2F6465762F6E756C6C
type=SYSCALL msg=audit(1622792203.625:40405): arch=c000003e syscall=4 success=no exit=-13 a0=865110 a1=7fff7aa81710 a2=7fff7aa81710 a3=13 items=0 ppid=19368 pid=15582 auid=4294967295 uid=993 gid=991 euid=993 suid=993 fsuid=993 egid=991 sgid=991 fsgid=991 tty=(none) ses=4294967295 comm="sh" exe="/usr/bin/bash" subj=system_u:system_r:foreman_rails_t:s0 key=(null)
type=AVC msg=audit(1622792203.625:40405): avc:  denied  { getattr } for  pid=15582 comm="sh" path="/usr/bin/systemctl" dev="dm-0" ino=705763 scontext=system_u:system_r:foreman_rails_t:s0 tcontext=system_u:object_r:systemd_systemctl_exec_t:s0 tclass=file permissive=0


Version-Release number of selected component (if applicable):
 ~]# rpm -q satellite
satellite-6.9.2-1.el7sat.noarch

How reproducible:
I see three AVCs today

Steps to Reproduce:
1. Install Sat6.9.2
2. Run some Robottelo tests over SSH (I was running: tests/foreman/ui/test_contenthost.py::test_positive_end_to_end)
3. Run tests/foreman/sys/test_pulp3_filesystem.py::test_selinux_status

Actual results:
SSHCommandResult(stdout=['type=AVC msg=audit(1622792203.625:40405): avc:  denied  { getattr } for  pid=15582 comm="sh"...070756C70636F72652D6170692E7365727669636520263E2F6465762F6E756C6C', ''], stderr=b'', return_code=0, output_format=None).return_code

Expected results:
No AVC

--- Additional comment from Lukas Zapletal on 2021-06-04 11:53:48 UTC ---

This is likely caused by https://github.com/Katello/katello/blob/7c9aa78fb5c5c14ea15af759a9d36fd4a7368377/app/models/katello/ping.rb#L12 which was added recently. We cannot allow executing this command, therefore the code must be updated in Katello.

Comment 2 Partha Aji 2021-06-11 18:27:08 UTC
Connecting redmine issue https://projects.theforeman.org/issues/32787 from this bug

Comment 3 Bryan Kearney 2021-06-23 22:48:31 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32765 has been resolved.

Comment 4 Lukas Zapletal 2021-10-12 07:09:35 UTC
*** Bug 2012180 has been marked as a duplicate of this bug. ***