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 1466445

Summary: pki-server ca-cert-request-find throws an KeyError when instance name is specified.
Product: Red Hat Enterprise Linux 8 Reporter: Amol K <akahat>
Component: pki-coreAssignee: Dinesh Prasanth <dmoluguw>
Status: CLOSED UPSTREAM QA Contact: Asha Akkiangady <aakkiang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: dmoluguw, mharmsen
Target Milestone: rcKeywords: GSSTriaged
Target Release: ---   
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: 2020-03-16 22:28:52 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 Amol K 2017-06-29 15:41:00 UTC
Description of problem:

pki-server ca-cert-request-find ca work if there is default (pki-tomcat) instance is present in the system.

If you try to run it with another instance it will throw an error.

Version-Release number of selected component (if applicable):
PKI Command-Line Interface 10.4.1-10.el7


How reproducible:
always

Steps to Reproduce:
1.pki-server ca-cert-request-find -i topology-02-CA --verbose

2.
3.

Actual results:

Throwing traceback:

Traceback (most recent call last):
  File "/usr/sbin/pki-server", line 112, in <module>
    cli.execute(sys.argv)
  File "/usr/sbin/pki-server", line 104, in execute
    super(PKIServerCLI, self).execute(args)
  File "/usr/lib/python2.7/site-packages/pki/cli/__init__.py", line 204, in execute
    module.execute(module_args)
  File "/usr/lib/python2.7/site-packages/pki/cli/__init__.py", line 204, in execute
    module.execute(module_args)
  File "/usr/lib/python2.7/site-packages/pki/cli/__init__.py", line 204, in execute
    module.execute(module_args)
  File "/usr/lib/python2.7/site-packages/pki/cli/__init__.py", line 204, in execute
    module.execute(module_args)
  File "/usr/lib/python2.7/site-packages/pki/server/cli/ca.py", line 243, in execute
    results = subsystem.find_cert_requests(cert=cert)
  File "/usr/lib/python2.7/site-packages/pki/server/__init__.py", line 443, in find_cert_requests
    requests.append(self.create_request_object(entry))
  File "/usr/lib/python2.7/site-packages/pki/server/__init__.py", line 471, in create_request_object
    request['request'] = attrs['extdata-cert--005frequest'][0]
KeyError: 'extdata-cert--005frequest'
ERROR: 'extdata-cert--005frequest'


Expected results:
Shows the certificate request.

Additional info:

Comment 2 Matthew Harmsen 2017-10-25 16:48:07 UTC
[20171025] - RHEL 7.5 pre-Alpha Offline Triage ==> 7.6

Comment 3 Matthew Harmsen 2018-05-02 23:09:14 UTC
Per RHEL 7.5.z/7.6/8.0 Triage:  7.6

edewata: broken functionality

Comment 4 Matthew Harmsen 2018-07-04 00:25:05 UTC
Moved to RHEL 7.7.

Comment 5 Dinesh Prasanth 2019-07-16 21:53:49 UTC
Hi Amol, this workes for me. Can you check whether this is reproducible?

[root@vm-171-204 dmoluguw]# pki-server ca-cert-request-find -i pki-ca1
------------------
27 entries matched
------------------
  Request ID: 1
  Type: enrollment
  Status: complete

  Request ID: 2
  Type: enrollment
  Status: complete

  Request ID: 3
  Type: enrollment
  Status: complete

<snipped>

[root@vm-171-204 dmoluguw]# rpm -qa | grep pki
pki-base-10.5.16-3.el7.noarch
pki-base-java-10.5.16-3.el7.noarch
pki-server-10.5.16-3.el7.noarch
pki-kra-10.5.16-3.el7.noarch
pki-tools-10.5.16-3.el7.x86_64
pki-ca-10.5.16-3.el7.noarch

Comment 6 Amol K 2019-07-17 07:27:10 UTC
Hi Dinesh,

I'm still able to see the issue with this.

```
# pki-server ca-cert-request-find -i topology-02-CA
ERROR: 'extdata-cert--005frequest'
# pki-server ca-cert-request-find -i topology-02-CA --verbose
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pki/server/pkiserver.py", line 37, in <module>
    cli.execute(sys.argv)
  File "/usr/lib/python3.6/site-packages/pki/server/cli/__init__.py", line 136, in execute
    super(PKIServerCLI, self).execute(args)
  File "/usr/lib/python3.6/site-packages/pki/cli/__init__.py", line 204, in execute
    module.execute(module_args)
  File "/usr/lib/python3.6/site-packages/pki/cli/__init__.py", line 204, in execute
    module.execute(module_args)
  File "/usr/lib/python3.6/site-packages/pki/cli/__init__.py", line 204, in execute
    module.execute(module_args)
  [Previous line repeated 1 more time]
  File "/usr/lib/python3.6/site-packages/pki/server/cli/ca.py", line 247, in execute
    results = subsystem.find_cert_requests(cert=cert)
  File "/usr/lib/python3.6/site-packages/pki/server/subsystem.py", line 904, in find_cert_requests
    requests.append(self.create_request_object(entry))
  File "/usr/lib/python3.6/site-packages/pki/server/subsystem.py", line 933, in create_request_object
    request['request'] = attrs['extdata-cert--005frequest'][0] \
KeyError: 'extdata-cert--005frequest'
ERROR: 'extdata-cert--005frequest'

# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.1 Beta (Ootpa)

# rpm -qa | grep pki-*
pki-server-10.7.1-2.module+el8.1.0+3386+52d02a00.noarch
python3-pki-10.7.1-2.module+el8.1.0+3386+52d02a00.noarch
pki-servlet-4.0-api-9.0.7-16.module+el8.1.0+3366+6dfb954c.noarch
pki-tools-10.7.1-2.module+el8.1.0+3386+52d02a00.x86_64
pki-ca-10.7.1-2.module+el8.1.0+3386+52d02a00.noarch
pki-base-10.7.1-2.module+el8.1.0+3386+52d02a00.noarch
pki-symkey-10.7.1-2.module+el8.1.0+3386+52d02a00.x86_64
pki-base-java-10.7.1-2.module+el8.1.0+3386+52d02a00.noarch
pki-servlet-engine-9.0.7-16.module+el8.1.0+3366+6dfb954c.noarch
pki-kra-10.7.1-2.module+el8.1.0+3386+52d02a00.noarch
[root@seceng-idm-1 ~]# 
```

Steps to reproduce:
```
# pki -d /opt/pki/certdb/ -c SECret.123 -p 20080 -n "PKI CA Administrator for Example.Org" client-cert-request "UID=testuser101,CN=testuser101" 
-----------------------------
Submitted certificate request
-----------------------------
  Request ID: 14
  Type: enrollment
  Request Status: pending
  Operation Result: success

# pki -d /opt/pki/certdb/ -c SECret.123 -p 20080 -n "PKI CA Administrator for Example.Org" ca-cert-request-review --action approve 14
-------------------------------
Approved certificate request 14
-------------------------------
  Request ID: 14
  Type: enrollment
  Request Status: complete
  Operation Result: success
  Certificate ID: 0xe
# pki -d /opt/pki/certdb/ -c SECret.123 -p 20080 -n "PKI CA Administrator for Example.Org" ca-cert-revoke 0xe --reason Unspecified --force
-------------------------
Revoked certificate "0xe"
-------------------------
  Serial Number: 0xe
  Subject DN: UID=testuser101,CN=testuser101
  Issuer DN: CN=CA Signing Certificate,OU=topology-02-CA,O=topology-02_Foobarmaster.org
  Status: REVOKED
  Not Valid Before: Wed Jul 17 03:20:11 EDT 2019
  Not Valid After: Mon Jan 13 03:20:11 EST 2020
  Revoked On: Wed Jul 17 03:22:22 EDT 2019
  Revoked By: caadmin
# pki-server ca-cert-request-find -i topology-02-CA
ERROR: 'extdata-cert--005frequest'
# 
```

Comment 8 Dinesh Prasanth 2019-07-25 21:14:06 UTC
Adding this comment for (my) future reference:

This seems to me like an issue seen only when a client-cert-request is done. I'd assume some entries are formatted in a wrong way. Need to look deeper. Thanks Amol for confirming! :)

Comment 9 Dinesh Prasanth 2020-03-16 22:28:52 UTC
As per offline triage, this will be handled via UPSTREAM ticket: https://pagure.io/dogtagpki/issue/2771