Este conteúdo não está disponível no idioma selecionado.
Chapter 21. Replacing the web server and LDAP server certificates if they have expired in the whole IdM deployment
Identity Management (IdM) uses the following service certificates:
-
The LDAP (or
Directory) server certificate -
The web (or
httpd) server certificate - The PKINIT certificate
In an IdM deployment without an integrated certificate authority (CA), the certmonger service does not, by default, track IdM service certificates or provide expiration warnings. If the IdM system administrator does not manually configure certificate tracking or set up notifications, the certificates may expire without notice.
Follow this procedure to manually replace expired certificates for the httpd and LDAP services running on the server.idm.example.com IdM server with a valid certificate chain.
The httpd and LDAP service certificates have different key pairs and subject names on different IdM servers. Therefore, you must renew the certificates on each IdM server individually.
Prerequisites
-
The
httpdand LDAP certificates have expired on all IdM replicas in the topology. If not, see Replacing the web server and LDAP server certificates if they have not yet expired on an IdM replica. -
You have
rootaccess to the IdM server and replicas. -
You know the
Directory Managerpassword. You have created backups of the following directories and files:
-
/etc/dirsrv/slapd-IDM-EXAMPLE-COM/ -
/etc/httpd/alias -
/var/lib/certmonger -
/var/lib/ipa/certs/
-
-
If the new
httpd/LDAP certificate is going to be signed by a different external CA than the old one, or if the already installed CA certificate is no longer valid, you have access to the files storing the CA certificate chain of the external CA.
Procedure
-
Optional: Perform a backup of
/var/lib/ipa/privateand/var/lib/ipa/passwds. If you are not using the same certificate authority (CA) to sign the new certificates, or if the already installed CA certificate is no longer valid, update the information about the external CA in your local database with files that contain a valid CA certificate chain of the external CA. The files are accepted in PEM and DER certificate, PKCS#7 certificate chain, PKCS#8 and raw private key and PKCS#12 formats.
Install the CA certificate:
ipa-cacert-manage install /path/to/ca.crt
# ipa-cacert-manage install /path/to/ca.crtCopy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantIf the new external CA certificate has the same subject as the old one but is different because it uses a different key, you can use it only if you have met the following conditions:
- The two certificates have identical trust flags.
- The CAs share the same nickname.
-
The X509 extensions listed in the certificate include the
Authority Key Identifier(AKI) extension.
Install the rest of the certificate chain as additional CA certificates into IdM. Because the
ipa-cacert-manage installcommand reads only the first certificate in a file, you must install the full CA chain one certificate at a time. For example, if the chain includes two certificates, save each one in a separate file and runipa-cacert-manage installindividually for each file:ipa-cacert-manage install /path/to/intermediate-ca.crt
# ipa-cacert-manage install /path/to/intermediate-ca.crtCopy to Clipboard Copied! Toggle word wrap Toggle overflow ipa-cacert-manage install /path/to/root-ca.crt
# ipa-cacert-manage install /path/to/root-ca.crtCopy to Clipboard Copied! Toggle word wrap Toggle overflow Update the local IdM certificate databases with certificates from the certificate chain:
ipa-certupdate
# ipa-certupdateCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Request the certificates for
httpdand LDAP:Create a certificate signing request (CSR) for the Apache web server running on your IdM instances to your third party CA using the
OpenSSLutility.The creation of a new private key is optional. If you still have the original private key, you can use the
-inoption with theopenssl reqcommand to specify the input file name to read the request from:openssl req -new -nodes -in /var/lib/ipa/private/httpd.key -out /tmp/http.csr -addext 'subjectAltName = DNS:_server.idm.example.com_, otherName:1.3.6.1.4.1.311.20.2.3;UTF8:HTTP/server.idm.example.com@IDM.EXAMPLE.COM' -subj '/O=IDM.EXAMPLE.COM/CN=server.idm.example.com'
$ openssl req -new -nodes -in /var/lib/ipa/private/httpd.key -out /tmp/http.csr -addext 'subjectAltName = DNS:_server.idm.example.com_, otherName:1.3.6.1.4.1.311.20.2.3;UTF8:HTTP/server.idm.example.com@IDM.EXAMPLE.COM' -subj '/O=IDM.EXAMPLE.COM/CN=server.idm.example.com'Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you want to create a new key:
openssl req -new -newkey rsa:2048 -nodes -keyout /var/lib/ipa/private/httpd.key -out /tmp/http.csr -addext 'subjectAltName = DNS:server.idm.example.com, otherName:1.3.6.1.4.1.311.20.2.3;UTF8:HTTP/server.idm.example.com@IDM.EXAMPLE.COM' -subj '/O=IDM.EXAMPLE.COM/CN=server.idm.example.com'
$ openssl req -new -newkey rsa:2048 -nodes -keyout /var/lib/ipa/private/httpd.key -out /tmp/http.csr -addext 'subjectAltName = DNS:server.idm.example.com, otherName:1.3.6.1.4.1.311.20.2.3;UTF8:HTTP/server.idm.example.com@IDM.EXAMPLE.COM' -subj '/O=IDM.EXAMPLE.COM/CN=server.idm.example.com'Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a certificate signing request (CSR) for the LDAP server running on your IdM instances to your third party CA using the
OpenSSLutility:openssl req -new -newkey rsa:2048 -nodes -keyout ~/ldap.key -out /tmp/ldap.csr -addext 'subjectAltName = DNS:server.idm.example.com, otherName:1.3.6.1.4.1.311.20.2.3;UTF8:ldap/server.idm.example.com@IDM.EXAMPLE.COM' -subj '/O=IDM.EXAMPLE.COM/CN=server.idm.example.com'
$ openssl req -new -newkey rsa:2048 -nodes -keyout ~/ldap.key -out /tmp/ldap.csr -addext 'subjectAltName = DNS:server.idm.example.com, otherName:1.3.6.1.4.1.311.20.2.3;UTF8:ldap/server.idm.example.com@IDM.EXAMPLE.COM' -subj '/O=IDM.EXAMPLE.COM/CN=server.idm.example.com'Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Submit the CSRs, /tmp/http.csr and tmp/ldap.csr, to the external CA, and obtain a certificate for
httpdand a certificate for LDAP. The process differs depending on the service to be used as the external CA.
Install the certificate for
httpd:cp /path/to/httpd.crt /var/lib/ipa/certs/
# cp /path/to/httpd.crt /var/lib/ipa/certs/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the LDAP certificate into an NSS database:
Optional: List the available certificates:
certutil -d /etc/dirsrv/slapd-IDM-EXAMPLE-COM/ -L
# certutil -d /etc/dirsrv/slapd-IDM-EXAMPLE-COM/ -L Certificate Nickname Trust Attributes SSL,S/MIME,JAR/XPI Server-Cert u,u,uCopy to Clipboard Copied! Toggle word wrap Toggle overflow The default certificate nickname is Server-Cert, but it is possible that a different name was applied.
Remove the old invalid certificate from the NSS database (
NSSDB) by using the certificate nickname from the previous step:certutil -D -d /etc/dirsrv/slapd-IDM-EXAMPLE-COM/ -n 'Server-Cert' -f /etc/dirsrv/slapd-IDM-EXAMPLE-COM/pwdfile.txt
# certutil -D -d /etc/dirsrv/slapd-IDM-EXAMPLE-COM/ -n 'Server-Cert' -f /etc/dirsrv/slapd-IDM-EXAMPLE-COM/pwdfile.txtCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a PKCS12 file to ease the import process into
NSSDB:openssl pkcs12 -export -in ldap.crt -inkey ldap.key -out ldap.p12 -name Server-Cert
# openssl pkcs12 -export -in ldap.crt -inkey ldap.key -out ldap.p12 -name Server-CertCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the created PKCS#12 file into the
NSSDB:pk12util -i ldap.p12 -d /etc/dirsrv/slapd-IDM-EXAMPLE-COM/ -k /etc/dirsrv/slapd-IDM-EXAMPLE-COM/pwdfile.txt
# pk12util -i ldap.p12 -d /etc/dirsrv/slapd-IDM-EXAMPLE-COM/ -k /etc/dirsrv/slapd-IDM-EXAMPLE-COM/pwdfile.txtCopy to Clipboard Copied! Toggle word wrap Toggle overflow Check that the new certificate has been successfully imported:
certutil -L -d /etc/dirsrv/slapd-IDM-EXAMPLE-COM/
# certutil -L -d /etc/dirsrv/slapd-IDM-EXAMPLE-COM/Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Restart the
httpdservice:systemctl restart httpd.service
# systemctl restart httpd.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the
Directoryservice:systemctl restart dirsrv@IDM-EXAMPLE-COM.service
# systemctl restart dirsrv@IDM-EXAMPLE-COM.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Perform all the previous steps on all your IdM replicas. This is a prerequisite for establishing
TLSconnections between the replicas. Enroll the new certificates to LDAP storage:
Replace the Apache web server’s old private key and certificate with the new key and the newly-signed certificate:
ipa-server-certinstall -w --pin=password /var/lib/ipa/private/httpd.key /var/lib/ipa/certs/httpd.crt
# ipa-server-certinstall -w --pin=password /var/lib/ipa/private/httpd.key /var/lib/ipa/certs/httpd.crtCopy to Clipboard Copied! Toggle word wrap Toggle overflow In the command above:
-
The
-woption specifies that you are installing a certificate into the web server. -
The
--pinoption specifies the password protecting the private key.
-
The
-
When prompted, enter the
Directory Managerpassword. Replace the LDAP server’s old private key and certificate with the new key and the newly-signed certificate:
ipa-server-certinstall -d --pin=password /etc/dirsrv/slapd-IDM-EXAMPLE-COM/ldap.key /path/to/ldap.crt
# ipa-server-certinstall -d --pin=password /etc/dirsrv/slapd-IDM-EXAMPLE-COM/ldap.key /path/to/ldap.crtCopy to Clipboard Copied! Toggle word wrap Toggle overflow In the command above:
-
The
-doption specifies that you are installing a certificate into the LDAP server. -
The
--pinoption specifies the password protecting the private key.
-
The
-
When prompted, enter the
Directory Managerpassword. Restart the
httpdservice:systemctl restart httpd.service
# systemctl restart httpd.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the
Directoryservice:systemctl restart dirsrv@IDM-EXAMPLE-COM.service
# systemctl restart dirsrv@IDM-EXAMPLE-COM.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
- Execute the commands from the previous step on all the other affected replicas.