環境
製品 | バージョン |
Pivotal GemFire | 8.x |
OS | RHEL 6.x |
事象
SSL 設定が必要な際に、"Certificate is not recognized" といったエラーが発生することがある。本記事では、SSL 設定方法について解説する。
事前要件
GemFire クライアントから GemFire ロケーターやサーバーへの SSL 通信を有効にしようとすると、以下の例外が出力されることがある。
"Certificate is not recognized".
注意: SSL 設定のため事前に以下の手順に従っているものとする。
- クライアントのために公開鍵と秘密鍵のキーペアを新規に生成
- 自己署名証明書をエクスポート
- エクスポートした自己署名証明書を、以下のようなクライアント側の JRE キーストアにインポート
例)/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/security/cacerts
- 同様に、当該自己証明証明書を GemFire のロケーターやサーバーで使用するキーストア(例えば、gemfire8.keystore)にインポート
- 以上の設定で、クライアントが GemFire 分散システムへ接続を試みようとすると、証明書が認識できないといった致命的な例外がスロー
加えて、以下のようにプロパティを設定しているものとする。
gemfire-server.properties:
mcast-port=0
locators=localhost[10334]
log-level=config
cache-xml-file=../config/server-cache.xml
statistic-sampling-enabled=true
statistic-sample-rate=1000
statistic-archive-file=myStatisticsArchiveFile.gfs
enable-time-statistics=false
jmx-manager-ssl-enabled=false
cluster-ssl-enabled=true
cluster-ssl-require-authentication=false
gfsecurity.properties:
cluster-ssl-keystore=/Users/gemfire/Documents/gemfire/security/gemfire8.keystore
cluster-ssl-keystore-password=password
cluster-ssl-truststore=/Users/gemfire/Documents/gemfire/security/gemfire8.keystore
cluster-ssl-truststore-password=password
locator.properties:
mcast-port=0
log-level=config
locators=localhost[10334]
cluster-ssl-enabled=true
server-ssl-require-authentication=false
gemfire-client.properties:
mcast-port=0
log-level=config
log-file=gemClient.log
ssl-enabled=true
解決策
Java クライアントは、サーバー側の GemFire プロパティーと同様のものを適用するので、クライアント側でもgfsecurity.properties ファイルにキーストアの格納先を指定する必要がある。
"ssl-*" といったプロパティーは使用しないようにしたい。この形式の設定は現バージョンでは廃止されており、"cluster-ssl-*" といった一連のプロパティーを設定したい。
ロケーターはキャッシュサーバーではないので、"server-ssl-*" といった一連のプロパティーは設定しないようにしたい。しかしながら、クライアントがロケーターに接続する際には認証は不要なので、"cluster-ssl-require-authentication=false" は設定するようにしたい。
一度上述の設定変更が完了すると、以下のような API コールで ClientCachence が生成可能となる。
ClientCache cache = new ClientCacheFactory().set("name", "GemClient")
.set("log-level", "info")
.set("cluster-ssl-enabled", "true")
.set("cache-xml-file","gemfire/config/clientCache.xml").create();
コメント