Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2121084

Summary: SELinux is preventing snmpd from sys_ptrace access on the cap_userns labeled snmpd_t.
Product: Red Hat Enterprise Linux 8 Reporter: Alex Stupnikov <astupnik>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.2CC: lvrabec, mmalik, rmetrich
Target Milestone: rcKeywords: AutoVerified, Triaged
Target Release: 8.8Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.14.3-109.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-16 09:03:52 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 Alex Stupnikov 2022-08-24 12:25:43 UTC
Description of problem:

We isolated problem [1] in customer's RHOSP 16.1 (based on RHEL 8.2) deployment when we tried to analyze SELinux status. 

I was able to find Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=1713898, but it looks like fix wasn't backported to RHEL 8 yet, with RHEL 8.6 policy, the rule is not there either:

# sesearch -A -s snmpd_t -c cap_userns -p sys_ptrace

Commit that seem to address this problem:
commit adc572faae590e87ef91f8ba3ee8e99f92a531ea
Author: Lukas Vrabec <lvrabec>
Date:   Tue Nov 26 14:50:46 2019 +0100

    Allow snmpd_t domain to trace processes in user namespace
    
    Resolves: rhbz#1713898


I understand that it is hard to justify backport to RHEL 8.2, but would be great to have this fix in RHEL 8.4 (many RHOSP users will rely on RHEL 8.4 for a while).


[1]
SELinux is preventing snmpd from sys_ptrace access on the cap_userns labeled snmpd_t.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that snmpd should be allowed sys_ptrace access on cap_userns labeled snmpd_t by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'snmpd' --raw | audit2allow -M my-snmpd
# semodule -X 300 -i my-snmpd.pp


Additional Information:
Source Context                system_u:system_r:snmpd_t:s0
Target Context                system_u:system_r:snmpd_t:s0
Target Objects                Unknown [ cap_userns ]
Source                        snmpd
Source Path                   snmpd
Port                          <Unknown>
Host                          hostname
Source RPM Packages
Target RPM Packages
Policy RPM                    selinux-policy-3.14.3-41.el8_2.9.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     hostname
Platform                      Linux hostname
                              4.18.0-193.65.2.el8_2.x86_64 #1 SMP Mon Aug 30
                              04:52:32 EDT 2021 x86_64 x86_64
Alert Count                   32
First Seen                    2022-03-21 19:25:06 UTC
Last Seen                     2022-08-21 13:45:31 UTC
Local ID                      e12d319f-0335-4a96-8d64-33bd0e2d7a2d

Raw Audit Messages
type=AVC msg=audit(1661089531.866:11152269): avc:  denied  { sys_ptrace } for  pid=4356 comm="snmpd" capability=19  scontext=system_u:system_r:snmpd_t:s0 tcontext=system_u:system_r:snmpd_t:s0 tclass=cap_userns permissive=1


Hash: snmpd,snmpd_t,snmpd_t,cap_userns,sys_ptrace

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

Comment 1 Zdenek Pytela 2022-08-26 09:01:51 UTC
Alex,

This bz currently targets RHEL 8.8. If you need a backport to older releases, please follow you organization workflow to request it and add justification.

The following module can be use to check if the fix is sufficient:

  # cat local_snmpd_userns_ptrace.cil
(allow snmpd_t snmpd_t (cap_userns (sys_ptrace)))
  # semodule -i local_snmpd_userns_ptrace.cil

and then
  # semodule -r local_snmpd_userns_ptrace
to remove it.

Comment 2 Zdenek Pytela 2022-08-26 09:07:19 UTC
It seems EUS for 8.2 ended 2022-04-30, so there are these options:

8.4 2023-05-31
8.6 2024-05-31

https://access.redhat.com/support/policy/updates/errata

Comment 3 Alex Stupnikov 2022-08-26 09:16:17 UTC
Thank you very much, Zdenek. I will evaluate business process and will follow it if this bug will fit requirements.

Comment 13 errata-xmlrpc 2023-05-16 09:03:52 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:2965