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 1943572 - confined sysadm user cannot update a user's password using "sudo passwd ..." command
Summary: confined sysadm user cannot update a user's password using "sudo passwd ..." ...
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.6
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 1778780
TreeView+ depends on / blocked
 
Reported: 2021-03-26 13:36 UTC by Renaud Métrich
Modified: 2022-05-10 16:22 UTC (History)
4 users (show)

Fixed In Version: selinux-policy-3.14.3-86.el8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-10 15:14:58 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1910077 1 high CLOSED sudoing as sysadm_r still requires specifying "-r sysadm_r" parameter 2023-10-09 15:18:00 UTC
Red Hat Product Errata RHBA-2022:1995 0 None None None 2022-05-10 15:15:33 UTC

Description Renaud Métrich 2021-03-26 13:36:33 UTC
Description of problem:

There are many cases where executing a command with sudo as a confined sysadm user doesn't work, usually most command executed as shown below:

$ sudo <program> <args...>

e.g.

$ sudo passwd

The root cause are missing contexts or transitions from "sysadm_sudo_t" (context of "sudo") to appropriate context (e.g. "passwd_t" through "passwd_exec_t" file).
With time, engineering comes up with adding more rules for domains, but since customers use very customized configuration, the policy is always late.

Last reported issue is with "passwd" when using cracklib database:
When executing "sudo passwd", the cracklib database cannot be read because "passwd" command executes in the context of "sudo" (sysadm_sudo_t) instead of "passwd (passwd_t").

As shown in the example below:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
type=PROCTITLE ... : proctitle=passwd <USERNAME> 
type=PATH ... : item=0 name=/usr/share/cracklib/pw_dict.pwd.gz ... mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:crack_db_t:s0 ...
type=SYSCALL ... : arch=x86_64 syscall=open success=no exit=EACCES(Permission denied) a0=0x7ffde70cf450 a1=O_RDONLY ... uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root ... comm=passwd exe=/usr/bin/passwd subj=sysadm_u:sysadm_r:sysadm_sudo_t:s0-s0:c0.c1023 ...
type=AVC ... : avc:  denied  { read } for  pid=13672 comm=passwd name=pw_dict.pwd.gz ... scontext=sysadm_u:sysadm_r:sysadm_sudo_t:s0-s0:c0.c1023 tcontext=system_u:object_r:crack_d _t:s0 tclass=file permissive=0
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

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

RHEL8.3 policy, RHEL7.9 policy


How reproducible:

Always when using crack library.

Additional info:

We need to fix the policy again and again.
Note that I filed a RFE against sudo to always use the "SELinux aware" code: BZ #1910077
Implementing this RFE would solve **ALL** "sudo <command>" issues.

Comment 1 Zdenek Pytela 2021-12-22 12:40:24 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/976

Comment 2 Zdenek Pytela 2021-12-23 16:48:21 UTC
To backport:
commit 3b826a9f34d86388fde3a07a9dcfeccdc762bafe
Author: Zdenek Pytela <zpytela>
Date:   Mon Dec 20 11:47:29 2021 +0100

    Allow sudodomains execute passwd in the passwd domain

    When an unprivileged user in the sysadm_r role executes passwd
    through sudo, it transitions into sysadm_sudo_t domain by default.
    With this commit, the process transitions back to sysadm_t.

    Resolves: rhbz#1943572

Comment 9 errata-xmlrpc 2022-05-10 15:14:58 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-2022:1995


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