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 1448204 - pkispawn of clone install fails with InvalidBERException
Summary: pkispawn of clone install fails with InvalidBERException
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pki-core
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Fraser Tweedale
QA Contact: Ganna Kaihorodova
URL:
Whiteboard:
Depends On:
Blocks: 1449577
TreeView+ depends on / blocked
 
Reported: 2017-05-04 19:18 UTC by Matthew Harmsen
Modified: 2020-10-04 21:28 UTC (History)
3 users (show)

Fixed In Version: pki-core-10.4.1-4.el7
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2017-08-01 22:50:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
verification "pkispawn of clone install fails with InvalidBERException" (11.19 KB, text/plain)
2017-06-07 12:42 UTC, Ganna Kaihorodova
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github dogtagpki pki issues 2797 0 None None None 2020-10-04 21:28:37 UTC
Red Hat Product Errata RHBA-2017:2110 0 normal SHIPPED_LIVE pki-core bug fix and enhancement update 2017-08-01 19:36:59 UTC

Description Matthew Harmsen 2017-05-04 19:18:11 UTC
This bug is created as a clone of upstream ticket:
https://pagure.io/dogtagpki/issue/2677

Installation of a IPA replica with CA fails during pkispawn of the CA instance. Both master and replica are brand new VMs with latest updates. The master is configured with DNS, CA and KRA. The problem is reproducible and occurs for both a fresh replica and uninstall+install after a failed installation.

## version

```
tomcatjss-7.2.1-3.el7.noarch
ipa-server-4.5.0-9.el7.x86_64
jss-4.4.0-6.el7.x86_64
nss-3.28.4-6.el7.x86_64
pki-ca-10.4.1-3.el7.noarch
```

## install log
```
2017-05-04T18:23:42Z DEBUG stdout=Log file: /var/log/pki/pki-ca-spawn.20170504202323.log
Loading deployment configuration from /tmp/tmpkIM43O.
Installing CA into /var/lib/pki/pki-tomcat.
Storing deployment configuration into /etc/sysconfig/pki/tomcat/pki-tomcat/ca/deployment.cfg.
Importing certificates from /tmp/ca.p12:
---------------
4 entries found
---------------
  Certificate ID: 8cbf838f25c917abb4e887bb2b89ef49236799ed
  Serial Number: 0x2
  Nickname: ocspSigningCert cert-pki-ca
  Subject DN: CN=OCSP Subsystem,O=IPA.EXAMPLE
  Issuer DN: CN=Certificate Authority,O=IPA.EXAMPLE
  Trust Flags: u,u,u
  Has Key: true

  Certificate ID: 9a42a36a787ca560eef5dc234473bc4a11d88ae6
  Serial Number: 0x1
  Nickname: caSigningCert cert-pki-ca
  Subject DN: CN=Certificate Authority,O=IPA.EXAMPLE
  Issuer DN: CN=Certificate Authority,O=IPA.EXAMPLE
  Trust Flags: CTu,Cu,Cu
  Has Key: true

  Certificate ID: 59b959ce6bc25a35c204f40d61e578f6c703fac0
  Serial Number: 0x4
  Nickname: subsystemCert cert-pki-ca
  Subject DN: CN=CA Subsystem,O=IPA.EXAMPLE
  Issuer DN: CN=Certificate Authority,O=IPA.EXAMPLE
  Trust Flags: u,u,u
  Has Key: true

  Certificate ID: dc2eb4ca173e118ab9adc936045b346b3b63c361
  Serial Number: 0x5
  Nickname: auditSigningCert cert-pki-ca
  Subject DN: CN=CA Audit,O=IPA.EXAMPLE
  Issuer DN: CN=Certificate Authority,O=IPA.EXAMPLE
  Trust Flags: u,u,u
  Has Key: true
---------------
Import complete
---------------
Imported certificates in /etc/pki/pki-tomcat/alias:

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI

ocspSigningCert cert-pki-ca                                  u,u,u
subsystemCert cert-pki-ca                                    u,u,u
caSigningCert cert-pki-ca                                    CTu,Cu,Cu
auditSigningCert cert-pki-ca                                 u,u,Pu

Installation failed:
<html><head><title>Apache Tomcat/7.0.76 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - org.mozilla.jss.asn1.InvalidBERException: SEQUENCE(item #0) &gt;&gt; Missing item #0: found UNIVERSAL 16</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>org.mozilla.jss.asn1.InvalidBERException: SEQUENCE(item #0) &gt;&gt; Missing item #0: found UNIVERSAL 16</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.jboss.resteasy.spi.UnhandledException: org.mozilla.jss.asn1.InvalidBERException: SEQUENCE(item #0) &gt;&gt; Missing item #0: found UNIVERSAL 16
        org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
        org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
        org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:149)
        org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:372)
        org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)
        org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
        org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
        org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        java.lang.reflect.Method.invoke(Method.java:498)
        org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:288)
        org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:285)
        java.security.AccessController.doPrivileged(Native Method)
        javax.security.auth.Subject.doAsPrivileged(Subject.java:549)
        org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:320)
        org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:175)
        java.security.AccessController.doPrivileged(Native Method)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        java.lang.reflect.Method.invoke(Method.java:498)
        org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:288)
        org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:285)
        java.security.AccessController.doPrivileged(Native Method)
        javax.security.auth.Subject.doAsPrivileged(Subject.java:549)
        org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:320)
        org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:260)
</pre></p><p><b>root cause</b> <pre>org.mozilla.jss.asn1.InvalidBERException: SEQUENCE(item #0) &gt;&gt; Missing item #0: found UNIVERSAL 16
        org.mozilla.jss.asn1.SEQUENCE$Template.decode(SEQUENCE.java:357)
        org.mozilla.jss.pkix.primitive.PBEParameter$Template.decode(PBEParameter.java:110)
        org.mozilla.jss.pkix.primitive.PBEParameter$Template.decode(PBEParameter.java:104)
        org.mozilla.jss.asn1.ASN1Util.decode(ASN1Util.java:38)
        org.mozilla.jss.pkix.primitive.EncryptedPrivateKeyInfo.decrypt(EncryptedPrivateKeyInfo.java:273)
        com.netscape.cms.servlet.csadmin.ConfigurationUtils.restoreCertsFromP12(ConfigurationUtils.java:891)
        org.dogtagpki.server.rest.SystemConfigService.configureClone(SystemConfigService.java:878)
        org.dogtagpki.server.rest.SystemConfigService.configureSubsystem(SystemConfigService.java:1008)
        org.dogtagpki.server.rest.SystemConfigService.configure(SystemConfigService.java:153)
        org.dogtagpki.server.rest.SystemConfigService.configure(SystemConfigService.java:110)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        java.lang.reflect.Method.invoke(Method.java:498)
        org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137)
        org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:280)
        org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:234)
        org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:221)
        org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
        org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)
        org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
        org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
        org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        java.lang.reflect.Method.invoke(Method.java:498)
        org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:288)
        org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:285)
        java.security.AccessController.doPrivileged(Native Method)
        javax.security.auth.Subject.doAsPrivileged(Subject.java:549)
        org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:320)
        org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:175)
        java.security.AccessController.doPrivileged(Native Method)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        java.lang.reflect.Method.invoke(Method.java:498)
        org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:288)
        org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:285)
        java.security.AccessController.doPrivileged(Native Method)
        javax.security.auth.Subject.doAsPrivileged(Subject.java:549)
        org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:320)
        org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:260)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.76 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.76</h3></body></html>

Please check the CA logs in /var/log/pki/pki-tomcat/ca.

2017-05-04T18:23:42Z DEBUG stderr=
2017-05-04T18:23:42Z CRITICAL Failed to configure CA instance: Command '/usr/sbin/pkispawn -s CA -f /tmp/tmpkIM43O' returned non-zero exit status 1
```

Comment 2 Matthew Harmsen 2017-05-05 16:48:21 UTC
On May 5, 2017, ftweedal:

commit 3fb95590cdf0e45418fa0be7a020691567ef152a
Author: Fraser Tweedale ftweedal
Date: Fri May 5 20:13:07 2017 +1000

Delete unused methods

Change-Id: I81d3aa98a05208b2f5b1be3700c2e0759b387203

commit 62a78bfa227b5e75a7cb931d7e65e824f5fe01ec
Author: Fraser Tweedale ftweedal
Date: Fri May 5 19:54:15 2017 +1000

Fix PKCS #12 import during clone installation

PKCS #12 export was updated to use AES / PBES2 encryption for the
key bags, but an import code path used when spawning a clone was
missed, and now fails (because it doesn't grok PBES2).

Update it to use CryptoStore.importEncryptedPrivateKeyInfo()
instead, fixing the problem.

Fixes: https://pagure.io/dogtagpki/issue/2677
Change-Id: I11f26ae8a4811f27690541f2c70b3a2adb6264e9

Comment 4 Ganna Kaihorodova 2017-06-07 12:42:10 UTC
Created attachment 1285794 [details]
verification "pkispawn of clone install fails with InvalidBERException"

Comment 7 Fraser Tweedale 2017-07-24 01:02:00 UTC
This was a regression introduced in the rebase (or an early snapshot), and fixed in a later snapshot.  So I think it is now "no docs required".

Comment 8 errata-xmlrpc 2017-08-01 22:50:57 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.

https://access.redhat.com/errata/RHBA-2017:2110


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