Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1846081

Summary: both rhsm and rhsm-facts services run as unconfined_service_t
Product: Red Hat Enterprise Linux 8 Reporter: Milos Malik <mmalik>
Component: selinux-policyAssignee: Patrik Koncity <pkoncity>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.3CC: jhnidek, lvrabec, mmalik, pkoncity, plautrba, ssekidde, zpytela
Target Milestone: rcKeywords: Triaged
Target Release: 8.5Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.14.3-76.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:42:28 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:    
Bug Blocks: 1726199    

Description Milos Malik 2020-06-10 17:33:42 UTC
Description of problem:
 * both services belong to the subscription-manager component, which is shipped in RHEL, but they are not confined by SELinux policy

# matchpathcon /usr/libexec/rhsm-service
/usr/libexec/rhsm-service	system_u:object_r:bin_t:s0
# matchpathcon /usr/libexec/rhsm-facts-service 
/usr/libexec/rhsm-facts-service	system_u:object_r:bin_t:s0
#

Version-Release number of selected component (if applicable):
selinux-policy-3.14.3-41.el8.noarch
selinux-policy-targeted-3.14.3-41.el8.noarch
subscription-manager-1.26.16-1.el8.x86_64
subscription-manager-rhsm-certificates-1.26.16-1.el8.x86_64

How reproducible:
 * always

Steps to Reproduce:
1. get a RHEL-8.2 machine (targeted policy is active)
# service rhsm start
Redirecting to /bin/systemctl start rhsm.service
# service rhsm-facts start
Redirecting to /bin/systemctl start rhsm-facts.service
# ps -efZ | grep rhsm[-]
system_u:system_r:unconfined_service_t:s0 root 5048    1  0 13:21 ?        00:00:00 /usr/libexec/platform-python /usr/libexec/rhsm-service
system_u:system_r:unconfined_service_t:s0 root 5064    1  0 13:21 ?        00:00:00 /usr/libexec/platform-python /usr/libexec/rhsm-facts-service
#

Expected results:
 * the services are confined (either rhsmcertd_t or another SELinux domain)

Comment 1 Milos Malik 2020-06-10 17:49:57 UTC
Are these services functionally different from the rhsmcertd service?

I assume that we can use the rhsmcertd policy for them:

# chcon -t rhsmcertd_exec_t /usr/libexec/rhsm-service
# chcon -t rhsmcertd_exec_t /usr/libexec/rhsm-facts-service

They do not trigger any SELinux denials and they seem to run without problems:

# ps -efZ | grep rhsm[-]
system_u:system_r:rhsmcertd_t:s0 root       5170       1  0 13:42 ?        00:00:00 /usr/libexec/platform-python /usr/libexec/rhsm-service
system_u:system_r:rhsmcertd_t:s0 root       5212       1  0 13:42 ?        00:00:00 /usr/libexec/platform-python /usr/libexec/rhsm-facts-service
#

Comment 4 Patrik Koncity 2021-07-05 12:54:57 UTC
PR: https://github.com/fedora-selinux/selinux-policy/pull/798

Comment 5 Zdenek Pytela 2021-07-30 16:51:16 UTC
To backport:
commit 322b1d412ae6762333a9b4e22fedc09e50351e3b (HEAD -> rawhide, upstream/rawhide)
Author: Patrik Koncity <pkoncity>
Date:   Thu May 27 09:56:37 2021 +0200

    Confine rhsm service and rhsm-facts service as rhsmcertd_t

    Rhsm service and rhsm-fact service run as unconfined_t. Use existing
    rhsmcertd_t policy to confine rhsm service and rhsm-facts service as
    rhsmcertd_t. Label binary files, which execute systemd daemon.

    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1846081

Comment 14 errata-xmlrpc 2021-11-09 19:42:28 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 (selinux-policy bug fix and enhancement 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:4420