2.3. 配置 Hot Rod 客户端加密


Data Grid Server 可以强制 SSL/TLS 加密,并呈现带有证书的 Hot Rod 客户端,以建立信任并协商安全连接。

要验证向 Data Grid Server 发布的证书,Hot Rod 客户端需要完整的证书链或以 Root CA 开头的部分链。您可以将服务器证书提供给 Hot Rod 客户端作为信任存储。

提示

另外,您还可以提供信任存储,您可以使用共享系统证书。

先决条件

  • 创建 Hot Rod 客户端可用于验证数据网格服务器身份的信任存储。
  • 如果您将 Data Grid Server 配置为验证或验证客户端证书,请根据情况创建密钥存储。

流程

  1. 使用 trustStoreFileName ()trustStorePassword () 方法或对应属性将信任存储添加到客户端配置中。
  2. 如果配置客户端证书身份验证,请执行以下操作:

    1. 使用 keyStoreFileName ()keyStorePassword () 方法或对应属性,将密钥存储添加到客户端配置中。
    2. 将客户端配置为使用 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");
Copy to Clipboard Toggle word wrap

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
Copy to Clipboard Toggle word wrap

后续步骤

将客户端信任存储添加到 $RHDG_HOME/server/conf 目录,并将 Data Grid Server 配置为使用它(如果需要)。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat