Bug 1129480 - subscription-manager register --activationkey fails to provide authentication to /owner/$id/environments
Summary: subscription-manager register --activationkey fails to provide authentication...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Bryan Kearney
QA Contact: John Sefler
URL:
Whiteboard:
: 1129454 (view as bug list)
Depends On:
Blocks: rhsm-rhel66 1129454
TreeView+ depends on / blocked
 
Reported: 2014-08-12 21:02 UTC by Tom McKay
Modified: 2014-10-14 07:48 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: subscription-manager inspecting environments url when activation key given Consequence: subscription-manager fails to provide authentication to environments. Fix: Do not inspect environments when activation key is given. Result: Using activation key with subscription-manager will properly execute the activation key sequence.
Clone Of:
Environment:
Last Closed: 2014-10-14 07:48:18 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1384 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2014-10-14 01:27:50 UTC

Description Tom McKay 2014-08-12 21:02:06 UTC
Description of problem:

RHEL 6.6 beta subscription-manager-1.12.10-1.el6.x86_64 

subscription-manager register --org ACME --activationkey ak-test

hits /owner/$id/environments w/o credentials


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Justin Sherrill 2014-08-12 21:08:50 UTC
note that sub-man should not even hit /owner/$id/environments when using an activation key

Comment 4 Carter Kozak 2014-08-15 13:26:42 UTC
commit 55bce8772ec6917d9174f50687ccc817953c4e75
Author: ckozak <ckozak@redhat.com>
Date:   Tue Aug 12 10:48:08 2014 -0400

    1129480: don't query envs when actkey is given

Comment 6 John Sefler 2014-09-09 15:48:41 UTC
Reproducing the failure with version (and rhsm.conf properly configured to connect to a Satellite 6 server)....
[root@jsefler-6 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 1.5.0-30.el6sat-Katello
subscription management rules: 5.11
subscription-manager: 1.12.10-1.el6
python-rhsm: 1.12.5-1.el6


[root@jsefler-6 ~]# subscription-manager register --org="Default_Organization" --activationkey="ak-rhel-6-x86_64"
[root@jsefler-6 ~]# 

^^ FAILURE: expected feedback stating a successful registration and attached subscriptions from the valid org and activationkey


[root@jsefler-6 ~]# tail -f /var/log/rhsm/rhsm.log 
2014-09-09 11:42:12,218 [DEBUG] subscription-manager @connection.py:414 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-stage.pem, redhat-uep.pem, candlepin-local.pem, katello-server-ca.pem, jsefler-f14-candlepin.pem
2014-09-09 11:42:12,219 [DEBUG] subscription-manager @connection.py:446 - Making request: GET /rhsm/owners/Default_Organization/environments
2014-09-09 11:42:12,328 [DEBUG] subscription-manager @connection.py:469 - Response: status=401
2014-09-09 11:42:12,332 [ERROR] subscription-manager @managercli.py:1049 - 
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1038, in _do_command
    self.options.environment)
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1133, in _get_environment_id
    env_list = cp.getEnvironmentList(owner_key)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 1095, in getEnvironmentList
    results = self.conn.request_get(method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 550, in request_get
    return self._request("GET", method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 478, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 520, in validateResponse
    raise RestlibException(response['status'], error_msg)
RestlibException


CONFIRMED: The original failure is reproducable


Now let's verify the fix in the next comment with a corrected version of subscription-manager package...

Comment 7 John Sefler 2014-09-09 16:06:41 UTC
Verifying Version...
[root@jsefler-6 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 1.5.0-30.el6sat-Katello
subscription management rules: 5.11
subscription-manager: 1.12.14-5.el6
python-rhsm: 1.12.5-1.el6


[root@jsefler-6 ~]# subscription-manager register --org="Default_Organization" --activationkey="ak-rhel-6-x86_64"
The system has been registered with ID: ed20d688-9f31-42f0-8c97-2424ebb1b259 
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@jsefler-6 ~]# subscription-manager identity
system identity: ed20d688-9f31-42f0-8c97-2424ebb1b259
name: jsefler-6.usersys.redhat.com
org name: Default_Organization
org ID: Default_Organization
environment name: DEV/RHEL_6_x86_64

[root@jsefler-6 ~]# subscription-manager list --consumed | grep "Subscription Name:"
Subscription Name: Red Hat Employee Subscription
Subscription Name: Agent
Subscription Name: Forge


NOTE: The three subscriptions attached came from the activationkey that was created during the setup of the Satellite 6 server (details not shown).


VERIFIED: register with activationkey successfully attaches expected subscription from the activation key and registers to the expected org and environment.

Comment 8 John Sefler 2014-09-09 16:12:23 UTC
Additional Sanity Testing....
Let's also verify that we can still register to the org and environment without the activationkey...

[root@jsefler-6 ~]# subscription-manager unregister
System has been unregistered.
[root@jsefler-6 ~]# subscription-manager register
Username: admin
Password: 
Environment: DEV/RHEL_6_x86_64
The system has been registered with ID: 6824827c-8e7b-441b-b7d9-7e50094c8de6 
[root@jsefler-6 ~]# 
[root@jsefler-6 ~]# subscription-manager identity
system identity: 6824827c-8e7b-441b-b7d9-7e50094c8de6
name: jsefler-6.usersys.redhat.com
org name: Default_Organization
org ID: Default_Organization
environment name: DEV/RHEL_6_x86_64
[root@jsefler-6 ~]# 


VERIFIED: Notice that we were not prompted for an org (because there is only one) while we were prompted for an environment (because there are more than one).

[root@jsefler-6 ~]# subscription-manager orgs
Username: admin
Password: 
+-------------------------------------------+
          admin Organizations
+-------------------------------------------+

Name: Default_Organization
Key:  Default_Organization

[root@jsefler-6 ~]# subscription-manager environments 
Username: admin
Password: 
Organization: Default_Organization
+-------------------------------------------+
          Environments
+-------------------------------------------+
Name:        DEV/RHEL_7_x86_64
Description: 

Name:        Library/RHEL_7_x86_64
Description: 

Name:        DEV/RHEL_6_i386
Description: 

Name:        Library/RHEL_6_i386
Description: 

Name:        DEV/RHEL_6_x86_64
Description: 

Name:        Library/RHEL_6_x86_64
Description: 

Name:        Library
Description: 

[root@jsefler-6 ~]#

Comment 9 John Sefler 2014-09-09 17:04:04 UTC
*** Bug 1129454 has been marked as a duplicate of this bug. ***

Comment 11 errata-xmlrpc 2014-10-14 07:48:18 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, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1384.html


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