搜索

2.2. 为客户端证书配置信任存储和信任管理器

download PDF

使用客户端证书和信任管理器配置信任存储,并引用信任存储,以便在 TLS 握手期间验证客户端证书。

先决条件

流程

  1. 使用管理 CLI 使用客户端证书配置信任存储。

    1. 创建服务器信任存储,以存储要信任的客户端证书。

      语法

      /subsystem=elytron/key-store=<server_trust_store_name>:add(path=<path_to_server_trust_store_file>,credential-reference={<password>})

      Example

      /subsystem=elytron/key-store=exampleServerTrustStore:add(path=exampleTLSServer.truststore,relative-to=jboss.server.config.dir,credential-reference={clear-text=secret})
      {"outcome" => "success"}

    2. 通过指定客户端证书别名,将客户端证书导入到服务器信任存储中。只有提供服务器信任存储信任的证书的客户端才能连接到服务器。

      注意

      如果您使用自签名证书配置双向 SSL/TLS,请将 validate 设置为 false,因为证书没有信任链。

      如果您要使用 CA 签名的证书在生产环境中配置双向 SSL/TLS,请将 validate 设置为 true

      语法

      /subsystem=elytron/key-store=<server_trust_store_name>:import-certificate(alias=<alias>,path=<certificate_file>,credential-reference={<password>},trust-cacerts=<true_or_false>,validate=<true_false>)

      Example

      /subsystem=elytron/key-store=exampleServerTrustStore:import-certificate(alias=client,path=client.cer,relative-to=jboss.server.config.dir,credential-reference={clear-text=serverTrustSecret},trust-cacerts=true,validate=false)
      {"outcome" => "success"}

    3. 将客户端证书导出到信任存储文件中。

      语法

      /subsystem=elytron/key-store=<server_trust_store_name>:store()

      Example

      /subsystem=elytron/key-store=exampleServerTrustStore:store()
      {
          "outcome" => "success",
          "result" => undefined
      }

  2. 配置信任管理器,以在 TLS 握手过程中验证客户端证书。

    语法

    /subsystem=elytron/trust-manager=<trust_manager_name>:add(key-store=<server_trust_store_name>)

    Example

    /subsystem=elytron/trust-manager=exampleTLSTrustManager:add(key-store=exampleServerTrustStore)
    {"outcome" => "success"}

配置的信任存储中的客户端证书用于验证客户端在与服务器的 TLS 握手期间显示的证书。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.