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 1956302 - Confined sysadm users cannot read the content of /etc/shadow, even when using getent
Summary: Confined sysadm users cannot read the content of /etc/shadow, even when using...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 8.5
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 1778780
TreeView+ depends on / blocked
 
Reported: 2021-05-03 12:44 UTC by Renaud Métrich
Modified: 2024-06-14 01:25 UTC (History)
4 users (show)

Fixed In Version: selinux-policy-3.14.3-77.el8
Doc Type: Bug Fix
Doc Text:
Cause: A confined sysadm user was unable to access /etc/shadow Consequence: The user was denied to read and manage users passwords Fix: A rule was added to the policy to allow confined sysadm user manage /etc/shadow Result: The user is now able to read and manage users passwords
Clone Of:
Environment:
Last Closed: 2021-11-09 19:43:05 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 6012421 0 None None None 2021-05-03 13:24:07 UTC
Red Hat Product Errata RHBA-2021:4420 0 None None None 2021-11-09 19:43:42 UTC

Description Renaud Métrich 2021-05-03 12:44:07 UTC
Description of problem:

With the current policy, sysadm_t users cannot read the content of /etc/shadow after sudoing: nothing is returned and no AVC pops up (because there is a dontaudit rule):

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
$ id -Z
sysadm_u:sysadm_r:sysadm_t:s0-s0:c0.c1023

$ sudo getent shadow
--> empty
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Note that using **sudo -r sysadm_r** doesn't help either here (which is the usual workaround for BZ #1943572):

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
$ sudo -r sysadm_r getent shadow
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

This is because **sysadm_t** (the context of getent since it's labeled with bin_t) has no rule for that in the policy (there is only a dontaudit rule to hide the AVC):

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# sesearch --dontaudit -s sysadm_t -t shadow_t -c file -p read
dontaudit sysadm_t shadow_t:file { getattr ioctl lock open read };

# sesearch --allow -s sysadm_t -t shadow_t -c file -p read
--> nothing
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Does that make sense to allow sysadm_t to do this???
YES because sysadm_t can already **edit** the file using **/usr/sbin/vipw** (so can actually do more ...).


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

RHEL7 and RHEL8 policies


How reproducible:

Always, see above.

Additional info:

My recommendation is to add the following rule:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
auth_read_shadow(sysadm_t)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Note that because of BZ #1943572, this won't solve the issue for **sudo getent shadow**, only for **sudo -r sysadm_r getent shadow**.
I would hence recommend that RFE BZ #1910077 gets implemented ASAP.

Comment 9 errata-xmlrpc 2021-11-09 19:43:05 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


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