~~ Licensed under the Apache License, Version 2.0 (the "License"); ~~ you may not use this file except in compliance with the License. ~~ You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, software ~~ distributed under the License is distributed on an "AS IS" BASIS, ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~~ See the License for the specific language governing permissions and ~~ limitations under the License. See accompanying LICENSE file. --- Hadoop Map Reduce Next Generation-${project.version} - Encrypted Shuffle --- --- ${maven.build.timestamp} Hadoop MapReduce Next Generation - Encrypted Shuffle \[ {{{./index.html}Go Back}} \] * {Introduction} The Encrypted Shuffle capability allows encryption of the MapReduce shuffle using HTTPS and with optional client authentication (also known as bi-directional HTTPS, or HTTPS with client certificates). It comprises: * A Hadoop configuration setting for toggling the shuffle between HTTP and HTTPS. * A Hadoop configuration settings for specifying the keystore and truststore properties (location, type, passwords) used by the shuffle service and the reducers tasks fetching shuffle data. * A way to re-load truststores across the cluster (when a node is added or removed). * {Configuration} ** <> Properties To enable encrypted shuffle, set the following properties in core-site.xml of all nodes in the cluster: *--------------------------------------+---------------------+-----------------+ | <> | <> | <> | *--------------------------------------+---------------------+-----------------+ | <<>> | <<>> | Whether client certificates are required | *--------------------------------------+---------------------+-----------------+ | <<>> | <<>> | The hostname verifier to provide for HttpsURLConnections. Valid values are: <>, <>, <>, <> and <> | *--------------------------------------+---------------------+-----------------+ | <<>> | <<>> | The KeyStoresFactory implementation to use | *--------------------------------------+---------------------+-----------------+ | <<>> | <<>> | Resource file from which ssl server keystore information will be extracted. This file is looked up in the classpath, typically it should be in Hadoop conf/ directory | *--------------------------------------+---------------------+-----------------+ | <<>> | <<>> | Resource file from which ssl server keystore information will be extracted. This file is looked up in the classpath, typically it should be in Hadoop conf/ directory | *--------------------------------------+---------------------+-----------------+ <> Currently requiring client certificates should be set to false. Refer the {{{ClientCertificates}Client Certificates}} section for details. <> All these properties should be marked as final in the cluster configuration files. *** Example: ------ ... hadoop.ssl.require.client.cert false true hadoop.ssl.hostname.verifier DEFAULT true hadoop.ssl.keystores.factory.class org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory true hadoop.ssl.server.conf ssl-server.xml true hadoop.ssl.client.conf ssl-client.xml true ... ------ ** <<>> Properties To enable encrypted shuffle, set the following property in mapred-site.xml of all nodes in the cluster: *--------------------------------------+---------------------+-----------------+ | <> | <> | <> | *--------------------------------------+---------------------+-----------------+ | <<>> | <<>> | Whether encrypted shuffle is enabled | *--------------------------------------+---------------------+-----------------+ <> This property should be marked as final in the cluster configuration files. *** Example: ------ ... mapreduce.shuffle.ssl.enabled true true ... ------ The Linux container executor should be set to prevent job tasks from reading the server keystore information and gaining access to the shuffle server certificates. Refer to Hadoop Kerberos configuration for details on how to do this. * {Keystore and Truststore Settings} Currently <<>> is the only <<>> implementation. The <<>> implementation uses the following properties, in the <> and <> files, to configure the keystores and truststores. ** <<>> (Shuffle server) Configuration: The mapred user should own the <> file and have exclusive read access to it. *---------------------------------------------+---------------------+-----------------+ | <> | <> | <> | *---------------------------------------------+---------------------+-----------------+ | <<>> | <<>> | Keystore file type | *---------------------------------------------+---------------------+-----------------+ | <<>> | NONE | Keystore file location. The mapred user should own this file and have exclusive read access to it. | *---------------------------------------------+---------------------+-----------------+ | <<>> | NONE | Keystore file password | *---------------------------------------------+---------------------+-----------------+ | <<>> | <<>> | Truststore file type | *---------------------------------------------+---------------------+-----------------+ | <<>> | NONE | Truststore file location. The mapred user should own this file and have exclusive read access to it. | *---------------------------------------------+---------------------+-----------------+ | <<>> | NONE | Truststore file password | *---------------------------------------------+---------------------+-----------------+ | <<>> | 10000 | Truststore reload interval, in milliseconds | *--------------------------------------+----------------------------+-----------------+ *** Example: ------ ssl.server.keystore.type jks ssl.server.keystore.location ${user.home}/keystores/server-keystore.jks ssl.server.keystore.password serverfoo ssl.server.truststore.type jks ssl.server.truststore.location ${user.home}/keystores/truststore.jks ssl.server.truststore.password clientserverbar ssl.server.truststore.reload.interval 10000 ------ ** <<>> (Reducer/Fetcher) Configuration: The mapred user should own the <> file and it should have default permissions. *---------------------------------------------+---------------------+-----------------+ | <> | <> | <> | *---------------------------------------------+---------------------+-----------------+ | <<>> | <<>> | Keystore file type | *---------------------------------------------+---------------------+-----------------+ | <<>> | NONE | Keystore file location. The mapred user should own this file and it should have default permissions. | *---------------------------------------------+---------------------+-----------------+ | <<>> | NONE | Keystore file password | *---------------------------------------------+---------------------+-----------------+ | <<>> | <<>> | Truststore file type | *---------------------------------------------+---------------------+-----------------+ | <<>> | NONE | Truststore file location. The mapred user should own this file and it should have default permissions. | *---------------------------------------------+---------------------+-----------------+ | <<>> | NONE | Truststore file password | *---------------------------------------------+---------------------+-----------------+ | <<>> | 10000 | Truststore reload interval, in milliseconds | *--------------------------------------+----------------------------+-----------------+ *** Example: ------ ssl.client.keystore.type jks ssl.client.keystore.location ${user.home}/keystores/client-keystore.jks ssl.client.keystore.password clientfoo ssl.client.truststore.type jks ssl.client.truststore.location ${user.home}/keystores/truststore.jks ssl.client.truststore.password clientserverbar ssl.client.truststore.reload.interval 10000 ------ * Activating Encrypted Shuffle When you have made the above configuration changes, activate Encrypted Shuffle by re-starting all NodeManagers. <> Using encrypted shuffle will incur in a significant performance impact. Users should profile this and potentially reserve 1 or more cores for encrypted shuffle. * {ClientCertificates} Client Certificates Using Client Certificates does not fully ensure that the client is a reducer task for the job. Currently, Client Certificates (their private key) keystore files must be readable by all users submitting jobs to the cluster. This means that a rogue job could read such those keystore files and use the client certificates in them to establish a secure connection with a Shuffle server. However, unless the rogue job has a proper JobToken, it won't be able to retrieve shuffle data from the Shuffle server. A job, using its own JobToken, can only retrieve shuffle data that belongs to itself. * Reloading Truststores By default the truststores will reload their configuration every 10 seconds. If a new truststore file is copied over the old one, it will be re-read, and its certificates will replace the old ones. This mechanism is useful for adding or removing nodes from the cluster, or for adding or removing trusted clients. In these cases, the client or NodeManager certificate is added to (or removed from) all the truststore files in the system, and the new configuration will be picked up without you having to restart the NodeManager daemons. * Debugging <> Enable debugging only for troubleshooting, and then only for jobs running on small amounts of data. It is very verbose and slows down jobs by several orders of magnitude. (You might need to increase mapred.task.timeout to prevent jobs from failing because tasks run so slowly.) To enable SSL debugging in the reducers, set <<<-Djavax.net.debug=all>>> in the <<>> property; for example: ------ mapred.reduce.child.java.opts -Xmx-200m -Djavax.net.debug=all ------ You can do this on a per-job basis, or by means of a cluster-wide setting in the <<>> file. To set this property in NodeManager, set it in the <<>> file: ------ YARN_NODEMANAGER_OPTS="-Djavax.net.debug=all $YARN_NODEMANAGER_OPTS" ------