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 2154245 - RPM scriptlet cannot call hostnamectl
Summary: RPM scriptlet cannot call hostnamectl
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.7
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-16 11:07 UTC by Renaud Métrich
Modified: 2023-05-09 07:47 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-05 10:47:23 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 2170059 0 high CLOSED Ensure dbus communication is allowed bidirectionally 2024-11-26 09:46:39 UTC
Red Hat Issue Tracker RHELPLAN-142697 0 None None None 2022-12-16 11:10:07 UTC

Description Renaud Métrich 2022-12-16 11:07:55 UTC
Description of problem:

RPM scriptlets (rpm_script_t) can execute hostnamectl, but systemd-hostnamed is not able to reply:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# sesearch -A -s rpm_script_t -c dbus -t systemd_hostnamed_t
allow dbusd_unconfined nsswitch_domain:dbus send_msg;
allow dbusd_unconfined systemd_hostnamed_t:dbus send_msg;

# sesearch -A -t rpm_script_t -c dbus -s systemd_hostnamed_t
--> nothing
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Please make sure that every DBus message sender can get replies, it's very likely that such issue applies to other system components.

Version-Release number of selected component (if applicable):

selinux-policy-3.14.3-108.el8.noarch

How reproducible:

Always

Comment 1 Renaud Métrich 2022-12-16 11:11:55 UTC
initrc_t is also impacted: it can send query but not receive result:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# sesearch -A -s initrc_t -c dbus -t systemd_hostnamed_t
allow dbusd_unconfined nsswitch_domain:dbus send_msg;
allow dbusd_unconfined systemd_hostnamed_t:dbus send_msg;

# sesearch -A -t initrc_t -c dbus -s systemd_hostnamed_t
--> nothing
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Comment 2 Zdenek Pytela 2023-02-15 15:06:55 UTC
Thank you for reporting this issue, I've cloned it for further checking and resolving in Fedora.

Can you explain what is the severity of this bug and what is the use case for running commands like hostnamectl from a rpm scriptlet?

Comment 3 Renaud Métrich 2023-02-24 06:53:54 UTC
We do not control which program is executed from rpm scriptlets, especially for 3rd party packages.
For now there is no use case, but it would be good to browse the policy once to detect all search missing rules, i.e. where 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.

Ideally an automated script should check for such rules, e.g.:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# Get all rules
sesearch -A -c dbus -p send_msg > /tmp/dbus_send_msg.rules

# Print rules that don't have "reply rules"
while read _ src tgt _; do tgt=$(echo $tgt | cut -f1 -d':'); grep -q "^allow $tgt $src:dbus" /tmp/dbus_send_msg.rules || echo "$src -> $tgt OK but no $tgt -> $src"; done < /tmp/dbus_send_msg.rules
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The script doesn't handle attributes, but the idea is here.

Comment 5 Zdenek Pytela 2023-05-05 10:47:23 UTC
As no new information appeared during the past weeks, we are going to close this bug. If you need to pursue this matter further, feel free to reopen this bug and add justification.

Progress can be tracked in the following Fedora bz:
https://bugzilla.redhat.com/show_bug.cgi?id=2170059


Note You need to log in before you can comment on or make changes to this bug.