981330
From 5ffd30ff1c15ccedaf9f0a794d75a5e7476d192b Mon Sep 17 00:00:00 2001
981330
From: Jack Magne <jmagne@dhcp-16-206.sjc.redhat.com>
981330
Date: Tue, 16 Aug 2016 16:58:49 -0700
981330
Subject: [PATCH 1/7] Authentication Instance Id PinDirEnrollment with authType
981330
 value as SslclientAuth is not working.
981330
981330
Ticket #1578
981330
981330
The fixing of this problem required the following:
981330
981330
1. Hook up a java callback that is designed to allow the selection of a candidate
981330
client auth cert to be sent to Ldap in the LdapSSLSocket factory object.
981330
981330
Previously we simply manually set the desired client auth cert nickname, which is provided
981330
by the console interface when cofiguring the "removePin" portion of the UidPinDir Authentication method.
981330
981330
Doing it this way has the benefit of giving us some logging to show when the actual client auth cert is being
981330
requested by the server. We get to see the list of candidate certs and when we match one of those with the requested
981330
cert name, established by the console.
981330
981330
This client auth problem applies ONLY to the connection pool that is used to remove the pin attribute from
981330
an external authentication directory.
981330
981330
2. Previously the code, when setting up client auth for "removePin", would make one single call to create the SSL socket
981330
to connect to ldap over client auth. Now, based on some code I saw in the JSS test suite, the socket is constructed in two
981330
steps. Doing this causes things to work. Further investigation down the line could figure out what is going on at the lower level.
981330
981330
3. Was able to test this to work with the reported problem directory server provided by QE. Note: for pin removal to work, we must also
981330
make sure that the user we authenticating to (through client auth) has the power to actually remove the pin attribute from various users.
981330
981330
(cherry picked from commit a4d726098458225a0605faca9f11ebaa4dab036f)
981330
(cherry picked from commit ab570231ef3f63712cf7404ca2171cbea0ae0f92)
981330
---
981330
 .../cmscore/ldapconn/LdapJssSSLSocketFactory.java  | 70 ++++++++++++++++++++--
981330
 1 file changed, 65 insertions(+), 5 deletions(-)
981330
981330
diff --git a/base/server/cmscore/src/com/netscape/cmscore/ldapconn/LdapJssSSLSocketFactory.java b/base/server/cmscore/src/com/netscape/cmscore/ldapconn/LdapJssSSLSocketFactory.java
981330
index 182812c..b54d1e2 100644
981330
--- a/base/server/cmscore/src/com/netscape/cmscore/ldapconn/LdapJssSSLSocketFactory.java
981330
+++ b/base/server/cmscore/src/com/netscape/cmscore/ldapconn/LdapJssSSLSocketFactory.java
981330
@@ -18,9 +18,16 @@
981330
 package com.netscape.cmscore.ldapconn;
981330
 
981330
 import java.io.IOException;
981330
+import java.net.InetAddress;
981330
 import java.net.Socket;
981330
 import java.net.UnknownHostException;
981330
+import java.util.Iterator;
981330
+import java.util.Vector;
981330
 
981330
+import netscape.ldap.LDAPException;
981330
+import netscape.ldap.LDAPSSLSocketFactoryExt;
981330
+
981330
+import org.mozilla.jss.ssl.SSLClientCertificateSelectionCallback;
981330
 import org.mozilla.jss.ssl.SSLHandshakeCompletedEvent;
981330
 import org.mozilla.jss.ssl.SSLHandshakeCompletedListener;
981330
 import org.mozilla.jss.ssl.SSLSocket;
981330
@@ -28,9 +35,6 @@ import org.mozilla.jss.ssl.SSLSocket;
981330
 import com.netscape.certsrv.apps.CMS;
981330
 import com.netscape.certsrv.logging.ILogger;
981330
 
981330
-import netscape.ldap.LDAPException;
981330
-import netscape.ldap.LDAPSSLSocketFactoryExt;
981330
-
981330
 /**
981330
  * Uses HCL ssl socket.
981330
  *
981330
@@ -54,7 +58,22 @@ public class LdapJssSSLSocketFactory implements LDAPSSLSocketFactoryExt {
981330
             /*
981330
              * let inherit TLS range and cipher settings
981330
              */
981330
-            s = new SSLSocket(host, port);
981330
+
981330
+            if (mClientAuthCertNickname == null) {
981330
+                s = new SSLSocket(host, port);
981330
+            }
981330
+            else {
981330
+                //Let's create a selection callback in the case the client auth
981330
+                //No longer manually set the cert name.
981330
+                //This two step process, used in the JSS client auth test suite,
981330
+                //appears to be needed to get this working.
981330
+
981330
+                Socket js = new Socket(InetAddress.getByName(host), port);
981330
+                s = new SSLSocket(js, host,
981330
+                        null,
981330
+                        new SSLClientCertificateSelectionCB(mClientAuthCertNickname));
981330
+            }
981330
+
981330
             s.setUseClientMode(true);
981330
             s.enableV2CompatibleHello(false);
981330
 
981330
@@ -67,7 +86,9 @@ public class LdapJssSSLSocketFactory implements LDAPSSLSocketFactoryExt {
981330
                 mClientAuth = true;
981330
                 CMS.debug("LdapJssSSLSocket: set client auth cert nickname " +
981330
                         mClientAuthCertNickname);
981330
-                s.setClientCertNickname(mClientAuthCertNickname);
981330
+
981330
+                //We have already established the manual cert selection callback
981330
+                //Doing it this way will provide some debugging info on the candidate certs
981330
             }
981330
             s.forceHandshake();
981330
 
981330
@@ -114,4 +135,43 @@ public class LdapJssSSLSocketFactory implements LDAPSSLSocketFactoryExt {
981330
             CMS.debug("SSL handshake happened");
981330
         }
981330
     }
981330
+
981330
+    static class SSLClientCertificateSelectionCB implements SSLClientCertificateSelectionCallback {
981330
+        String desiredCertName = null;
981330
+
981330
+        public SSLClientCertificateSelectionCB(String clientAuthCertNickname) {
981330
+            CMS.debug("SSLClientCertificateSelectionCB: Setting desired cert nickname to: " + clientAuthCertNickname);
981330
+            desiredCertName = clientAuthCertNickname;
981330
+        }
981330
+
981330
+        @Override
981330
+        public String select(Vector certs) {
981330
+
981330
+            CMS.debug("SSLClientCertificatSelectionCB: Entering!");
981330
+
981330
+            if(desiredCertName == null) {
981330
+                return null;
981330
+            }
981330
+
981330
+            @SuppressWarnings("unchecked")
981330
+            Iterator<String> itr = certs.iterator();
981330
+            String selection = null;
981330
+
981330
+            while(itr.hasNext()){
981330
+                String candidate = itr.next();
981330
+                CMS.debug("Candidate cert: " + candidate);
981330
+                if(desiredCertName.equalsIgnoreCase(candidate)) {
981330
+                    selection = candidate;
981330
+                    CMS.debug("SSLClientCertificateSelectionCB: desired cert found in list: " + desiredCertName);
981330
+                    break;
981330
+                }
981330
+            }
981330
+
981330
+            CMS.debug("SSLClientCertificateSelectionCB: returning: " + selection);
981330
+            return selection;
981330
+
981330
+        }
981330
+
981330
+    }
981330
+
981330
 }
981330
-- 
981330
1.8.3.1
981330
981330
981330
From a4ebeb1fa880e53d87c39757c8c2dd40aef0a7ce Mon Sep 17 00:00:00 2001
981330
From: "Endi S. Dewata" <edewata@redhat.com>
981330
Date: Wed, 24 Aug 2016 18:42:05 +0200
981330
Subject: [PATCH 2/7] Added upgrade script to fix deployment descriptors.
981330
981330
An upgrade script has been added to fix missing deployment
981330
descriptors or deployment descriptors that are pointing to
981330
non-existent or empty folders.
981330
981330
https://fedorahosted.org/pki/ticket/2439
981330
(cherry picked from commit b8094e82c46f8d5f18d362404582304ad28407da)
981330
(cherry picked from commit b6a038a81c6f69e636822d7615e97d591c244aa1)
981330
---
981330
 .../upgrade/10.3.5/03-FixDeploymentDescriptor      | 110 +++++++++++++++++++++
981330
 1 file changed, 110 insertions(+)
981330
 create mode 100644 base/server/upgrade/10.3.5/03-FixDeploymentDescriptor
981330
981330
diff --git a/base/server/upgrade/10.3.5/03-FixDeploymentDescriptor b/base/server/upgrade/10.3.5/03-FixDeploymentDescriptor
981330
new file mode 100644
981330
index 0000000..27c8959
981330
--- /dev/null
981330
+++ b/base/server/upgrade/10.3.5/03-FixDeploymentDescriptor
981330
@@ -0,0 +1,110 @@
981330
+#!/usr/bin/python
981330
+# Authors:
981330
+#     Endi S. Dewata <edewata@redhat.com>
981330
+#
981330
+# This program is free software; you can redistribute it and/or modify
981330
+# it under the terms of the GNU General Public License as published by
981330
+# the Free Software Foundation; version 2 of the License.
981330
+#
981330
+# This program is distributed in the hope that it will be useful,
981330
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
981330
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
981330
+# GNU General Public License for more details.
981330
+#
981330
+# You should have received a copy of the GNU General Public License along
981330
+# with this program; if not, write to the Free Software Foundation, Inc.,
981330
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
981330
+#
981330
+# Copyright (C) 2016 Red Hat, Inc.
981330
+# All rights reserved.
981330
+
981330
+from __future__ import absolute_import
981330
+from lxml import etree
981330
+import os
981330
+import shutil
981330
+
981330
+import pki.server.upgrade
981330
+
981330
+
981330
+class FixDeploymentDescriptor(pki.server.upgrade.PKIServerUpgradeScriptlet):
981330
+
981330
+    def __init__(self):
981330
+        super(FixDeploymentDescriptor, self).__init__()
981330
+        self.message = 'Fix deployment descriptor'
981330
+        self.parser = etree.XMLParser(remove_blank_text=True)
981330
+
981330
+    def upgrade_instance(self, instance):
981330
+
981330
+        self.fix_webapp(instance, 'ROOT.xml')
981330
+        self.fix_webapp(instance, 'pki#admin.xml')
981330
+        self.fix_webapp(instance, 'pki#js.xml')
981330
+
981330
+        self.fix_theme(instance, 'pki.xml')
981330
+
981330
+    def fix_webapp(self, instance, context_xml):
981330
+
981330
+        source_xml = pki.SHARE_DIR + '/server/conf/Catalina/localhost/' + context_xml
981330
+        target_xml = instance.conf_dir + '/Catalina/localhost/' + context_xml
981330
+
981330
+        # if deployment descriptor doesn't exist, install the default
981330
+        if not os.path.exists(target_xml):
981330
+            self.copy_file(instance, source_xml, target_xml)
981330
+            return
981330
+
981330
+        # get docBase from deployment descriptor
981330
+        document = etree.parse(target_xml, self.parser)
981330
+        context = document.getroot()
981330
+        docBase = context.get('docBase')
981330
+
981330
+        # if docBase is absolute and pointing to non-empty folder, ignore
981330
+        if docBase.startswith('/') and \
981330
+                os.path.exists(docBase) and \
981330
+                os.listdir(docBase):
981330
+            return
981330
+
981330
+        # if docBase is relative and pointing to non-empty folder, ignore
981330
+        if not docBase.startswith('/') and \
981330
+                os.path.exists(instance.base_dir + '/webapps/' + docBase) and \
981330
+                os.listdir(instance.base_dir + '/webapps/' + docBase):
981330
+            return
981330
+
981330
+        # docBase is pointing to non-existent/empty folder, replace with default
981330
+        self.copy_file(instance, source_xml, target_xml)
981330
+
981330
+    def fix_theme(self, instance, context_xml):
981330
+
981330
+        source_xml = pki.SHARE_DIR + '/server/conf/Catalina/localhost/' + context_xml
981330
+        target_xml = instance.conf_dir + '/Catalina/localhost/' + context_xml
981330
+
981330
+        # if deployment descriptor doesn't exist, ignore (no theme)
981330
+        if not os.path.exists(target_xml):
981330
+            return
981330
+
981330
+        # get docBase from deployment descriptor
981330
+        document = etree.parse(target_xml, self.parser)
981330
+        context = document.getroot()
981330
+        docBase = context.get('docBase')
981330
+
981330
+        # if docBase is absolute and pointing to non-empty folder, ignore
981330
+        if docBase.startswith('/') and \
981330
+                os.path.exists(docBase) and \
981330
+                os.listdir(docBase):
981330
+            return
981330
+
981330
+        # if docBase is relative and pointing to non-empty folder, ignore
981330
+        if not docBase.startswith('/') and \
981330
+                os.path.exists(instance.base_dir + '/webapps/' + docBase) and \
981330
+                os.listdir(instance.base_dir + '/webapps/' + docBase):
981330
+            return
981330
+
981330
+        # docBase is pointing to non-existent/empty folder
981330
+
981330
+        # if theme package is installed, replace deployment descriptor
981330
+        if os.path.exists(pki.SHARE_DIR + '/common-ui'):
981330
+            self.copy_file(instance, source_xml, target_xml)
981330
+
981330
+    def copy_file(self, instance, source, target):
981330
+
981330
+        self.backup(target)
981330
+        shutil.copyfile(source, target)
981330
+        os.chown(target, instance.uid, instance.gid)
981330
-- 
981330
1.8.3.1
981330
981330
981330
From c7aa56ee7df2052deff23190912f86b42042cd59 Mon Sep 17 00:00:00 2001
981330
From: Abhijeet Kasurde <akasurde@redhat.com>
981330
Date: Wed, 10 Aug 2016 11:58:49 +0530
981330
Subject: [PATCH 4/7] Added check for pki-server-nuxwdog parameter
981330
981330
Partially fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1353245
981330
981330
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
981330
(cherry picked from commit c79371fdc667e6acfcae7255f144e63cd60bf0f9)
981330
(cherry picked from commit b4d5fcc5a30a11ed5e84ca835aea733a5d5bbfb6)
981330
---
981330
 base/server/sbin/pki-server-nuxwdog | 12 +++++++++++-
981330
 1 file changed, 11 insertions(+), 1 deletion(-)
981330
981330
diff --git a/base/server/sbin/pki-server-nuxwdog b/base/server/sbin/pki-server-nuxwdog
981330
index 31fff5e..ead9253 100755
981330
--- a/base/server/sbin/pki-server-nuxwdog
981330
+++ b/base/server/sbin/pki-server-nuxwdog
981330
@@ -1,8 +1,18 @@
981330
 #!/bin/sh
981330
 
981330
+if [ "$#" -ne 1 ]; then
981330
+    echo "ERROR: $0 requires parameter"
981330
+    exit 1
981330
+fi
981330
+
981330
 . /etc/tomcat/tomcat.conf
981330
 NAME=$1
981330
-. /etc/sysconfig/$NAME
981330
+if [ -f /etc/sysconfig/$NAME ]; then
981330
+    . /etc/sysconfig/$NAME
981330
+else
981330
+    echo "ERROR: Unable to find /etc/sysconfig/$NAME file"
981330
+    exit 1
981330
+fi
981330
 . /usr/libexec/tomcat/preamble
981330
 
981330
 NUXWDOG_PID=${CATALINA_BASE}/logs/wd-$NAME.pid
981330
-- 
981330
1.8.3.1
981330
981330
981330
From caa7ef990bc5e45ce0aba29acb4f9ddec66e7551 Mon Sep 17 00:00:00 2001
981330
From: Geetika Kapoor <gkapoor@redhat.com>
981330
Date: Fri, 12 Aug 2016 05:35:58 -0400
981330
Subject: [PATCH 5/7] Fix for BZ 1358462
981330
981330
(cherry picked from commit 4b48187b744f1cff2a64c4c5eb00866875a1f99d)
981330
(cherry picked from commit 92b6378053ef427b3a73866dbee415f7ee32d5ae)
981330
---
981330
 base/util/src/netscape/security/pkcs/PKCS12.java | 6 +++++-
981330
 1 file changed, 5 insertions(+), 1 deletion(-)
981330
981330
diff --git a/base/util/src/netscape/security/pkcs/PKCS12.java b/base/util/src/netscape/security/pkcs/PKCS12.java
981330
index 6c7880a..e05d4b5 100644
981330
--- a/base/util/src/netscape/security/pkcs/PKCS12.java
981330
+++ b/base/util/src/netscape/security/pkcs/PKCS12.java
981330
@@ -192,10 +192,14 @@ public class PKCS12 {
981330
         return result;
981330
     }
981330
 
981330
-    public void removeCertInfoByNickname(String nickname) {
981330
+    public void removeCertInfoByNickname(String nickname) throws Exception {
981330
 
981330
         Collection<PKCS12CertInfo> result = getCertInfosByNickname(nickname);
981330
 
981330
+        if (result.isEmpty()) {
981330
+            throw new Exception("Certificate not found: " + nickname);
981330
+        }
981330
+
981330
         for (PKCS12CertInfo certInfo : result) {
981330
             // remove cert and key
981330
             certInfosByID.remove(certInfo.getID());
981330
-- 
981330
1.8.3.1
981330
981330
981330
From 40509684cb71d3863d150a2844e02a7b9321f5d8 Mon Sep 17 00:00:00 2001
981330
From: "Endi S. Dewata" <edewata@redhat.com>
981330
Date: Sun, 28 Aug 2016 20:38:48 +0200
981330
Subject: [PATCH 6/7] Fixed default token name for system certificates.
981330
981330
Previously when installing with HSM the token name has to be
981330
specified for each system certificate in the pki_<cert>_token
981330
parameters. The deployment tool has been modified such that by
981330
default it will use the token name specified in pki_token_name.
981330
981330
https://fedorahosted.org/pki/ticket/2423
981330
(cherry picked from commit 389420ad4ea9994fb54132454a14abbb83c2c35d)
981330
(cherry picked from commit f4f62162f16da41a74328889bf2e0d17c223d48d)
981330
---
981330
 base/server/etc/default.cfg                        | 16 +++++------
981330
 .../python/pki/server/deployment/pkiparser.py      | 33 ++++++++++++++++++++--
981330
 2 files changed, 38 insertions(+), 11 deletions(-)
981330
981330
diff --git a/base/server/etc/default.cfg b/base/server/etc/default.cfg
981330
index 79e5545..51357e6 100644
981330
--- a/base/server/etc/default.cfg
981330
+++ b/base/server/etc/default.cfg
981330
@@ -78,7 +78,7 @@ pki_audit_signing_key_algorithm=SHA256withRSA
981330
 pki_audit_signing_key_size=2048
981330
 pki_audit_signing_key_type=rsa
981330
 pki_audit_signing_signing_algorithm=SHA256withRSA
981330
-pki_audit_signing_token=Internal Key Storage Token
981330
+pki_audit_signing_token=
981330
 pki_backup_keys=False
981330
 pki_backup_password=
981330
 pki_ca_hostname=%(pki_security_domain_hostname)s
981330
@@ -125,13 +125,13 @@ pki_ssl_server_key_size=2048
981330
 pki_ssl_server_key_type=rsa
981330
 pki_ssl_server_nickname=Server-Cert cert-%(pki_instance_name)s
981330
 pki_ssl_server_subject_dn=cn=%(pki_hostname)s,o=%(pki_security_domain_name)s
981330
-pki_ssl_server_token=Internal Key Storage Token
981330
+pki_ssl_server_token=
981330
 pki_subsystem_key_algorithm=SHA256withRSA
981330
 pki_subsystem_key_size=2048
981330
 pki_subsystem_key_type=rsa
981330
 pki_subsystem_nickname=subsystemCert cert-%(pki_instance_name)s
981330
 pki_subsystem_subject_dn=cn=Subsystem Certificate,o=%(pki_security_domain_name)s
981330
-pki_subsystem_token=Internal Key Storage Token
981330
+pki_subsystem_token=
981330
 pki_theme_enable=True
981330
 pki_theme_server_dir=/usr/share/pki/common-ui
981330
 pki_token_name=internal
981330
@@ -293,7 +293,7 @@ pki_ca_signing_key_type=rsa
981330
 pki_ca_signing_nickname=caSigningCert cert-%(pki_instance_name)s CA
981330
 pki_ca_signing_signing_algorithm=SHA256withRSA
981330
 pki_ca_signing_subject_dn=cn=CA Signing Certificate,o=%(pki_security_domain_name)s
981330
-pki_ca_signing_token=Internal Key Storage Token
981330
+pki_ca_signing_token=
981330
 pki_ca_signing_csr_path=
981330
 pki_ca_signing_cert_path=
981330
 pki_ca_starting_crl_number=0
981330
@@ -317,7 +317,7 @@ pki_ocsp_signing_key_type=rsa
981330
 pki_ocsp_signing_nickname=ocspSigningCert cert-%(pki_instance_name)s CA
981330
 pki_ocsp_signing_signing_algorithm=SHA256withRSA
981330
 pki_ocsp_signing_subject_dn=cn=CA OCSP Signing Certificate,o=%(pki_security_domain_name)s
981330
-pki_ocsp_signing_token=Internal Key Storage Token
981330
+pki_ocsp_signing_token=
981330
 pki_profiles_in_ldap=False
981330
 pki_random_serial_numbers_enable=False
981330
 pki_subordinate=False
981330
@@ -410,14 +410,14 @@ pki_storage_key_type=rsa
981330
 pki_storage_nickname=storageCert cert-%(pki_instance_name)s KRA
981330
 pki_storage_signing_algorithm=SHA256withRSA
981330
 pki_storage_subject_dn=cn=DRM Storage Certificate,o=%(pki_security_domain_name)s
981330
-pki_storage_token=Internal Key Storage Token
981330
+pki_storage_token=
981330
 pki_transport_key_algorithm=SHA256withRSA
981330
 pki_transport_key_size=2048
981330
 pki_transport_key_type=rsa
981330
 pki_transport_nickname=transportCert cert-%(pki_instance_name)s KRA
981330
 pki_transport_signing_algorithm=SHA256withRSA
981330
 pki_transport_subject_dn=cn=DRM Transport Certificate,o=%(pki_security_domain_name)s
981330
-pki_transport_token=Internal Key Storage Token
981330
+pki_transport_token=
981330
 pki_admin_email=%(pki_admin_name)s@%(pki_dns_domainname)s
981330
 pki_admin_name=%(pki_admin_uid)s
981330
 pki_admin_nickname=PKI Administrator for %(pki_dns_domainname)s
981330
@@ -479,7 +479,7 @@ pki_ocsp_signing_key_type=rsa
981330
 pki_ocsp_signing_nickname=ocspSigningCert cert-%(pki_instance_name)s OCSP
981330
 pki_ocsp_signing_signing_algorithm=SHA256withRSA
981330
 pki_ocsp_signing_subject_dn=cn=OCSP Signing Certificate,o=%(pki_security_domain_name)s
981330
-pki_ocsp_signing_token=Internal Key Storage Token
981330
+pki_ocsp_signing_token=
981330
 pki_admin_email=%(pki_admin_name)s@%(pki_dns_domainname)s
981330
 pki_admin_name=%(pki_admin_uid)s
981330
 pki_admin_nickname=PKI Administrator for %(pki_dns_domainname)s
981330
diff --git a/base/server/python/pki/server/deployment/pkiparser.py b/base/server/python/pki/server/deployment/pkiparser.py
981330
index 115f3ca..6e922cf 100644
981330
--- a/base/server/python/pki/server/deployment/pkiparser.py
981330
+++ b/base/server/python/pki/server/deployment/pkiparser.py
981330
@@ -564,6 +564,24 @@ class PKIConfigParser:
981330
         root = ET.fromstring(response)
981330
         return root.findtext("Status")
981330
 
981330
+    def normalize_cert_token(self, name):
981330
+
981330
+        # get cert token
981330
+        token = self.mdict.get(name)
981330
+
981330
+        # if not specified, get default token name
981330
+        if not token:
981330
+            token = self.mdict.get('pki_token_name')
981330
+
981330
+        # normalize internal token name
981330
+        if not token or \
981330
+                token.lower() == 'internal' or \
981330
+                token.lower() == 'internal key storage token':
981330
+            token = 'Internal Key Storage Token'
981330
+
981330
+        # update cert token
981330
+        self.mdict[name] = token
981330
+
981330
     def compose_pki_master_dictionary(self):
981330
         """
981330
         Create a single master PKI dictionary from the
981330
@@ -595,11 +613,11 @@ class PKIConfigParser:
981330
             instance = pki.server.PKIInstance(self.mdict['pki_instance_name'])
981330
             instance.load()
981330
 
981330
-            internal_password = self.mdict['pki_self_signed_token']
981330
+            internal_token = self.mdict['pki_self_signed_token']
981330
 
981330
             # if instance already exists and has password, reuse the password
981330
-            if internal_password in instance.passwords:
981330
-                self.mdict['pki_pin'] = instance.passwords.get(internal_password)
981330
+            if internal_token in instance.passwords:
981330
+                self.mdict['pki_pin'] = instance.passwords.get(internal_token)
981330
 
981330
             # otherwise, use user-provided password if specified
981330
             elif 'pki_pin' in self.mdict:
981330
@@ -1207,6 +1225,15 @@ class PKIConfigParser:
981330
                 # always normalize 'default' softokn name
981330
                 self.mdict['pki_token_name'] = "internal"
981330
 
981330
+            # normalize cert tokens
981330
+            self.normalize_cert_token('pki_audit_signing_token')
981330
+            self.normalize_cert_token('pki_ssl_server_token')
981330
+            self.normalize_cert_token('pki_subsystem_token')
981330
+            self.normalize_cert_token('pki_ca_signing_token')
981330
+            self.normalize_cert_token('pki_ocsp_signing_token')
981330
+            self.normalize_cert_token('pki_storage_token')
981330
+            self.normalize_cert_token('pki_transport_token')
981330
+
981330
             # if security domain user is not defined
981330
             if not len(self.mdict['pki_security_domain_user']):
981330
 
981330
-- 
981330
1.8.3.1
981330
981330
981330
From d5d19fc9b4d4d92c02fe2e75626f69c124ecd040 Mon Sep 17 00:00:00 2001
981330
From: "Endi S. Dewata" <edewata@redhat.com>
981330
Date: Sat, 27 Aug 2016 00:07:08 +0200
981330
Subject: [PATCH 7/7] Moved subsystem initialization after database
981330
 initialization.
981330
981330
Previously issues with system certificates that happen during
981330
subsystem initialization were reported as database initialization
981330
error. Database initialization actually does not depend on
981330
subsystem initialization, so to avoid confusion and to simplify the
981330
code the reInitSubsystem() in SystemConfigService is now invoked
981330
after the initializeDatabase() is complete.
981330
981330
https://fedorahosted.org/pki/ticket/2423
981330
(cherry picked from commit 9f954fda5fdeda229662a466e645561639ac8402)
981330
(cherry picked from commit 465bf002c0671e7251738ce9a4e54bba9853780a)
981330
---
981330
 base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java | 3 ++-
981330
 1 file changed, 2 insertions(+), 1 deletion(-)
981330
981330
diff --git a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
981330
index 95afa4c..9d7c176 100644
981330
--- a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
981330
+++ b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
981330
@@ -178,6 +178,8 @@ public class SystemConfigService extends PKIService implements SystemConfigResou
981330
         }
981330
         initializeDatabase(data);
981330
 
981330
+        ConfigurationUtils.reInitSubsystem(csType);
981330
+
981330
         configureCACertChain(data, domainXML);
981330
 
981330
         Collection<Cert> certs = new ArrayList<Cert>();
981330
@@ -777,7 +779,6 @@ public class SystemConfigService extends PKIService implements SystemConfigResou
981330
                     ConfigurationUtils.setupReplication();
981330
                 }
981330
 
981330
-                ConfigurationUtils.reInitSubsystem(csType);
981330
                 ConfigurationUtils.populateDBManager();
981330
                 ConfigurationUtils.populateVLVIndexes();
981330
             }
981330
-- 
981330
1.8.3.1
981330