First, an argument could be made that all certificates are signed. They are either signed by itself (self-signed) or signed by a CA. In this article when we refer to signed certificates it is assumed that the certificates are NOT self-signed but instead were signed by a CA (Certificate Authority). Some CA's include: Verisign, GoDaddy, or maybe even an internal CA used by your company. You can tell whether a certificate is self-signed by looking at the details of the certificate. If the details reveal that the owner and issuer are the same then it is self-signed.
NOTE: It is worth mentioning that intermediate and root certificates are frequently referred to when talking about certificates being signed by a Certificate Authority. These are certificates that the CA have created on their end. They are used to sign your certificates. Many of the popular/reputable Certificate Authorities already have their intermediate and/or root certificates imported into the truststores used by operating systems, internet browsers and java. Sometimes you may see and need to do things with these certificates. For example: include them in your Java KeyStore. Don't be alarmed if you see an owner and issuer as the same. Root certificates are self-signed certificates (like described above). But those self-signed certificates are trusted because the CA is reputable. It's different than the self-signed certificates NOT created by by the CA which are untrustworthy.
The Secure Communications page in the product documentation describes how to secure the various CA Release Automation components using self-signed SSL certificates. This technical article is meant to cover the commands used to secure the following components using signed certificates:
The challenges doing this often relate to:
We will approach this by:
Note: The Instructions section separately secures datamanagement and automation studio. It is expected that each will be secured. Running with only a secured ROC or only a secured ASAP, etc.. has not been tested and is therefore not supported.
This is not a replacement for the instructions given in the Product Documentation. It is supplemental. The information in this article is meant to:
Most signed certificates are received in one of two ways:
Common File Types
The various file extensions are suggestive. Renaming a file does not change what it is. For example, I could take a file named serverA.cer and rename it to serverA.jks. That doesn't make it a valid Java KeyStore file. Similarly, using Microsoft Windows certmgr to export a public certificate in DER encoded binary x509 format and then changing its extension .pem mean make it a Base-64 encoded X.509 formatted file. Trying to look at a DER encoded binary x509 file is like trying to look at any other binary (exe, dll, etc..) - you see a majority of strange characters. Whereas opening/viewing a Base-64 encoded file shows characters recognizable from an alphanumeric keyboard. However, opening a Base-64 encoded file will not list all of the details of the certificate because it is still encoded. You will need to use the various commands/tools made available to view details of the certificates.
Datamanagement (Release Operations Center (ROC) / Rest API):
CA Release Automation's datamanagement component is what makes the ROC and REST API available. The datamanagement component is a tomcat application and can be configured to use custom SSL certificates. The following topics, in the Additional Information section below, assist preparing the Java KeyStore to be used by the datamanagement component:
The datamanagement component is secured by:
Automation Studio (ASAP):
The Automation Studio (ASAP) java application can be secured using custom SSL certificates. The following topics, in the Additional Information section below, assists with preparing the files necessary to do this:
Automation Studio is secured by:
JMX:
By default the JMX console does not use HTTPS|SSL. The webapps/datamanagement/WEB-INF/distributed.properties has entries that allow you to make changes to it. These are the settings that are related to configuring HTTPS|SSL for the JMX console:
Set this to true to use JMX over HTTPS|SSL.
This is the default Java KeyStore used for JMX. The reference to "conf" is pointing to the <MgmtServerInstallDirectory>/conf folder. If you're implementing your own certificates for the ROC and ASAP, and you want to configure JMX to use HTTPS|SSL, then you should point this to use the same Java KeyStore being used by the Datamanagement component as specified in the conf/server.xml.
This is the encrypted version of the Java KeyStore's password. To encrypt the password use the scripts/encrypt_password.sh|bat.
Changes to any/all of these settings require a restart of the nolio server service for the changes to be recognized.
Helpful URLs:
CA Release Automation Product Documentation: Secure Communications
X.509 v3 Standard (aka X.509, aka PKIX)
Public Certificates:
Understanding characteristics of a public certificate can be helpful while preparing the files used to secure CA Release Automation.
Private Keys:
Understanding the characteristics of a private key is important because it could present a major security risk. Here are some of the ways you can identify whether the file you have includes your private key. This
Viewing Certificates:
These commands can be used to better understand the certificates stored in the various certificate files you might have.
Securing Datamanagement:
To secure the datamanagement component with a signed certificate it's Java KeyStore needs:
For the purpose of securing the datamanagement component the private key is generated in one of two ways:
This is important because the subsequent commands used to get everything into the keystore will vary depending on whether the private key is generated with keytool or not.
Securing Automation Studio (ASAP):
To secure ASAP you need to:
Create nolio.jks
This nolio.jks Java KeyStore file should have one certificate - the signed certificate you receive from your CA. It should not have the private key. If it does then it presents a security risk since people will have access to this nolio.jks via the custom-truststore.jar file downloaded to workstations running ASAP. The two most common ways to create nolio.jks are:
Create custom-truststore.jar
Once your nolio.jks Java KeyStore has been set up, run the command below to archive it into a file named: custom-truststore.jar
Command: jar cvf custom-truststore.jar nolio.jks
Prepare codeSigning Java KeyStore
The custom-truststore.jar file gets transferred to the workstations running Automation Studio. ASAP checks for the custom-truststore.jar and uses it (if found) to get the nolio.jks. The nolio.jks file is then used to establish a secure connection and encrypt data sent between the java application and the management server. The custom-truststore.jar file needs to be signed by trusted certificate. Otherwise, the java settings prevent the application from running or at least prevent block access to that file (not sure which).
The KeyStore used by jarsigner (to sign the jar) needs:
For the purpose of securing Automation Studio the private key is generated in one of two ways:
This is important because the subsequent commands used to get everything into the keystore will vary depending on whether the private key is generated with keytool or not.
Sign custom-truststore.jar
Once your codeSigning KeyStore is ready, run the following command to sign the jar:
jarsigner -keystore <the keystore file with your codeSigning certificate> -verbose custom-truststore <alias of your codeSigning certificate>
Creating Private Key With Keytool:
If keytool is used to create the private key and you want/need a signed certificate then you'll need to run commands similar to the following:
Once the CSR file is created you need to send it to your Certificate Authority (CA).
Notes:
When your CA has signed the CSR you provided, you will receive one or more files. The next set of commands will depend on the file(s) that your CA sends you. It is unlikely that your CA will send you a pkcs12/.p12 file. One of the following sections below should be able to assist with importing the signed certificate into the Java KeyStore you just created here:
If your CA does send you a PKCS12/.P12 file then the Java KeyStore above can probably be discarded. Check the section "Import PKCS12/P12 into Java KeyStore" below and
Regardless of what kind of files you receive from your CA it is a good idea to make sure you have the expected keys and/or certificates in the KeyStore. Remember that the KeyStores used by Datamanagement and ASAP are different. See their respective sections for information on what's expected in each KeyStore. To help view and understand what is inside of the KeyStore you can use these sections:
Creating Private Key Without Keytool:
You could create the private key and generate the CSR with openssl and then send the CSR to your CA (Certificate Authority) to be signed. I don't think this will happen as often as submitting all of the necessary information to your CA who will then give you the private key and signed certificate. This section assumes you are submitting all of the necessary information to your CA who will then send you the private key and signed certificate.
When your CA has signed the CSR you provided, you will receive one or more files. The next set of commands will depend on the file(s) that your CA sends you. One of these sections below should be able to assist with importing the private key and signed certificate into a Java KeyStore:
Regardless of what kind of files you receive from your CA it is a good idea to make sure you have the expected keys and/or certificates in the KeyStore. Remember that the KeyStores used by Datamanagement and ASAP are different. See their respective sections for information on what's expected in each KeyStore. To help view and understand what is inside of the KeyStore you can use these sections:
Import PKCS7/P7B into Java KeyStore:
It is common for PKCS7 files to contain the signed certificate and its reply chain (see "Reply Chain" below). It is a good idea to verify that the p7b file that you have received is in a format that keytool will understand. Try opening your p7b file in notepad. If it looks like you tried opening a binary file then keytool will not be able to import this file. Instead, use the following command to convert it into a format that keytool will accept:
openssl pkcs7 -in <your p7b filename> -inform der -text > myNew.p7b
If you open your P7B file in notepad and are able to see that it starts with:
-----BEGIN PKCS7-----
and ends with:
-----END PKCS7-----
then keytool will be able to use this file and you can run the following command to import the certificate:
keytool -importcert -file <your p7b filename> -keystore <your keystore filename> -alias <the alias of your private key in the JKS>
Respond "yes" if the command returns with the message: ... is not trusted. Install reply anyway?
Note: The "... is not trusted, Install reply anyway" message may or may not be resolved with adding "-trustcacerts" to the command. If it is not solved by this then you might be importing a certificate that was signed by a Certificate Authority that is not already included in the default java truststore (lib/security/cacerts). If this is the case then you may need (at a minimum) the intermediate certificate imported into your internet browsers truststore before it considers it a secure/trusted site.
If you are importing the certificate into a KeyStore with a private key (as should be done for the datamanagement component, but not ASAP) then the alias is important. If it is not the alias of your private key then it will not properly link the signed certificate to the private key and it will not work. See keytool's importcert details regarding alias here:
https://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html#keytool_option_importcert
When you properly import and link the signed certificate into a keystore with its private key the keytool command should return the following response: Certificate reply was installed in keystore
Import X509 into Java KeyStore:
See "Reply Chains" section below regarding the need to import the appropriate intermediate and root certificates. If the intermediate(s) and root certificates are x509 then the same command can be used to import them to - just with a different alias. The command to import these certificates (regardless of whether its DER encoded binary Base-64 encoded ASCII) is:
keytool -importcert -file <your x509 certificate file> -keystore <your jks file> -alias <an alias>
If you are importing the certificate into a KeyStore with a private key (as should be done for the datamanagement component, but not ASAP) then the alias is important. If it is not the alias of your private key then it will not properly link the signed certificate to the private key and it will not work. See keytool's importcert details regarding alias here:
https://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html#keytool_option_importcert
When you properly import and link the signed certificate into a keystore with its private key the keytool command should return the following response: Certificate reply was installed in keystore
Import PKCS12/P12 into Java KeyStore:
If you have a PKCS12/P12 file from your CA then it is possible that it has everything you need (private key, signed certificate, and reply chain). You can use this command to import everything from the .p12 file into a new Java KeyStore file using this command:
keytool -importkeystore -srckeystore <your p12 filename> -srcstoretype PKCS12 -destkeystore <new jks filename> -deststoretype JKS
ServerAuth / TLS Web Server Authentication Certificates:
As documented in RFC5280 the serverAuth EKU (Extended Key Usage) is for: TLS WWW server authentication
A certificate that has been signed with this EKU can be verified by viewing the details of the certificate (see "Viewing Certificates" section above).
To verify if a KeyStore's certificate has the serverAuth EKU look for this:
ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
serverAuth
]
To verify if a signed certificate's x509, pkcs7/p7b or pkcs12/p12 file has the serverAuth EKU look for this:
X509v3 Extended Key Usage:
TLS Web Server Authentication
Note: Securing the datamanagement component needs a certificate signed with this EKU.
CodeSigning Certificates:
As documented in RFC5280 the codeSigning EKU (Extended Key Usage) is for: Signing of downloadable executable code
A certificate that has been signed with this EKU can be verified by viewing the details of the certificate (see "Viewing Certificates" section above).
To verify if a KeyStore's certificate has the codeSigning EKU look for this:
ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
codeSigning
]
To verify if a signed certificate's x509, pkcs7/p7b or pkcs12/p12 file has the serverAuth EKU look for this:
X509v3 Extended Key Usage:
Code Signing
Note: Securing the ASAP needs a certificate signed with this EKU.
Reply Chains:
Reply chains refer to the intermediate(s) and root certificates involved in signing your certificate. For example:
You send a CSR to your CA who signs the certificate. We'll call it certC. CertC was signed by a intermediate certificate (we'll call it intCertA). IntCertB was signed by a root certificate (we'll call it RootCertA). RootCertA was signed by itself.
If you're certificate was signed by a trusted CA (ex: Verisign) then you can probably add the -trustcacerts to the keytool -importcerts command you use to import CertC into your Java KeyStore. The -trustcacerts instructs keytool to look at its /path/to/jre's/lib/security/cacerts truststore to look for the reply chain's certificates. If it finds it then it will import them into the Java KeyStore along with CertC. If it doesn't find them and:
then keytool will return the error: keytool error: java.lang.Exception: Failed to establish chain from reply
But this also depends on the file you're using to import CertC. For example, it is not uncommon for pkcs12/p12 and pkcs7/p7b files to have the reply chain included.