Bug 1324132 - unexpected error and a traceback when uploaded content cert is not RH one
Summary: unexpected error and a traceback when uploaded content cert is not RH one
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Update Infrastructure for Cloud Providers
Classification: Red Hat
Component: Tools
Version: 3.0.0
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: ---
Assignee: RHUI Bug List
QA Contact: Vratislav Hutsky
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-05 15:08 UTC by Irina Gulina
Modified: 2018-07-09 07:33 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-07-09 07:33:35 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Irina Gulina 2016-04-05 15:08:26 UTC
Description of problem:

unexpected error and a traceback when the uploaded content cert is odd 

Version-Release number of selected component (if applicable):
>> rpm -qa *rhui*
rhui-installer-base-0.0.24-1.el7ui.noarch
rh-rhui-tools-libs-pre.3.0.16-1.el7ui.noarch
rhui-installer-0.0.24-1.el7ui.noarch
rh-rhui-tools-pre.3.0.16-1.el7ui.noarch
rhui-default-ca-1.0-1.noarch
rh-amazon-rhui-client-2.2.118-1.el7.noarch
rh-amazon-rhui-client-rhs30-2.2.124-1.el7.noarch

RHUI iso 20151013

How reproducible:
always

Steps to Reproduce:
1. touch /tmp/odd_cert.pem
2. in rhui-manager: 'n' to go to 'Entitlements Manager' screen
3. 'u'  upload a new or updated Red Hat content certificate
4. rhui (entitlements) => u

Full path to the new content certificate:
/tmp/odd_cert.pem

The RHUI will be updated with the following certificate:
  /tmp/odd_cert.pem

Proceed? (y/n) y

Actual results:

An unexpected error has occurred during the last operation.
More information can be found in /root/.rhui/rhui.log.

>> less /root/.rhui/rhui.log
2016-04-05 09:40:07,381 - Unexpected error caught at the shell level
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/rhui/tools/shell.py", line 88, in safe_listen
    self.listen(clear=first_run)
  File "/usr/lib/python2.7/site-packages/rhui/tools/shell.py", line 122, in listen
    Shell.listen(self)
  File "/usr/lib/python2.7/site-packages/rhui/common/shell.py", line 186, in listen
    item.func(*args, **item.kwargs)
  File "/usr/lib/python2.7/site-packages/rhui/tools/screens/entitlements.py", line 104, in new_certificate
    self.cert_manager.add_certificate(cert_filename)
  File "/usr/lib/python2.7/site-packages/rhui/tools/cert_manager.py", line 273, in add_certificate
    entitlements = cert_utils.entitlements_in_cert(cert_filename)
  File "/usr/lib/python2.7/site-packages/rhui/common/cert_utils.py", line 125, in entitlements_in_cert
    cert = create_from_file(cert_filename)
  File "/usr/lib/python2.7/site-packages/rhui/common/cert_utils.py", line 86, in create_from_file
    return Modified_CertFactory().create_from_file(path)
  File "/usr/lib64/python2.7/site-packages/rhsm/certificate2.py", line 66, in create_from_file
    return self._read_x509(_certificate.load(path), path, pem)
  File "/usr/lib64/python2.7/site-packages/rhsm/certificate2.py", line 78, in _read_x509
    raise CertificateException("Error loading certificate")
CertificateException: Error loading certificate


Expected results:

A message: "Red Hat content certificate is not valid" or similar

Comment 4 Radek Bíba 2018-07-09 06:08:46 UTC
I can't reproduce this with a random pem file or an empty file:

1 - GeoTrustGlobalCA.pem comes from rubygems has nothing to do with Red Hat:

# rhui-manager cert upload --cert /tmp/GeoTrustGlobalCA.pem 
The given certificate does not contain any entitlements that
are compatible with the RHUI. For questions, please visit:
https://access.redhat.com/support/contact/customerService.html

2 - empty.pem is an empty file:

# rhui-manager cert upload --cert /tmp/empty.pem
The certificate or certificate and key combination does not appear to be valid

I suggest we close this bug (currentrelease) unless you have a pem file that still causes rhui-manager to crash.

Comment 5 Irina Gulina 2018-07-09 07:18:41 UTC
Maybe it was fixed at some moment. Yes, close. Thanks

Comment 6 Radek Bíba 2018-07-09 07:33:35 UTC
Yes, 3.0.4 has improved the way certificate uploads are handled. I can reproduce a similar (not the same) crash with GeoTrustGlobalCA.pem on 3.0.3:

# rhui-manager cert upload --cert /tmp/GeoTrustGlobalCA.pem 

An unexpected error has occurred during the last operation.

'NoneType' object has no attribute 'id'

OK, closing as currentrelease since 3.0.4 can handle this kind of pem file better. As for an empty file, I get the same error message in 3.0.3 and 3.0.4.


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