ZooKeeper 用 SSL/TLS の設定
ThingWorx HA クラスタを使用している場合、ZooKeeper 用に SSL または TLS を設定できます。
ZooKeeper の設定
1. SSL または TLS をサポートするバージョンの ZooKeeper を実行していることを確認します。
2. SSL 証明書と信頼ストアを取得します。
拡張子が JKS、PEM、および PKCS12(p12) の証明書のみを使用できます。
3. apache-zookeeper-[バージョン]-bin/conf に移動し、zoo.cfg を更新するか作成します。
4. 以下のエントリを追加します。
dataDir=/<path-to-zookeeper-data>/data
dataLogDir=/<path-to-zookeeper-datalog>/datalog
secureClientPort=2281
tickTime=2000
initLimit=5
syncLimit=2
autopurge.snapRetainCount=3
autopurge.purgeInterval=0
maxClientCnxns=60
admin.enableServer=true
standaloneEnabled=false
quorumListenOnAllIPs=true
sslQuorum=true
ZooKeeper ノード間のクォーラムをアクティブ化するには、zoo.cfg ファイルで変数 sslQuorum=true を設定します。これらのノードは自動生成された SSL を使用してクォーラムをセキュリティ保護します。
5. <ZooKeeper へのパス>/bin/zkServer.sh を修正します
.
export SERVER_JVMFLAGS="
-Dzookeeper.serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory
-Dzookeeper.ssl.keyStore.location=<path-to-zookeeper-certificates>/zookeeper.p12
-Dzookeeper.ssl.keyStore.password=<certificate-password>
-Dzookeeper.ssl.trustStore.location=<path-to-zookeeper-certificates>/truststore.p12
-Dzookeeper.ssl.trustStore.password=<truststore-password>
-Dzookeeper.ssl.quorum.keyStore.location=<path-to-zookeeper-certificates>/zookeeper.p12
-Dzookeeper.ssl.quorum.keyStore.password=<certificate-password>
-Dzookeeper.ssl.quorum.trustStore.location=<path-to-zookeeper-certificates>/truststore.p12
-Dzookeeper.ssl.quorum.trustStore.password=<truststore-password>
-Dzookeeper.ssl.quorum.hostnameVerification=false
6. ZooKeeper を起動します。
./zkServer.sh start
7. ログで、コンフィギュレーションが正しいことを確認します。
tail -f apache-zookeeper-3.5.6-bin/logs/<zookeeper-log-file>
ThingWorx の設定
1. ZooKeeper の証明書をインスタンスにコピーするか、ThingWorx が実行されているマシンで使用可能であることを確認します。
2. platform-settings.json を修正して、ファイルの末尾に PlatformSettingsConfig と同じレベルのルートエレメントとして以下を追加します。
"ZookeeperSettings": {
"SSLEnabled": "true",
# If SSL is enabled, you must include the following; trust store is optional:
"KeyStorePath": "<path-to-zookeeper-certificates>/zookeeper.p12",
"KeyStorePass": "<certificate-password>",
"TrustStorePath": "<path-to-zookeeper-certificates>/truststore.p12",
"TrustStorePass": "<truststore-password>"
"SASLEnabled": "false",
# If SASL is enabled, you must include the following:
"JaasConfPath": "/tmp1/jaas.conf",
"Krb5ConfPath": "/tmp1/krb5.conf"
}
3. デフォルトの ZooKeeper ポート 2181 をサーチし、これをセキュリティ保護されたポート 2281 に置き換えます。
4. すべての CoordinatorHosts エントリと address-resolver > connection ports が更新されて zoo.cfgsecureClientPort の値と一致していることを確認します。
Ignite の設定
1. Ignite の証明書を ThingWorx インスタンスにコピーするか、Ignite サーバーが動作しているマシンで使用可能であることを確認します。
2. 環境変数 ZOOKEEPER_CONNECTION を設定し、Ignite の起動に使用される環境変数 JVM_XOPTS を見つけて以下のように更新します。
# zookeeper1 represents the host name where zookeeper is available and 2281 the secure port from zoo.cfg
export ZOOKEEPER_CONNECTION=zookeeper1:2281,zookeeper2:2281,zookeeper3:2281
# update the JVM_XOPTS
JVM_XOPTS=-Dzookeeper.clientCnxnSocket=org.apache.zookeeper.ClientCnxnSocketNetty -Dzookeeper.client.secure=true -Dzookeeper.ssl.keyStore.location=<path-to-zookeeper-certificates>/zookeeper.p12 -Dzookeeper.ssl.keyStore.password=<keystore-password> -Dzookeeper.ssl.trustStore.location=<path-to-zookeeper-certificates>/truststore.p12 -Dzookeeper.ssl.trustStore.password=<truststore-password>
接続サーバーの設定
1. ZooKeeper の証明書をインスタンスにコピーするか、接続サーバーが動作しているマシンで使用可能であることを確認します。
2. 接続サーバーのコンフィギュレーションファイルで、セキュリティ保護されたポートを使用するように cx-server.discovery.connectionString のポートを更新します。
例: cx-server.discovery.connectionString = "{zookeeper-host}:2281"
3. 環境変数 CONNECTION_SERVER_OPTS に以下のシステムプロパティを追加します。
例:
export CONNECTION_SERVER_OPTS="
-Dzookeeper.clientCnxnSocket=org.apache.zookeeper.ClientCnxnSocketNetty
-Dzookeeper.client.secure=true
-Dzookeeper.ssl.keyStore.location=<path-to-zookeeper-certificates>/zookeeper.p12
-Dzookeeper.ssl.keyStore.password=<keystore-password>
-Dzookeeper.ssl.trustStore.location=<path-to-zookeeper-certificates>/truststore.p12
-Dzookeeper.ssl.trustStore.password=<truststore-password>"
ThingWorx セキュリティ管理ツールを使用したパスワードの暗号化
プレーンテキストのパスワードを platform-settings.json ファイルに挿入しないようにする場合、セキュリティツールを使用して twx-keystore 内のパスワードを暗号化できます。encrypt.zk.keystore.password を使用してキーストアのパスワードを暗号化し、encrypt.zk.truststore.password を使用して信頼ストアのパスワードを暗号化する必要があります。
./security-common-cli keystore.conf set encrypt.zk.keystore.password "ptcptc"
次に、ThingWorx がキーストアからパスワードを取得するように platform-settings.json ファイルを変更します。
"KeyStorePass": "encrypt.zk.keystore.password",
"TrustStorePass": "encrypt.zk.truststore.password"
これは役に立ちましたか?