Este conteúdo não está disponível no idioma selecionado.
Chapter 20. Upgrading from Certificate System 9 to Certificate System 10
Users are recommended to upgrade to the most recent version of Red Hat Certificate System to get security and bug fixes through the Errata-Support channel. Currently, the most recent versions are RHCS 9.7 on RHEL 7.9 and RHCS 10.8 on RHEL 8.10.
20.1. Migrating a CA Copiar o linkLink copiado para a área de transferência!
A Certificate System migration using the existing certificate files requires the following steps:
20.1.1. Exporting data from the previous system Copiar o linkLink copiado para a área de transferência!
Before you set up the new Certificate System instance, export the data of the current certificate authority (CA) using the steps below. In this example, the CA’s instance name is <pki-rootCA> and is located at /var/lib/pki/<instance_name>
.
Export the CA signing certificate and key.
grep internal= /var/lib/pki/<instance_name>/conf/password.conf | awk -F= '{print $2;}' > internal.txt echo <Secret.123> > password.txt PKCS12Export -d /var/lib/pki/<instance_name>/alias -p internal.txt -o ca.p12 -w password.txt
# grep internal= /var/lib/pki/<instance_name>/conf/password.conf | awk -F= '{print $2;}' > internal.txt # echo <Secret.123> > password.txt # PKCS12Export -d /var/lib/pki/<instance_name>/alias -p internal.txt -o ca.p12 -w password.txt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Export the Certificate Signing Requests (CSR).
echo "-----BEGIN NEW CERTIFICATE REQUEST-----" > ca_signing.csr sed -n "/^ca.signing.certreq=/ s/[=]*=// p" < /var/lib/pki/<instance_name>/ca/conf/CS.cfg >> ca_signing.csr echo "-----END NEW CERTIFICATE REQUEST-----" >> ca_signing.csr
# echo "-----BEGIN NEW CERTIFICATE REQUEST-----" > ca_signing.csr # sed -n "/^ca.signing.certreq=/ s/[=]*=// p" < /var/lib/pki/<instance_name>/ca/conf/CS.cfg >> ca_signing.csr # echo "-----END NEW CERTIFICATE REQUEST-----" >> ca_signing.csr
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the old CA is an intermediate CA (with a single root CA in the chain), extract the root CA from the NSS database:
certutil -L -d /var/lib/pki/<instance_name>/alias/ -n root_CA_nickname -a > ca_rootca_signing.crt
# certutil -L -d /var/lib/pki/<instance_name>/alias/ -n root_CA_nickname -a > ca_rootca_signing.crt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Back up the internal LDAP database:
Find the name of the CA database by checking the value of internaldb.database in the CA’s
CS.cfg
:grep internaldb.database /etc/pki/<instance_name>/ca/CS.cfg
# grep internaldb.database /etc/pki/<instance_name>/ca/CS.cfg internaldb.database=<CS_database_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Export this database to a
.ldif
file using the instance-specific script generated bysetup-ds.pl
when the instance was created:cd /usr/lib64/dirsrv/<instance_name> ./db2ldif -n "<CS_database_name>" -a /tmp/old_ca.ldif
# cd /usr/lib64/dirsrv/<instance_name> # ./db2ldif -n "<CS_database_name>" -a /tmp/old_ca.ldif
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
db2ldif
command runs as the DB user, so it needs a destination folder with writing permissions.
-
Transfer the
old_ca.ldif
,ca_p12
,ca_signing.csr
files to the new CA machine. If the CA being migrated is also an intermediate CA, transfer theca_rootca_signing.crt
as well.
20.1.2. Verifying the PKCS12 file Copiar o linkLink copiado para a área de transferência!
On the new CA, a new database instance runs on the standard port (389). The PKCS12 file contains all the system certificates for the old system. Verify that the file includes the CA signing certificate and the key.
In FIPS mode, you must run the pki pkcs12
commands with an NSS database. For more information, see the pki-pkcs12
CLI.
Find the CA signing certificate and the key.
echo "<Secret.123>" > password.txt pki pkcs12-cert-find --pkcs12-file ca.p12 --pkcs12-password-file password.txt pki pkcs12-key-find --pkcs12-file ca.p12 --pkcs12-password-file password.txt
$ echo "<Secret.123>" > password.txt $ pki pkcs12-cert-find --pkcs12-file ca.p12 --pkcs12-password-file password.txt $ pki pkcs12-key-find --pkcs12-file ca.p12 --pkcs12-password-file password.txt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the presence of the trust flags of the CA signing certificate. If the flags are not "CTu,Cu,Cu" or they are missing, add them.
pki pkcs12-cert-mod "<caSigningCert cert-pki-rootCA>" \ --pkcs12-file ca.p12 --pkcs12-password-file password.txt \ --trust-flags "CTu,Cu,Cu"
$ pki pkcs12-cert-mod "<caSigningCert cert-pki-rootCA>" \ --pkcs12-file ca.p12 --pkcs12-password-file password.txt \ --trust-flags "CTu,Cu,Cu"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove other certificates and keys.
pki pkcs12-cert-del "<Server-Cert cert-pki-rootCA>" --pkcs12-file ca.p12 --pkcs12-password-file password.txt pki pkcs12-cert-del "<subsystemCert cert-pki-rootCA>" --pkcs12-file ca.p12 --pkcs12-password-file password.txt pki pkcs12-cert-del "<ocspSigningCert cert-pki-rootCA>" --pkcs12-file ca.p12 --pkcs12-password-file password.txt pki pkcs12-cert-del "<auditSigningCert cert-pki-rootCA>" --pkcs12-file ca.p12 --pkcs12-password-file password.txt
$ pki pkcs12-cert-del "<Server-Cert cert-pki-rootCA>" --pkcs12-file ca.p12 --pkcs12-password-file password.txt $ pki pkcs12-cert-del "<subsystemCert cert-pki-rootCA>" --pkcs12-file ca.p12 --pkcs12-password-file password.txt $ pki pkcs12-cert-del "<ocspSigningCert cert-pki-rootCA>" --pkcs12-file ca.p12 --pkcs12-password-file password.txt $ pki pkcs12-cert-del "<auditSigningCert cert-pki-rootCA>" --pkcs12-file ca.p12 --pkcs12-password-file password.txt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the CA being migrated is also an intermediate CA, remove the root CA certificate from the PKCS#12 file.
pki pkcs12-cert-del "<Top-level Root CA Signing Certificate>" --pkcs12-file ca.p12 --pkcs12-password-file password.txt
$ pki pkcs12-cert-del "<Top-level Root CA Signing Certificate>" --pkcs12-file ca.p12 --pkcs12-password-file password.txt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
20.1.3. Setting up the CA on the new host Copiar o linkLink copiado para a área de transferência!
After you have exported the data from the existing instance, create and set up the certificate authority (CA) on the new host.
Create a configuration file for
pkispawn
, for example CA.cfg, using the parameters of the old CA. This instance runs on the standard port (389).Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the old CA is an intermediate CA, add the following two lines to the configuration file. They correspond to the path to the root CA certificate and the nickname to use when storing the certificate in the NSS database.
pki_cert_chain_path=<rootca_signing.crt> pki_cert_chain_nickname=<caSigningCert cert-pki-ca>
pki_cert_chain_path=<rootca_signing.crt> pki_cert_chain_nickname=<caSigningCert cert-pki-ca>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run
pkispawn
on the new host to create the new CA instance:pkispawn -s CA -f ca.cfg -vv
# pkispawn -s CA -f ca.cfg -vv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
For instructions on how to set up a new DS instance for the new CA, see Installing Red Hat Directory Server.
20.1.4. Importing the old data into the new CA Copiar o linkLink copiado para a área de transferência!
After you have created the new CA instance, import the data into the new CA database:
Stop the CA service.
systemctl stop pki-tomcatd@<instance_name>.service
# systemctl stop pki-tomcatd@<instance_name>.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Back up the CA database on the new host.
dsctl -v idm-qe-01 db2bak
# dsctl -v idm-qe-01 db2bak
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The backup is stored in the
/var/lib/dirsrv/<instance_name>/bak/<host_name-time_stamp>/
directory.Remove the certificate entry for the signing certificate from the new RHEL 8 internal database.
ldapdelete -x -w <password< -D 'cn=Directory Manager' "cn=<serial_number<,ou=certificateRepository,ou=ca,o=pki-tomcat-CA"
# ldapdelete -x -w <password< -D 'cn=Directory Manager' "cn=<serial_number<,ou=certificateRepository,ou=ca,o=pki-tomcat-CA"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The entry is now imported from the old data, so that the CRL attributes in that entry point to the correct entries.
Import the data into the new database:
ldapmodify -x -W <password> -D 'cn=Directory Manager' -a -c -f <path/to/old_ca.ldif>
# ldapmodify -x -W <password> -D 'cn=Directory Manager' -a -c -f <path/to/old_ca.ldif>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
ldapmodify
utility only adds new entries and does not update existing entries, created when you installed the CA.-
Optional: Verify the output in the
import.log
file. You can search for failed actions, such asldap_add: Invalid syntax (21)
. Remove the directory entry for the old security domain.
ldapmodify -W <password> -x -D "cn=Directory Manager"
# ldapmodify -W <password> -x -D "cn=Directory Manager" dn: cn=<server.example.com:9445>,cn=CAList,ou=Security Domain,<o=pki-tomcat-CA> changetype: delete
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the
ca.crl.MasterCRL.enable
parameter in the/etc/pki/<instance_name>/ca/CS.cfg
file, to have the CA act as the certificate revocation list (CRL) master:ca.crl.MasterCRL.enable=true
ca.crl.MasterCRL.enable=true
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the CA service:
systemctl start pki-tomcatd@<instance_name>
# systemctl start pki-tomcatd@<instance_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
20.1.5. Reassigning users to default groups Copiar o linkLink copiado para a área de transferência!
Add members to the default groups manually, using the ldapmodify
utility or the pki
utility.
Set up the client:
pki -c <password> client-init
# pki -c <password> client-init Client initialized
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pk12util -i ~/.dogtag/<instance_name>/ca_admin_cert.p12 -d ~/.dogtag/nssdb/
# pk12util -i ~/.dogtag/<instance_name>/ca_admin_cert.p12 -d ~/.dogtag/nssdb/ Enter Password or Pin for "NSS Certificate DB": Enter password for PKCS12 file: pk12util: PKCS12 IMPORT SUCCESSFUL
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the
user
account to theAdministrators
andSecurity Domain Administrators
groups:pki -n "<PKI Administrator for example.com>" -c <password> \ user-membership-add <user_name> "Certificate Manager Agents"
# pki -n "<PKI Administrator for example.com>" -c <password> \ user-membership-add <user_name> "Certificate Manager Agents"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The default (bootstrap) admin users in RHCS 9 and RHCS 10 have the same default roles, that is the same group membership. However, if you have a non-default admin user or have customized the admin roles in RHCS 9, those changes might not be migrated properly. In this case, reconfigure the roles in RHCS 10:
pki -n "<PKI Administrator for example.com>" -c <password> \ user-membership-add <user> "Administrators" pki -n "<PKI Administrator for example.com>" -c <password> \ user-membership-add <user> "Security Domain Administrators"
# pki -n "<PKI Administrator for example.com>" -c <password> \ user-membership-add <user> "Administrators" # pki -n "<PKI Administrator for example.com>" -c <password> \ user-membership-add <user> "Security Domain Administrators"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If you want to make sure the certificate has been migrated successfully, check its existence on the new host by running the ca-cert-find command
.
20.2. Migrating a KRA Copiar o linkLink copiado para a área de transferência!
Simple KRA migration requires the following steps:
The KRA located on alpha.example.com contains the data, while the KRA located on omega.example.com does not exist yet.
Hostname | PKI KRA Version |
---|---|
alpha.example.com | PKI KRA 10.5 on RHCS 9.7 |
omega.example.com | PKI KRA 10.13 on RHCS 10.4 |
20.2.1. Setting up the KRA on the new host Copiar o linkLink copiado para a área de transferência!
On omega.example.com as the root
user:
- Install and configure a new PKI 10.13 KRA on omega.example.com.
Stop the KRA instance.
systemctl stop pki-tomcatd@<pki-kra>
# systemctl stop pki-tomcatd@<pki-kra>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a directory to export all required files.
mkdir -p /export/pki
# mkdir -p /export/pki
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Export KRA storage certificates to a file. You will need the KRA storage certificate later to re-encrypt the decrypted old data from the KRA on alpha. In the following example, the file is called
omega.crt
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Move the
omega.crt
file to the/export/pki
directory. Stop the Directory Server.
systemctl stop dirsrv@omega
# systemctl stop dirsrv@omega
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf
db2ldif
is missing, install the389-ds-base-legacy-tools
package.Extract the KRA LDAP database configurations. You will need the new KRA LDAP database configurations for transforming the old data to the new.
/usr/lib64/dirsrv/slapd-omega/db2ldif -n <pki-kra-KRA> -a /tmp/omega.ldif
# /usr/lib64/dirsrv/slapd-omega/db2ldif -n <pki-kra-KRA> -a /tmp/omega.ldif
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move the
/tmp/omega.ldif
file to the/export/pki
directory.mv /tmp/omega.ldif /export/pki/
# mv /tmp/omega.ldif /export/pki/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
20.2.2. Exporting contents from the previous system Copiar o linkLink copiado para a área de transferência!
On alpha.example.com as the root user:
Create a common directory:
mkdir -p /export/pki
# mkdir -p /export/pki
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Stop the Directory Server. In this example, the server is named alpha:
systemctl stop dirsrv@alpha
# systemctl stop dirsrv@alpha
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate the LDIF from the KRA LDAP database:
/usr/lib64/dirsrv/slapd-alpha/db2ldif -n <pki-kra-KRA> -a /tmp/alpha.ldif
# /usr/lib64/dirsrv/slapd-alpha/db2ldif -n <pki-kra-KRA> -a /tmp/alpha.ldif
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move the
/tmp/alpha.ldif
file to/export/pki
directory:mv /tmp/alpha.ldif /export/pki/
# mv /tmp/alpha.ldif /export/pki/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the KRA NSS security databases to the data area:
cp -p /var/lib/pki/<pki-kra>/alias/* /export/pki/
# cp -p /var/lib/pki/<pki-kra>/alias/* /export/pki/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Go to the
/export/pki
directory:cd /export/pki
# cd /export/pki
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Obtain the flat-file containing the new KRA’s storage certificate from omega.example.com:
sftp root@omega.example.com sftp> cd /export/pki sftp> get omega.crt sftp> quit
sftp root@omega.example.com sftp> cd /export/pki sftp> get omega.crt sftp> quit
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Obtain the internal password:
cat /var/lib/<instance_name>/conf/password.conf
# cat /var/lib/<instance_name>/conf/password.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
KRATool
on alpha.example.com:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteAlternatively, you can create a plain-text file protected from unauthorized access containing one and only password that will be automatically accessed by a certificate or a certificate database. Add this file to
KRATool
with the-source_pki_security_database_pwdfile <path_to_PKI_password_file>
command-line option.Copy the
alpha2omega.ldif
file to omega.example.com:sftp root@omega.example.com sftp> cd /export/pki sftp> put alpha2omega.ldif sftp> quit
sftp root@omega.example.com sftp> cd /export/pki sftp> put alpha2omega.ldif sftp> quit
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
20.2.3. Importing the data into the new KRA Copiar o linkLink copiado para a área de transferência!
On omega.example.com as the root
user:
Go to
/export/pki
directory.cd /export/pki
# cd /export/pki
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Concatenate the
ldif
files:cat omega.ldif alpha2omega.ldif > omega_alpha.ldif
# cat omega.ldif alpha2omega.ldif > omega_alpha.ldif
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Import the
omega_alpha.ldif
file into the LDAP database associated with the PKI KRA:/usr/lib64/dirsrv/slapd-omega/ldif2db -n <pki-kra-KRA> -i /export/pki/omega_alpha.ldif
# /usr/lib64/dirsrv/slapd-omega/ldif2db -n <pki-kra-KRA> -i /export/pki/omega_alpha.ldif
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start the Directory Server:
systemctl start dirsrv@omega
# systemctl start dirsrv@omega
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start the KRA instance.
systemctl start pki-tomcatd@<pki-kra>
# systemctl start pki-tomcatd@<pki-kra>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
20.2.4. Validating the presence of migrated keys from the KRA Agent Page Copiar o linkLink copiado para a área de transferência!
The last step is to perform key recovery of migrated keys from the KRA Agent page.
20.2.5. Post-Upgrade Testing Copiar o linkLink copiado para a área de transferência!
Follow the key recovery operation for user key archived before upgrade.
Procedure 21.1. Key Recovery Test
Display the base64 user certificate created before upgrade.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Use this certificate to generate a key recovery request through KRA Agent UI.
Approve the recovery request.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Download the key from the KRA UI.