Bug 2143641

Summary: USER_AVC produced when cups sends a DBus notification upon printer status change
Product: Red Hat Enterprise Linux 9 Reporter: Renaud Métrich <rmetrich>
Component: selinux-policyAssignee: Nobody <nobody>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.1CC: lvrabec, mmalik, zpytela
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-38.1.15-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:52:17 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 Renaud Métrich 2022-11-17 13:31:14 UTC
Description of problem:

Upon changing a printer status, cupsd sends a DBus notification through its notifier /usr/lib/cups/notifier/dbus, running in same context as cupsd, *cupsd_t*.
If the GUI is in GDM chooser, this leads to getting a USER_AVC:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
type=USER_AVC msg=audit(11/17/2022 14:07:50.723:319) : pid=755 uid=dbus auid=unset ses=unset subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for  scontext=system_u:system_r:cupsd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tclass=dbus permissive=0  exe=/usr/bin/dbus-broker sauid=dbus hostname=? addr=? terminal=?' 
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The reason for this is cupsd sends the notification, dbus-broker wants to relay it to the registered consumer /usr/libexec/gsd-print-notifications, but this fails because the consumer executes as *xdm_t* and there is no rule to allow this in the policy.
Following rule is missing:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
allow cupsd_t xdm_t:dbus send_msg;
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

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

selinux-policy-34.1.43-1.el9.noarch

How reproducible:

Always

Steps to Reproduce:

1. Install a system with Graphical Interface and let it sit at GDM chooser

2. Add a printer to Cups

  localhost:631 -> Administration -> Add Printer -> Local Printer: "CUPS-BRF (Virtual Braille BRF Printer)" -> Name: "test" -> ...

3. Toogle the printer status

  # cupsdisable test
  # cupsenable test

Actual results:

USER_AVC

Expected results:

No USER_AVC

Comment 9 errata-xmlrpc 2023-11-07 08:52:17 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:6617