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 1846825

Summary: message "Invalid credentials" should display when query service level to another server
Product: Red Hat Enterprise Linux 7 Reporter: yanpliu <yanpliu>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED WONTFIX QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: low    
Version: 7.9CC: jsefler, redakkan
Target Milestone: rcKeywords: Reopened, Triaged
Target Release: ---Flags: pm-rhel: mirror+
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: 2021-12-13 14:56: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 yanpliu 2020-06-15 01:31:39 UTC
Description of problem:
 message "Invalid credentials" should display when query service level to another server

Version-Release number of selected component (if applicable):
subscription-manager-1.24.40-1.el7.x86_64
subscription-manager-cockpit-1.24.40-1.el7.noarch
subscription-manager-rhsm-1.24.40-1.el7.x86_64
subscription-manager-rhsm-certificates-1.24.40-1.el7.x86_64
tfm-rubygem-katello-3.14.0.21-1.el7sat.noarch
katello-3.14.0-6.el7sat.noarch
candlepin-2.9.25-1.el7sat.noarch

Satellite:Satellite6.6.3
RHEL Build:RHEL-7.9-20200609.0



How reproducible:
100%

Steps to Reproduce:
1.Register RHEL7.9 to Satellite6.6
# subscription-manager register --username=admin --password=admin
Registering to: hpe-nehalem-02.hpe2.lab.eng.bos.redhat.com:443/rhsm
The system has been registered with ID: 030ba154-84a4-4ea3-99ee-8b8f52d7382c
The registered system name is: cloud-qe-16-vm-12.idmqe.lab.eng.bos.redhat.com


2. set serverurl  After that it should display message "Invalid credentials"
# subscription-manager service-level --serverurl subscription.rhn.redhat.com:443/subscription


rhsm-integrate: INFO: <<<Return Code: 1
rhsm-integrate: INFO: <<<Output:
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 9, in <module>
    load_entry_point('subscription-manager==1.24.34', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 86, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 3029, in main
    ret = CLI.main(self)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 544, in main
    return_code = self._do_command()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1156, in _do_command
    self.show_service_level()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1188, in show_service_level
    consumer = self.cp.getConsumer(self.identity.uuid)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 1195, in getConsumer
    return self.conn.request_get(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 726, in request_get
    return self._request("GET", method, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 752, in _request
    info=info, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 627, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 713, in validateResponse
    raise NetworkException(response['status'])
rhsm.connection.NetworkException: HTTP error (400 - Bad Request)

Actual results:
message "Invalid credentials" has not displayed when query service level to another server

Expected results:
message "Invalid credentials" should display  when query service level to another server

Additional info:

Comment 2 Shwetha Kallesh 2020-06-15 10:28:59 UTC
Cannot reproduce the issue.. I see Invalid Credentials message and traceback in rhsm.log

[root@kvm-01-guest18 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.9.27-1
subscription management rules: 5.39
subscription-manager: 1.24.40-1.el7

[root@kvm-01-guest18 ~]# subscription-manager register --serverurl subscription.rhsm.stage.redhat.com
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_auto_syspurpose001
Password: 
The system has been registered with ID: 461d7d0f-d08a-421d-a353-8af8c9cf7985
The registered system name is: kvm-01-guest18.rhts.eng.tlv.redhat.com
[root@kvm-01-guest18 ~]# subscription-manager service-level --serverurl subscription.rhn.redhat.com:443/subscription
Invalid credentials.


2020-06-15 13:27:24,181 [ERROR] subscription-manager:19423:MainThread @managercli.py:1163 - HTTP error (401 - Unauthorized): Invalid credentials.
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1157, in _do_command
    self.show_service_level()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1189, in show_service_level
    consumer = self.cp.getConsumer(self.identity.uuid)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 1195, in getConsumer
    return self.conn.request_get(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 726, in request_get
    return self._request("GET", method, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 752, in _request
    info=info, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 627, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 689, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: HTTP error (401 - Unauthorized): Invalid credentials.
2020-06-15 13:27:24,183 [ERROR] subscription-manager:19423:MainThread @managercli.py:1164 - Error: Unable to retrieve service levels: HTTP error (401 - Unauthorized): Invalid credentials.

Comment 3 Shwetha Kallesh 2020-06-15 14:32:06 UTC
I can actually reproduce when I register to standalone candlepin and use hosted candlepin url for the --serverurl


[root@kvm-01-guest18 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.9.27-1
subscription management rules: 5.39
subscription-manager: 1.24.40-1.el7

[root@kvm-01-guest18 ~]# subscription-manager register --serverurl shwetha-workstation.usersys.redhat.com:8443/candlepin
Registering to: shwetha-workstation.usersys.redhat.com:8443/candlepin
Username: admin
Password: 
Hint: User "admin" is member of following organizations: donaldduck, admin, snowwhite
Organization: admin
The system has been registered with ID: 01d4d8a2-dc5e-4746-b847-9f8d98314252
The registered system name is: kvm-01-guest18.rhts.eng.tlv.redhat.com
[root@kvm-01-guest18 ~]# subscription-manager register --serverurl shwetha-workstation.usersys.redhat.com:8443/candlepin
This system is already registered. Use --force to override
[root@kvm-01-guest18 ~]# subscription-manager service-level --serverurl subscription.rhn.redhat.com:443/subscription
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 9, in <module>
    load_entry_point('subscription-manager==1.24.40', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 86, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 3041, in main
    ret = CLI.main(self)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 545, in main
    return_code = self._do_command()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1157, in _do_command
    self.show_service_level()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1189, in show_service_level
    consumer = self.cp.getConsumer(self.identity.uuid)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 1195, in getConsumer
    return self.conn.request_get(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 726, in request_get
    return self._request("GET", method, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 752, in _request
    info=info, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 627, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 713, in validateResponse
    raise NetworkException(response['status'])
rhsm.connection.NetworkException: HTTP error (400 - Bad Request)

Comment 4 Rehana 2020-06-16 14:08:01 UTC
Hi , 

Thanks for opening the bug. Based on our review this appears to be a corner case with no supporting actual use cases in trying to list a service-level on a different host after registering. 

Hence closing this bug as wont fix. 

thanks,
Rehana

Comment 5 yanpliu 2020-06-19 08:54:41 UTC
Hello Rehaha,
Thanks for your reply.
For register to production CDN, the server is stable, the scenario may not use often.
For the subscription-manager register against satellite server, it is not a corner case. Because, for customs, there are may several satellite servers, it can register to different host often.

Thanks
Yanping Liu

Comment 10 Rehana 2021-12-13 14:56:08 UTC
Bugzilla backlog review : 
=========================
We have reviewed this request and this scenario was discussed during the design discussion of new "subscription-manager syspurpose" module. Based on the review we are only allowing the usage of username, password  and serverurl on unregistered systems .

Hence closing the bug .