Bug 2168923

Summary: insights-client-3.1.7-8 fails to upload data due to AVC denial error for file '.cache.json.asc'
Product: Red Hat Enterprise Linux 8 Reporter: Amar Huchchanavar <ahuchcha>
Component: insights-clientAssignee: Nobody <nobody>
Status: CLOSED DUPLICATE QA Contact: Nobody <nobody>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.7CC: ahumbe, cmarinea, fjansen, link, pakotvan, stomsa
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-03-06 15:52:08 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 Amar Huchchanavar 2023-02-10 15:06:28 UTC
Description of problem:

insights-client.service goes in to failed state due to SELinux denial for file /etc/insights-client/.cache.json.asc, this issue causes stale entries on the portal and system gets removed after 14 days of inactivity.

#less installed-rpms |grep insights 
insights-client-3.1.7-8.el8.noarch                          Sat Nov 19 08:54:27 2022

$ grep denied var/log/audit/audit.log |grep insights
type=AVC msg=audit(1674364122.669:71454): avc:  denied  { write } for  pid=622627 comm="platform-python" name="insights-client" dev="dm-2" ino=17301096 scontext=system_u:system_r:insights_client_t:s0 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=dir permissive=0
type=AVC msg=audit(1674364123.082:71455): avc:  denied  { write } for  pid=622627 comm="platform-python" name=".cache.json.asc" dev="dm-0" ino=134304839 scontext=system_u:system_r:insights_client_t:s0 tcontext=unconfined_u:object_r:insights_client_etc_t:s0 tclass=file permissive=0
type=AVC msg=audit(1674364125.084:71456): avc:  denied  { write } for  pid=622635 comm="platform-python" name="insights-client" dev="dm-2" ino=17301096 scontext=system_u:system_r:insights_client_t:s0 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=dir permissive=0
.
.
type=AVC msg=audit(1674710083.270:79394): avc:  denied  { write } for  pid=667163 comm="platform-python" name=".cache.json.asc" dev="dm-0" ino=134304839 scontext=system_u:system_r:insights_client_t:s0 tcontext=unconfined_u:object_r:insights_client_etc_t:s0 tclass=file permissive=0
type=AVC msg=audit(1674710085.250:79395): avc:  denied  { write } for  pid=667171 comm="platform-python" name="insights-client" dev="dm-2" ino=17301096 scontext=system_u:system_r:insights_client_t:s0 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=dir permissive=0
type=AVC msg=audit(1674710085.593:79396): avc:  denied  { write } for  pid=667171 comm="platform-python" name=".cache.json.asc" dev="dm-0" ino=134304839 scontext=system_u:system_r:insights_client_t:s0 tcontext=unconfined_u:object_r:insi


$ grep insights sos_commands/systemd/systemctl_list-units
  insights-client-results.path                                                                     loaded active waiting   Monitor /etc/insights-client/.lastupload for modifications
* insights-client.service                                                                          loaded failed failed    Insights Client
  insights-client.timer                                                                            loaded active waiting   Insights Client Timer Task


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

  Distro:   [redhat-release] Red Hat Enterprise Linux release 8.7 (Ootpa)
  SELinux:  enforcing  (default enforcing)
  Booted kernel:  4.18.0-425.3.1.el8.x86_64



How reproducible:
Customer Env


Steps to Reproduce:
1. Pkg instlled: insights-client-3.1.7-8.el8.noarch
2. Daily auto uploads failing

Actual results:
insights-client.service fails to upload the latest results to the portal 

Expected results:
Successful upload every day