2017年3月25日土曜日

Sandbox HDP 2.5.0でHadoop (HDFS, YARN, MR2) をSSL化する


備考:
事前にDockerをインストールする必要があります。
すでにDocker版のSandboxコンテナが作成済みの場合は、HTTPSに使われるポートをなんとかして開ける必要があります。

1)Sandboxをホストする側(Ubuntuとか)で、スクリプトをダウンロードしてソース
source ./start_hdp.sh

2)もしSandboxをまだインストールしていない場合、Docker版Sandboxをインストール
f_docker_sandbox_install

3)作業用フォルダを作成
mkdir ssl_setup; cd ssl_setup

f_ssl_self_signed_cert "/C=AU/ST=QLD/O=Hortonworks/CN=*.hortonworks.com" "server"

ls -ltr
total 28
-rw-r--r-- 1 root root 1679 Mar 25 08:35 server.key
-rw-r--r-- 1 root root  968 Mar 25 08:35 server.csr
-rw-r--r-- 1 root root 1131 Mar 25 08:35 server.crt
-rw-r--r-- 1 root root 2450 Mar 25 08:35 server.p12
-rw-r--r-- 1 root root 2147 Mar 25 08:35 server.keystore.jks
-rw-r--r-- 1 root root  857 Mar 25 08:35 server.truststore.jks
-rw-r--r-- 1 root root  857 Mar 25 08:35 client.truststore.jks

5)Sandboxに証明書をコピー
ssh root@sandbox.hortonworks.com -t "mkdir -p ${g_SERVER_KEY_LOCATION%/}"

scp ./*.jks root@sandbox.hortonworks.com:${g_SERVER_KEY_LOCATION%/}/

ssh root@sandbox.hortonworks.com -t "chmod 755 $g_SERVER_KEY_LOCATION
chown root:hadoop ${g_SERVER_KEY_LOCATION%/}/*.jks
chmod 440 ${g_SERVER_KEY_LOCATION%/}/$g_KEYSTORE_FILE
chmod 440 ${g_SERVER_KEY_LOCATION%/}/$g_TRUSTSTORE_FILE
chmod 444 ${g_SERVER_KEY_LOCATION%/}/$g_CLIENT_TRUSTSTORE_FILE"


core-site.xml
hadoop.ssl.require.client.cert=false
hadoop.ssl.hostname.verifier=DEFAULT
hadoop.ssl.keystores.factory.class=org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory
hadoop.ssl.server.conf=ssl-server.xml
hadoop.ssl.client.conf=ssl-client.xml
hdfs-site.xml
dfs.http.policy=HTTPS_ONLY    # HTTP_AND_HTTPS?
dfs.client.https.need-auth=false # trueの方がいい?
dfs.datanode.https.address=0.0.0.0:50475
dfs.namenode.https-address=sandbox.hortonworks.com:50470    # 0.0.0.0だとダメ?
mapred-site.xml
mapreduce.jobhistory.http.policy=HTTPS_ONLY
mapreduce.jobhistory.webapp.https.address=0.0.0.0:19889
yarn-site.xml
yarn.http.policy=HTTPS_ONLY
yarn.log.server.url=https://sandbox.hortonworks.com:19889/jobhistory/logs
yarn.resourcemanager.webapp.https.address=sandbox.hortonworks.com:8090
yarn.nodemanager.webapp.https.address=0.0.0.0:8044
ssl-server.xml
ssl.server.keystore.password=hadoop
ssl.server.keystore.location=/etc/hadoop/conf/secure/server.keystore.jks
ssl.server.keystore.type=jks
ssl.server.keystore.keypassword=hadoop
ssl.server.truststore.location=/etc/hadoop/conf/secure/server.truststore.jks
ssl.server.truststore.password=changeit
ssl.server.truststore.type=jks
ssl-client.xml
#ssl.client.keystore.location=/etc/security/clientKeys/keystore.jks # 必要ない?
ssl.client.truststore.location=/etc/hadoop/conf/secure/client.truststore.jks
ssl.client.truststore.password=changeit
tez-site.xml
tez.runtime.shuffle.ssl.enable=true
tez.runtime.shuffle.keep-alive.enabled=true

補足:おそらくKnoxからHDFSUIを使うには、NameNodeの証明書(server.crt)をKnoxのTrustStore(cacerts)に入れる必要がある。
 Knoxの証明書をExportしNameNodeのTrustStoreに入れる必要もある?

0 件のコメント:

コメントを投稿