Created on 03-14-2016 05:54 AM
Enabling SSL encryption for the Web UIs that make up Hadoop is a tedious process that requires planning, learning to use security tools, and lots of mouse clicks through Ambari's UI. This article aims to simplify the process by presenting a semi-automated, start-to-finish example that enables SSL for the below Web UIs in the Hortonworks Sandbox:
There is no substitute for reading the documentation. If you plan on enabling SSL in a production cluster, then make sure you are familiar with SSL concepts and the communication paths between each HDP component. In addition, plan on cluster downtime. Here are some concepts that you should know well:
This part is rather easy. Install the HDP 2.4 Sandbox and follow the below steps. If you use an older version of the Sandbox note that you'll need to change the Ambari password used in the script.
wget "https://raw.githubusercontent.com/vzlatkin/EnableSSLinHDP/master/enable-ssl.sh"
/bin/bash enable-ssl.sh --all
There are two big reasons why enabling SSL in production can be more difficult than in a sandbox:
If you are using Ranger to secure anything besides HBase and HDFS then you will need to make changes to the script to enable extra plugins. The steps are similar to enabling SSL in Sanbox:
wget "https://raw.githubusercontent.com/vzlatkin/EnableSSLinHDP/master/enable-ssl.sh"
server1="example1.hortonworks.com" server2="example2.hortonworks.com" server3="example3.hortonworks.com" OOZIE_SERVER_ONE=$server2 NAMENODE_SERVER_ONE=$server1 RESOURCE_MANAGER_SERVER_ONE=$server3 HISTORY_SERVER=$server1 HBASE_MASTER_SERVER_ONE=$server2 RANGER_ADMIN_SERVER=$server1 ALL_NAMENODE_SERVERS="${NAMENODE_SERVER_ONE} $server2" ALL_OOZIE_SERVERS="${OOZIE_SERVER_ONE} $server3" ALL_HBASE_MASTER_SERVERS="${HBASE_MASTER_SERVER_ONE} $server3" ALL_HBASE_REGION_SERVERS="$server1 $server2 $server3" ALL_REAL_SERVERS="$server1 $server2 $server3" ALL_HADOOP_SERVERS="$server1 $server2 $server3" export AMBARI_SERVER=$server1 AMBARI_PASS=xxxx CLUSTER_NAME=cluster1
ca.crt example1.hortonworks.com.crt example1.hortonworks.com.key example2.hortonworks.com.crt example2.hortonworks.com.key example3.hortonworks.com.crt example3.hortonworks.com.key hortonworks.com.crt hortonworks.com.keyThe last certificate is needed for Oozie if you have Oozie HA enabled. The CN of that certificate should be CN=*.domainname.com as described hereIf you are NOT going to use a Public CA to sign your certificates, then change these lines in the script to be relevant to your organization:
/C=US/ST=New York/L=New York City/O=Hortonworks/OU=Consulting/CN=HortonworksCA
/bin/bash enable-ssl.sh --all
If you chose not to enable SSL for some components or decide to modify the script to include others (please send me a patch) then be aware of these dependencies:
openssl s_client -connect ${OOZIE_SERVER_ONE}:11443 -showcerts < /dev/null
oozie jobs -oozie https://${OOZIE_SERVER_ONE}:11443/oozie
keytool -list -storepass password -keystore /etc/hadoop/conf/hadoop-private-keystore.jks
cat example1.hortonworks.com.key example1.hortonworks.com.crt >> example1.hortonworks.com.pem curl --cacert /tmp/security/ca.crt --cert /tmp/security/example1.hortonworks.com.pem "https://example1.hortonworks.com:6182/service/plugins/policies/download/cluster1_hadoop?lastKnownVersion=3&pluginId=hdfs@example1.hortonworks.com-cluster1_hadoop"
Created on 04-24-2017 01:21 PM
I ran your script to enable SSL on HDP Sandbox. Ambari seems to be working fine, however when I try to go to the file browser or HiveView I'll get the following error messages:
0.0.0.0:50470: HTTPS hostname wrong: should be <0.0.0.0>
Service 'userhome' check failed: 0.0.0.0:50470: HTTPS hostname wrong: should be <0.0.0.0>
It looks like SSL is not working on port 50470. The unencrypted port 50070 is still working. How do I remedy this?
Created on 07-17-2017 04:41 PM
Great and useful article! I only found that after using your script to enable SSL, ambari crashes when trying to get the hive view due to certificates issue: Could you please provide me some hep with that? Thank you in advance Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching master1.pf0g2dnjye1ujcvq5102dppltf.ax.internal.cloudapp.net found
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1514) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026) at sun.security.ssl.Handshaker.process_record(Handshaker.java:961) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) at org.apache.ambari.server.controller.internal.URLStreamProvider.processURL(URLStreamProvider.java:209) at org.apache.ambari.server.view.ViewAmbariStreamProvider.getInputStream(ViewAmbariStreamProvider.java:118) at org.apache.ambari.server.view.ViewAmbariStreamProvider.readFrom(ViewAmbariStreamProvider.java:78) at org.apache.ambari.view.utils.ambari.URLStreamProviderBasicAuth.readFrom(URLStreamProviderBasicAuth.java:65) at org.apache.ambari.view.utils.ambari.AmbariApi.requestClusterAPI(AmbariApi.java:173) ... 97 more
Created on 01-18-2018 11:16 AM
Can you please modify the script(enable-ssl.sh) for using the configs.py and re-post?