Bug 2224737 - SELinux is preventing /usr/bin/python3.9 from 'unlink' accesses on the file /insights-redhatWS.local-20230721232748.tar.gz.
Summary: SELinux is preventing /usr/bin/python3.9 from 'unlink' accesses on the file /...
Keywords:
Status: MODIFIED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: selinux-policy
Version: 9.2
Hardware: x86_64
OS: Linux
medium
unspecified
Target Milestone: rc
: ---
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-22 15:21 UTC by AllenF
Modified: 2023-08-17 15:20 UTC (History)
4 users (show)

Fixed In Version: selinux-policy-38.1.21-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github fedora-selinux selinux-policy pull 1834 0 None open Insights update 2 2023-08-11 14:54:45 UTC
Red Hat Issue Tracker RHELPLAN-163014 0 None None None 2023-07-22 15:21:32 UTC

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


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