3.4. 配置 Hot Rod 客户端加密
数据网格服务器可以实施 SSL/TLS 加密,并展示带有证书的 Hot Rod 客户端,以建立信任并协商安全连接。
要验证向 Data Grid Server 发布的证书,Hot Rod 客户端需要完整证书链或以 Root CA 开头的部分链。您可以将服务器证书提供给 Hot Rod 客户端,作为信任存储。
提示
或者提供信任存储,您可以使用共享系统证书。
先决条件
- 创建一个信任存储,Hot Rod 客户端可用于验证 Data Grid 服务器身份。
- 如果您配置 Data Grid Server 以验证或验证客户端证书,请根据需要创建一个密钥存储。
流程
-
使用
trustStoreFileName()
和trustStorePassword()
方法或对应的属性将信任存储添加到客户端配置中。 如果配置客户端证书身份验证,请执行以下操作:
-
使用
keyStoreFileName()
和keyStorePassword()
方法或对应的属性将密钥存储添加到客户端配置中。 -
配置客户端以使用
EXTERNAL
身份验证机制。
-
使用
ConfigurationBuilder
ConfigurationBuilder clientBuilder = new ConfigurationBuilder(); clientBuilder .addServer() .host("127.0.0.1") .port(11222) .security() .ssl() // Server SNI hostname. .sniHostName("myservername") // Keystore that contains the public keys for Data Grid Server. // Clients use the trust store to verify Data Grid Server identities. .trustStoreFileName("/path/to/server/truststore") .trustStorePassword("truststorepassword".toCharArray()) .trustStoreType("PCKS12") // Keystore that contains client certificates. // Clients present these certificates to Data Grid Server. .keyStoreFileName("/path/to/client/keystore") .keyStorePassword("keystorepassword".toCharArray()) .keyStoreType("PCKS12") .authentication() // Clients must use the EXTERNAL mechanism for certificate authentication. .saslMechanism("EXTERNAL");
hotrod-client.properties
infinispan.client.hotrod.server_list = 127.0.0.1:11222 infinispan.client.hotrod.use_ssl = true infinispan.client.hotrod.sni_host_name = myservername # Keystore that contains the public keys for Data Grid Server. # Clients use the trust store to verify Data Grid Server identities. infinispan.client.hotrod.trust_store_file_name = server_truststore.pkcs12 infinispan.client.hotrod.trust_store_password = changeme infinispan.client.hotrod.trust_store_type = PCKS12 # Keystore that contains client certificates. # Clients present these certificates to Data Grid Server. infinispan.client.hotrod.key_store_file_name = client_keystore.pkcs12 infinispan.client.hotrod.key_store_password = changeme infinispan.client.hotrod.key_store_type = PCKS12 # Clients must use the EXTERNAL mechanism for certificate authentication. infinispan.client.hotrod.sasl_mechanism = EXTERNAL
后续步骤
将客户端信任存储添加到 $RHDG_HOME/server/conf
目录中,并在必要时配置 Data Grid Server 来使用它。
其他资源
- 加密数据网格服务器连接
- SslConfigurationBuilder
- 热备份客户端配置属性
- 使用共享系统证书 (Red Hat Enterprise Linux 7 安全指南)