2.6. Using a private CA to issue certificates for CSRs with OpenSSL
To establish a TLS-encrypted data exchange channel, systems must obtain valid certificates from a certificate authority (CA). If you have a private CA, you can create the requested certificates by signing certificate signing requests (CSRs) from the systems.
Prerequisites
- You have already configured a private CA. See the Creating a private CA by using OpenSSL section for more information.
- You have a file containing a CSR. You can find an example of creating the CSR in the 2.4절. “Creating a private key and a CSR for a TLS server certificate by using OpenSSL” section.
Procedure
Optional: Use a text editor of your choice to prepare an OpenSSL configuration file for adding extensions to certificates, for example:
$ vim <openssl.cnf> [server-cert] extendedKeyUsage = serverAuth [client-cert] extendedKeyUsage = clientAuthNote that the previous example illustrates only the principle and
openssldoes not add all extensions to the certificate automatically. You must add the extensions you require either to the CNF file or append them to parameters of theopensslcommand.Use the
x509utility to create a certificate based on a CSR, for example:$ openssl x509 -req -in <server_cert.csr> -CA <ca.crt> -CAkey <ca.key> -days 365 -extfile <openssl.cnf> -extensions <server_cert> -out <server_cert.crt> Signature ok subject=C = US, O = Example Organization, CN = server.example.com Getting CA Private KeyTo increase security, delete the serial-number file before you create another certificate from a CSR. This way, you ensure that the serial number is always random. If you omit the
CAserialoption for specifying a custom file name, the serial-number file name is the same as the file name of the certificate, but its extension is replaced with the.srlextension (server-cert.srlin the previous example).