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 2173289

Summary: ipa-healthcheck cannot be executed by system cronjobs (system_cronjob_t)
Product: Red Hat Enterprise Linux 8 Reporter: bchoorak <bchoorak>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.7CC: lvrabec, mmalik, rmetrich
Target Milestone: rcKeywords: Triaged
Target Release: 8.9Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.14.3-118.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-14 15:47:42 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 bchoorak@redhat.com 2023-02-25 12:18:07 UTC
Description of problem:

1. The AVC stats that process 1026 running as certmonger_t cannot REPLY (method_return) to caller running as system_cronjob_t.
~~~
time->Mon Feb 13 14:30:25 2023
type=USER_AVC msg=audit(1676295025.654:492962): pid=928 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for msgtype=method_return dest=:1.133676 spid=1026 tpid=2179712 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:system_r:system_cronjob_t:s0-s0:c0.c1023 tclass=dbus permissive=0  exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'
~~~

2. The caller is likely ipa-healthcheck which is labeled with bin_t, causing the context of the parent (system_cronjob_t) to be used.

3. This is LEGIT and clearly shows a missing rule in the SELinux policy.
Indeed we can see SENDING is OK, but there is no rule for REPLYING:
~~~
# sesearch -A -s system_cronjob_t -t certmonger_t -c dbus -p send_msg
allow dbusd_unconfined certmonger_t:dbus send_msg;
allow dbusd_unconfined nsswitch_domain:dbus send_msg;
~~~
# sesearch -A -t system_cronjob_t -s certmonger_t -c dbus -p send_msg
--> nothing
~~~

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux release 8.7 (Ootpa)
4.18.0-425.10.1.el8_7.x86_64
selinux-policy-3.14.3-108.el8_7.1.noarch
ipa-selinux-4.9.10-9.module+el8.7.0+17437+cf46f77f.noarch
ipa-healthcheck-0.7-14.module+el8.7.0+15352+88b578e5.noarch

How reproducible:
Always


Actual results:

A source domain can send the message to a target domain but not get the response because the target domain cannot send back messages to source domain itself.

Comment 1 Renaud Métrich 2023-03-06 07:42:51 UTC
Two rules are missing at least:

allow certmonger_t system_cronjob_t:dbus send_msg;
allow sssd_t system_cronjob_t:dbus send_msg;

Comment 2 Zdenek Pytela 2023-03-10 18:30:02 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/1624

The other has already been added in 8.8.

Comment 3 Zdenek Pytela 2023-04-04 18:03:07 UTC
Commit to backport:
commit fd8c414d883570c82f1e4381992ead8abf0e5fb4 (HEAD -> rawhide, upstream/rawhide)
Author: Zdenek Pytela <zpytela>
Date:   Fri Mar 10 19:26:40 2023 +0100

    Allow certmonger dbus chat with the cron system domain

Comment 20 errata-xmlrpc 2023-11-14 15:47:42 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-2023:7091