Generate TLS Certificates🔗
The following procedure assumes that an internal certificate authority (CA) is used, and shows how to establish trust for that internal CA. If you are using a trusted public CA (such as Symantec, GeoTrust, Comodo, and others), you do not need to explicitly establish trust for the issued certificates, unless you are using an older JDK and a newer public CA. Older JDKs might not trust newer public CAs by default.
On Each Cluster Host:🔗
Complete the following steps on each cluster host, including the Cloudera Manager Server host.
-
Configure your environment to set
JAVA_HOME
to the Oracle JDK. For example:export JAVA_HOME=/usr/java/jdk1.8.0_141-cloudera
If you log out of the host before completing this procedure, make sure to setJAVA_HOME
again when you log in to complete the steps. -
Create the
/opt/cloudera/security/pki
directory:sudo mkdir -p /opt/cloudera/security/pki
If you choose to use a different directory, make sure you use the same directory on all cluster hosts to simplify management and maintenance. -
Use the
keytool
utility to generate a Java keystore and certificate signing request (CSR). Replace theOU
,O
,L
,ST
, andC
entries with the values for your environment. When prompted, use the same password for thekeystore password
andkey password
. Cloudera Manager does not support using different passwords for the key and keystore.$JAVA_HOME/bin/keytool -genkeypair -alias $(hostname -f) -keyalg RSA -keystore /opt/cloudera/security/pki/$(hostname -f).jks -keysize 2048 -dname "CN=$(hostname -f),OU=Engineering,O=Cloudera,L=Palo Alto,ST=California,C=US" -ext san=dns:$(hostname -f)
$JAVA_HOME/bin/keytool -certreq -alias $(hostname -f) -keystore /opt/cloudera/security/pki/$(hostname -f).jks -file /opt/cloudera/security/pki/$(hostname -f).csr -ext san=dns:$(hostname -f) -ext EKU=serverAuth,clientAuth
-
Submit the CSR files (for example,
cm01.example.com.csr
) to your certificate authority to obtain a server certificate.For security purposes, many commercial CAs ignore requested extensions in a CSR. Make sure that you inform the CA that you require certificates with both server and client authentication options.
If possible, obtain the certificate in PEM (Base64 ASCII) format. The certificate file is in PEM format if it looks similar to this (some lines omitted):-----BEGIN CERTIFICATE----- MIIDAzCCAesCAQAwgY0xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh MRIwEAYDVQQHEwlQYWxvIEFsdG8xETAPBgNVBAoTCENsb3VkZXJhMRQwEgYDVQQL … tudY0C32LjGjWOg5ALliN9Oy1u2xRKGAVfapbzAZ2rchtlCZc7mtaT6BXgW8S+Db 0HhuObn1/8TL4Ho9G+KlJB3MWik2oEbOvQt0rBidMr9qaNX86m0i7pouXZelZ5c5 UnDPtrhW6A== -----END CERTIFICATE-----
If your issued certificate is in binary (DER) format, convert it to PEM format.
-
After you have received the signed certificate, copy the signed certificate to the
following location:
/opt/cloudera/security/pki/$(hostname -f).pem
-
Inspect the signed certificate to verify that both server and client authentication
options are present, as well as the subject alternative name:
openssl x509 -in /opt/cloudera/security/pki/$(hostname -f).pem -noout -text
Look for output similar to the following to verify the server and client authentication options:
X509v3 Extended Key Usage: TLS Web Server Authentication, TLS Web Client Authentication
Look for output similar to the following to validate the subject alternative name:
X509v3 Subject Alternative Name: DNS:hostname.example.com
-
Copy the root and intermediate CA certificates to
/opt/cloudera/security/pki/rootca.pem
and/opt/cloudera/security/pki/intca.pem
on each host. If you have a concatenated file containing the root CA and an intermediate CA certificate, split the file along theEND CERTIFICATE
/BEGIN CERTIFICATE
boundary into individual files. If there are multiple intermediate CA certificates, use unique file names such asintca-1.pem
,intca-2.pem
, and so on. -
Copy the JDK
cacerts
file tojssecacerts
as follows:sudo cp $JAVA_HOME/jre/lib/security/cacerts $JAVA_HOME/jre/lib/security/jssecacerts
The Oracle JDK uses the
jssecacerts
file for its default truststore if it exists. Otherwise, it uses thecacerts
file. Creating thejssecacerts
file allows you to trust an internal CA without modifying thecacerts
file that is included with the JDK. -
Import the root CA certificate into the JDK truststore.
sudo $JAVA_HOME/bin/keytool -importcert -alias rootca -keystore $JAVA_HOME/jre/lib/security/jssecacerts -file /opt/cloudera/security/pki/rootca.pem
If you see a message like the following, enter
yes
to continue:Trust this certificate? [no]: yes
You must see the following response verifying that the certificate has been properly imported:Certificate was added to keystore
-
Append the intermediate CA certificate to the signed host certificate, and then
import it into the keystore. Make sure that you use the append operator
(
>>
) and not the overwrite operator (>
):sudo cat /opt/cloudera/security/pki/intca.pem >> /opt/cloudera/security/pki/$(hostname -f).pem
sudo $JAVA_HOME/bin/keytool -importcert -alias $(hostname -f) -file /opt/cloudera/security/pki/$(hostname -f).pem -keystore /opt/cloudera/security/pki/$(hostname -f).jks
If you see a message like the following, enter
yes
to continue:... is not trusted. Install reply anyway? [no]: yes
You must see the following response verifying that the certificate has been properly imported:Certificate reply was installed in keystore
If you do not see this response, contact Cloudera Support.
-
Create symbolic links (symlink) for the certificate and keystore files:
sudo ln -s /opt/cloudera/security/pki/$(hostname -f).pem /opt/cloudera/security/pki/agent.pem
This allows you to use the same
/etc/cloudera-scm-agent/config.ini
file on all agent hosts rather than maintaining a file for each agent.
On the Cloudera Manager Server Host🔗
sudo ln -s /opt/cloudera/security/pki/$(hostname -f).jks /opt/cloudera/security/pki/server.jks