Bug 1766653

Summary: enabled repositories upload fails with not subscribed error, when run as non-root user.
Product: Red Hat Satellite Reporter: Jason Dickerson <jdickers>
Component: katello-agentAssignee: Lucy Fu <lufu>
Status: CLOSED ERRATA QA Contact: sganar
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: lufu, pcreech, sganar, vijsingh, zhunting
Target Milestone: 6.11.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: katello-host-tools-3.5.6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-05 13:27:14 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 Jason Dickerson 2019-10-29 15:20:32 UTC
Description of problem:
The enabled repositories plugin cannot run as a non-root user.  however, it displays the following error, indicating the server is no longer subscribed to Satellite:

[provisioner@sirtgpu01 ~]$ yum search htop
Loaded plugins: enabled_repos_upload, package_upload, product-id, search-disabled-repos, subscription-manager
============================================================================================= N/S matched: htop ==============================================================================================
htop.x86_64 : Interactive process viewer

  Name and summary matches only, use "search all" for everything.
Uploading Enabled Repositories Report
2019-10-29 09:21:44,038 [INFO] yum:240513:Dummy-1 @connection.py:905 - Connection built: host=sirt-satellite01.homeoffice.wal-mart.com port=443 handler=/rhsm auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
Loaded plugins: product-id, subscription-manager
2019-10-29 09:21:44,046 [WARNING] yum:240513:Dummy-1 @logutil.py:142 - logging already initialized
Cannot upload enabled repos report, is this client registered?
[provisioner@sirtgpu01 ~]$


Version-Release number of selected component (if applicable):
Latest Client tools provided with Sat 6.6


How reproducible:
completely


Steps to Reproduce:
1.Run a yum command as a non root user
2.
3.

Actual results:

You get the error


Expected results:
The plugin checks if it is running as root or not, and you either get a warning you are a non-root user, or it logs the warning silently.  


Additional info:
This creates confusion when non-root users run yum commands.  This could be avoided with better messaging or security context awareness.

Comment 3 Lucy Fu 2021-06-07 17:58:11 UTC
Created redmine issue https://projects.theforeman.org/issues/32744 from this bug

Comment 4 Maria 2021-08-26 10:01:38 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32744 has been resolved.

Comment 7 sganar 2022-05-19 07:50:31 UTC
Verified.

Tested on Satellite 6.11.0 Snap 20.0

Steps followed: 
1. Run a yum command as a non root user

Observation: 
A proper message is displayed saying "you are not logged in as root"

```$ yum search curl
Loaded plugins: enabled_repos_upload, package_upload, product-id, search-disabled-repos, subscription-manager
=================================================================================================================================== N/S matched: curl ====================================================================================================================================
python-pycurl.x86_64 : A Python interface to libcurl
curl.x86_64 : A utility for getting files from remote servers (FTP, HTTP, and others)
libcurl.x86_64 : A library for getting files from web servers

  Name and summary matches only, use "search all" for everything.
Skipping Enabled Repositories Upload because you are not logged in as root```

Comment 10 errata-xmlrpc 2022-07-05 13:27:14 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 (Satellite 6 Satellite Client Release), 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-2022:5497