Bug 735226 - subscription-manager import should fail when there is no key bundled in the import file
subscription-manager import should fail when there is no key bundled in the i...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.2
Unspecified Unspecified
unspecified Severity high
: rc
: ---
Assigned To: Bryan Kearney
John Sefler
:
Depends On:
Blocks: rhsm-rhel62 743047
  Show dependency treegraph
 
Reported: 2011-09-01 16:33 EDT by John Sefler
Modified: 2011-12-06 12:23 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-06 12:23:56 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description John Sefler 2011-09-01 16:33:30 EDT
Description of problem:
Originally, the import function was designed to only import an entitlement cert. Later after the fix for Bug 712980, the import function was redesigned to import a file containing both the entitlement cert and the key concatenated together.  The problem now is that the import function still accepts import files containing only the cert without the key.  The import should be blocked as demonstrated below...


Version-Release number of selected component (if applicable):
[root@jsefler-onprem-62server tmp]# rpm -q subscription-manager
subscription-manager-0.96.8-1.git.0.125eb68.el6.x86_64


Steps to Reproduce:

[root@jsefler-onprem-62server tmp]# rm -f /etc/pki/entitlement/*
[root@jsefler-onprem-62server tmp]# cat /tmp/importEntitlementsDir/8445775706013584472.pem
-----BEGIN CERTIFICATE-----
MIIJajCCCNOgAwIBAgIIdTVsQcmQTFgwDQYJKoZIhvcNAQEFBQAwVzE2MDQGA1UE
AwwtanNlZmxlci1vbnByZW0tNjJjYW5kbGVwaW4udXNlcnN5cy5yZWRoYXQuY29t
MQswCQYDVQQGEwJVUzEQMA4GA1UEBwwHUmFsZWlnaDAeFw0xMTA3MjkwNDAwMDBa
Fw0xMjA5MjgwNDAwMDBaMCsxKTAnBgNVBAMTIDhhOTBmOGM2MzIxZDQ1YWMwM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BBgQSDBAvZm9vL3BhdGgvYWx3YXlzMCYGDCsGAQQBkggJ
AgEBBwQWDBQvZm9vL3BhdGgvYWx3YXlzL2dwZzATBgwrBgEEAZIICQIBAQgEAwwB
MTAVBgwrBgEEAZIICQIBAQkEBQwDMjAwMEcGCisGAQQBkggJBAEEOQw3QXdlc29t
ZSBPUyBCdW5kbGUgZm9yIEEgY29uZmxpY3RpbmcgQXJjaCAoWDg2XzY0L3BwYzY0
KTAwBgorBgEEAZIICQQCBCIMIDhhOTBmOGM2MzIxZDQ1YWMwMTMyMWQ0NzMxYjgw
MjJmMCUGCisGAQQBkggJBAMEFwwVYXdlc29tZW9zLWJuZC1YNjQtcDY0MBIGCisG
AQQBkggJBAkEBAwCMTYwJAYKKwYBBAGSCAkEBgQWDBQyMDExLTA3LTI5VDA0OjAw
OjAwWjAkBgorBgEEAZIICQQHBBYMFDIwMTItMDktMjhUMDQ6MDA6MDBaMBIGCisG
AQQBkggJBAwEBAwCMzAwEgYKKwYBBAGSCAkECgQEDAI1OTAbBgorBgEEAZIICQQN
BA0MCzEyMzMxMTMxMjMxMBEGCisGAQQBkggJBA4EAwwBMDARBgorBgEEAZIICQQL
BAMMATEwNAYKKwYBBAGSCAkFAQQmDCQ3NTUwODMwNS1hZTk3LTRmYzYtODE4My04
NmVkNjE1MzRhNWQwDQYJKoZIhvcNAQEFBQADgYEAJXwuHmrNTVCrZMBpvV8FBh0n
Us3U745qmh16qxXvyGayPxqNpoHhojU5Xt0NHboo67ab4hHQxCdB1nrt54aKDNS8
8yI/xBMAgQCNKb3wLgXHKafrFtRod5he37vgBS/g770tMPcJoWtyJUhUJQxZmAtZ
Wta4GCgdYkDo8XjLBU0=
-----END CERTIFICATE-----

^^^ NOTICE THAT THIS FILE CONTAINS NO KEY
LET'S TRY TO IMPORT IT...

[root@jsefler-onprem-62server tmp]# subscription-manager import --certificate=/tmp/importEntitlementsDir/8445775706013584472.pem
Successfully imported certificate 8445775706013584472.pem

BANG! THAT SHOULD HAVE BEEN BLOCKED WITH A MESSAGE: 8445775706013584472.pem is not a valid certificate file. Please use a valid certificate.

IF WE CONTINUE ON, YOU'LL SEE THAT THE list --consumed IS EMPTY UNTIL THE KEY IS ACTUALLY PRESENT...

[root@jsefler-onprem-62server tmp]# subscription-manager list --consumed
No Consumed subscription pools to list

^^^^ NO CONSUMED SUBSCRIPTIONS?  BUT WE JUST IMPORTED OUR CERTIFICATE. THIS IS WHY I BELIEVE THE IMPORT FILE IS NOT VALID UNTIL THE IMPORT FILE CONTAINS BOTH THE ENTITLEMENT AND KEY.
NOW LET'S MANUALLY COPY THE KEY INTO PLACE...

[root@jsefler-onprem-62server tmp]# cp /tmp/importEntitlementsDir/8445775706013584472-key.pem /etc/pki/entitlement/
[root@jsefler-onprem-62server tmp]# subscription-manager list --consumed
+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+


ProductName:        	Awesome OS for ppc64 Bits
ContractNumber:     	59                       
AccountNumber:      	12331131231              
SerialNumber:       	8445775706013584472      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	07/29/2011               
Expires:            	09/28/2012               

^^^ SEE, THE KEY REALLY IS NEEDED TO LIST THE CONSUMED ENTITLEMENT AN MAKE THE IMPORT FILE VALID
Comment 1 Bryan Kearney 2011-09-02 13:34:53 EDT
Fixed in master:

subscription-manager: c735b3aceba60294f9b7288e34a85d93fbad5079
python-rhsm: 2d53024bcb743faaae9ed8578485fb02b1b43e39
Comment 3 Shwetha Kallesh 2011-09-07 03:08:44 EDT
Moving the bug to verified.

RPM used:
rpm -q subscription-manager
subscription-manager-0.96.8-1.git.18.770d58e.el6.x86_64

Steps to reproduce the same:

subscription-manager import --certificate=/tmp/importEntitlementsDir/7721920600178412967.pem
7721920600178412967.pem is not a valid certificate file. Please use a valid certificate.
Comment 4 errata-xmlrpc 2011-12-06 12:23:56 EST
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-2011-1695.html

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