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 1777506 - NetworkManager's nm-dispatcher runs with wrong SELinux context
Summary: NetworkManager's nm-dispatcher runs with wrong SELinux context
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 8.3
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-27 16:34 UTC by Thomas Haller
Modified: 2024-03-25 15:32 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 01:55:53 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4528 0 None None None 2020-11-04 01:56:19 UTC

Description Thomas Haller 2019-11-27 16:34:30 UTC
# ps -eZ | grep nm-dispatcher
system_u:system_r:NetworkManager_t:s0 3568 ?   00:00:01 nm-dispatcher


The dispatcher service runs scripts for other applications (or the user).

It should not run with NetworkManager's context.

Comment 1 Thomas Haller 2019-11-28 09:27:10 UTC
> It should not run with NetworkManager's context.

The real problem is not the context with which nm-dispatcher runs, but the context of the applications that it executes.


Usually, I would try to come up with a patch, but this is beyond my understanding how this is supposed to work.

Reassigning to selinux-policy.




For example, supposed I have the following dispatcher scripts:

```
$ cat /usr/lib/NetworkManager/dispatcher.d/90-nm-cloud-setup.sh 
#!/bin/sh

case "$2" in
    up|dhcp4-change)
        exec systemctl --no-block restart nm-cloud-setup.service
        ;;
esac
```

then I get:

Nov 28 10:25:31 rh1 audit[1]: USER_AVC pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=n/a uid=0 gid=0 path="/usr/lib/systemd/system/nm-cloud-setup.service" cmdline="" scontext=system_u:system_r:NetworkManager_t:s0 tcontext=system_u:object_r:systemd_unit_file_t:s0 tclass=service permissive=0
                               exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Nov 28 10:25:31 rh1 nm-dispatcher[3870728]: Failed to restart nm-cloud-setup.service: Access denied
Nov 28 10:25:31 rh1 nm-dispatcher[3870728]: See system logs and 'systemctl status nm-cloud-setup.service' for details.

Comment 2 Thomas Haller 2019-11-28 10:07:03 UTC
ah, seems this got fixed upstream:

https://github.com/fedora-selinux/selinux-policy-contrib/commit/11a7e057817f2945bd5302370e3dd3f9866a0bd4

Comment 3 Lukas Vrabec 2019-11-28 15:22:16 UTC
Fixes from Fedora:
commit 11a7e057817f2945bd5302370e3dd3f9866a0bd4
Author: Nikola Knazekova <nknazeko>
Date:   Fri Nov 22 23:14:46 2019 +0100

    Label /usr/lib/NetworkManager/dispatcher as NetworkManager_initrc_exec_t
    
    With NetworkManager 1.20 the dispatcher scripts are moved out of /etc to /usr/lib.
    https://src.fedoraproject.org/rpms/dhcp/c/b25b19a69ea76e9d11b188a153b4d7214e36b017?branch=master
    
    Fixed Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1764485

Comment 12 errata-xmlrpc 2020-11-04 01:55:53 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-2020:4528


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