Bug 2112729 - Confined SELinux user 'staff_u' cannot run probes from scap-workbench if privilege escalation performed by polkit
Summary: Confined SELinux user 'staff_u' cannot run probes from scap-workbench if priv...
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: selinux-policy
Version: unspecified
Hardware: Unspecified
OS: Linux
low
low
Target Milestone: rc
: 9.3
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-01 01:28 UTC by Daniel Reynolds
Modified: 2023-07-11 07:59 UTC (History)
3 users (show)

Fixed In Version: selinux-policy-38.1.16-1.el9
Doc Type: Bug Fix
Doc Text:
Cause: selinux-policy does not contain rules required for the staff confined user be able to run scap-workbench Consequence: scap-workbench probes fail when run by the confined SELinux user staff_u. Fix: Required rules were added to selinux-policy. Result: scap-workbench runs successfully by the confined SELinux user staff_u.
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-129738 0 None None None 2022-08-01 01:46:51 UTC

Description Daniel Reynolds 2022-08-01 01:28:45 UTC
1. Proposed title of this feature request

polkit SELinux transitions

2. Who is the customer behind the request?

Account: 1158984 - BAE Systems Australia Ltd
TAM customer: no
CSM customer: no
Strategic: no

3. What is the nature and description of the request?

When running a system that confines users to SELinux user staff_u, users performing probes from scap-workbench cause many AVC errors and probe fails.

4. Why does the customer need this? (List the business requirements here)

To allow constrained 'staff_u' users to run probes from SCAP-workbench

5. How would the customer like to achieve this? (List the functional requirements here)

Request is to provide a method for scap-workbench to perform probes by a constrained user staff_u by either:
- Allow polkit to change SELinux context of new processes.
- Introduce new SELinux domains for oscap and scap-workbench that allow constrained user staff_u to run probes.

6. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.

a. Set up a SELinux constrained user 'staff_u'.
b. Configure user to be an administrator (e.g. member of wheel).
c. Install SCAP-workbench.
d. Successfully run SCAP-workbench from menu, authenticate via polkit, and run a probe on local system without SELinux denials.

7. Is there already an existing RFE upstream or in Red Hat Bugzilla?

No

8. Does the customer have any specific timeline dependencies and which release would they like to target (i.e. RHEL8, RHEL9)?

No

9. Is the sales team involved in this request and do they have any additional input?

No

10. List any affected packages or components.

scap-workbench,
selinux-policy
polkit

11. Would the customer be able to assist in testing this functionality if implemented?

Yes

Comment 1 Zdenek Pytela 2022-08-05 19:09:25 UTC
Daniel,

Can you describe which instructions were followed to get to this setup?

From SELinux perspective the problem is that a Linux user in the staff_r role is a SELinux confined user, while a SELinux confined administrator rather has the sysadm_r role (and a few dedicated ones which probably do not apply here).

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/using_selinux/managing-confined-and-unconfined-users_using-selinux

Comment 2 Daniel Reynolds 2022-08-08 03:57:20 UTC
Hello Zdenek

Re

> Can you describe which instructions were followed to get to this setup?

1. Cu has started to migrate users to staff_u.

2. To run administrative commands they use the following configuration

    Users assigned to 'wheel' group.

    The following configuration in /etc/sudoers to allow the transition; staff_r -> sysadm_t.
    ~~~
    %wheel_sysadm  ALL=(ALL) ROLE=sysadm_r TYPE=sysadm_r   ALL
    ~~~

3. Works for most administrative functions.

4. Using scap-workbench from GUI.

    scap-workbench does not use 'sudo' for privilege escalation to root, uses polkit.

    polkit does not perform transition from staff_r -> sysadm_r.

    polkit probe runs as staff_r instead of sysadm_r.  Most of the probe fails with AVC denials despite running as root.

5. As a work around, user is running scap-workbench via sudo.


Regards.

Comment 3 Daniel Reynolds 2022-08-08 03:58:39 UTC
Correction to above

/etc/sudoers configuration is as follows

~~~
%wheel_sysadm  ALL=(ALL) ROLE=sysadm_r TYPE=sysadm_t   ALL
~~~

Comment 4 Nikola Knazekova 2022-09-02 06:00:59 UTC
Hi Daniel,

can you please attach AVC messages? 

Thanks

Nikola

Comment 10 Daniel Reynolds 2022-09-09 04:37:06 UTC
Supplied AVC as requested.  See above.

Comment 27 Nikola Knazekova 2023-06-14 14:22:51 UTC
PR: https://github.com/fedora-selinux/selinux-policy/pull/1708

Comment 29 Zdenek Pytela 2023-06-23 09:33:57 UTC
Commit to bckport:
3d4190dbd (HEAD -> rawhide, upstream/rawhide) Add list_dir_perms to kerberos_read_keytab


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