Importing self-signed certificates to Java truststore
Import all the self-signed certificates in to the Java truststore using the
keytool utility.
To establish a secure, trusted connection for your applications, you must collect all the self-signed certificates of the control plane, Virtual Cluster, Spark Connect, and Cloudera Data Engineering service hostnames and add them to a Java truststore.
-
Identify the control plane hostname.
The control plane hostname is the host name present in the URL used to access the on premises control plane. For example, if https://console-cdp.apps.example.cloudera.com is the control plane URL, then console-cdp.apps.example.cloudera.com is the control plane hostname.
-
Identify the virtual cluster hostname.
- Select the Cloudera Data Engineering service containing the virtual cluster that you want to activate.
- Click Cluster Details.
- Click JOBS API URL to copy the URL to your clipboard.
-
Paste the URL into a text editor to identify the endpoint host.
For example, if the copied URL is https://dfdj6kgx.cde-2cdxw5x5.apps.ecs-demo.example.com/dex/api/v1, then the endpoint host is dfdj6kgx.cde-2cdxw5x5.apps.ecs-demo.example.com.
-
Identify the Spark Connect hostname.
Prefix sc- to the virtual cluster hostname identified in the previous step. For example, if the virtual cluster hostname is dfdj6kgx.cde-2cdxw5x5.apps.ecs-demo.example.com, then the Spark Connect hostname is sc-dfdj6kgx.cde-2cdxw5x5.apps.ecs-demo.example.com.
-
Identify the Cloudera Data Engineering service hostname.
- Select the Cloudera Data Engineering service containing the virtual cluster that you want to activate.
- Click Cluster Details.
- Click Grafana Charts to copy the URL to your clipboard.
-
Paste the URL into a text editor to identify the endpoint host.
For example, if the copied URL is https://service.cde-2cdxw5x5.apps.ecs-demo.example.com/grafana/249u4dnkfnkdf then the endpoint host is service.cde-2cdxw5x5.apps.ecs-demo.example.com.
-
Run the following commands to add all the certificates into the Java
truststore:
openssl s_client -connect [***CONTROL-PLANE-HOSTNAME***]:443 2>/dev/null </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > controlplane.pem openssl x509 -outform der -in controlplane.pem -out controlplane.der keytool -import -alias [***CONTROL-PLANE-NAME***] -cacerts -file controlplane.der openssl s_client -connect [***VIRTUAL-CLUSTER-HOSTNAME***]:443 2>/dev/null </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > vc.pem openssl x509 -outform der -in vc.pem -out vc.der keytool -import -alias [***VIRTUAL-CLUSTER-NAME***] -cacerts -file vc.der openssl s_client -connect [***SPARK-CONNECT-HOSTNAME***]:443 2>/dev/null </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' >> cacerts.pem openssl x509 -outform der -in sc.pem -out sc.der keytool -import -alias [***SPARK-CONNECT-NAME***] -cacerts -file sc.der openssl s_client -connect [***CDE-SERVICE-HOSTNAME***]:443 2>/dev/null </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > service.pem openssl x509 -outform der -in service.pem -out service.der keytool -import -alias [***CDE-SERVICE-NAME***] -cacerts -file service.der
