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 2224737

Summary: SELinux is preventing /usr/bin/python3.9 from 'unlink' accesses on the file /insights-redhatWS.local-20230721232748.tar.gz.
Product: Red Hat Enterprise Linux 9 Reporter: AllenF <dafrady>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 9.2CC: lvrabec, mmalik, zpytela
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-38.1.21-1.el9 Doc Type: Bug Fix
Doc Text:
Permissions for insights-client added to the SELinux policy Cause: The insights-client service requires permissions which were not in the previous selinux-policy versions. Consequence: As a consequence, some components of insights-client did not work correctly and reported access vector cache (AVC) error messages. Fix: This update adds new permissions to the SELinux policy. Result: As a result, insights-client runs correctly without reporting AVC errors. Resolves: 2190178 2207894 2214581 2224737
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:52:40 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 AllenF 2023-07-22 15:21:00 UTC
Description of problem:

SELinux is preventing /usr/bin/python3.9 from 'unlink' accesses on the file /insights-redhatWS.local-20230721232748.tar.gz.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/insights-redhatWS.local-20230721232748.tar.gz default label should be etc_runtime_t.
Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Do
# /sbin/restorecon -v /insights-redhatWS.local-20230721232748.tar.gz

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that python3.9 should be allowed unlink access on the insights-redhatWS.local-20230721232748.tar.gz file 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 'platform-python' --raw | audit2allow -M my-platformpython
# semodule -X 300 -i my-platformpython.pp

Additional Information:
Source Context                system_u:system_r:insights_client_t:s0
Target Context                unconfined_u:object_r:user_tmp_t:s0
Target Objects                /insights-redhatWS.local-20230721232748.tar.gz [
                              file ]
Source                        platform-python
Source Path                   /usr/bin/python3.9
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           python3-3.9.16-1.el9_2.1.x86_64
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-38.1.11-2.el9_2.3.noarch
Local Policy RPM              selinux-policy-targeted-38.1.11-2.el9_2.3.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.14.0-284.18.1.el9_2.x86_64 #1
                              SMP PREEMPT_DYNAMIC Wed May 31 10:39:18 EDT 2023
                              x86_64 x86_64
Alert Count                   1
First Seen                    2023-07-22 10:05:15 CDT
Last Seen                     2023-07-22 10:05:15 CDT
Local ID                      fcb63b67-1ea1-4c81-8c9a-b124f5712e3c

Raw Audit Messages
type=AVC msg=audit(1690038315.47:95883): avc:  denied  { unlink } for  pid=128561 comm="platform-python" name="insights-redhatWS.local-20230721232748.tar.gz" dev="nvme0n1p3" ino=538517710 scontext=system_u:system_r:insights_client_t:s0 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=file permissive=1


type=SYSCALL msg=audit(1690038315.47:95883): arch=x86_64 syscall=unlinkat success=yes exit=0 a0=4 a1=7f237dfdec30 a2=0 a3=7f238dc2fb20 items=2 ppid=127570 pid=128561 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=platform-python exe=/usr/bin/python3.9 subj=system_u:system_r:insights_client_t:s0 key=(null)

type=CWD msg=audit(1690038315.47:95883): cwd=/

type=PATH msg=audit(1690038315.47:95883): item=0 name=/ inode=538517751 dev=103:03 mode=040700 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_tmp_t:s0 nametype=PARENT cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0

type=PATH msg=audit(1690038315.47:95883): item=1 name=insights-redhatWS.local-20230721232748.tar.gz inode=538517710 dev=103:03 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_tmp_t:s0 nametype=DELETE cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0

Hash: platform-python,insights_client_t,user_tmp_t,file,unlink



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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Zdenek Pytela 2023-08-11 16:26:05 UTC
Commit to backport:
f90732410 Allow insights-client manage user temporary files

Comment 10 errata-xmlrpc 2023-11-07 08:52:40 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