搜索

第 5 章 安全域

download PDF

Security realms 将 Data Grid Server 部署与控制访问权限的环境中的网络协议和基础架构集成,并验证用户身份。

5.1. 创建安全域

将安全域添加到 Data Grid 服务器配置,以控制对部署的访问。您可以在配置中添加一个或多个安全域。

注意

在配置中添加安全域时,Data Grid 服务器会自动为 Hot Rod 和 REST 端点启用匹配的身份验证机制。

先决条件

  • 根据需要在 Data Grid Server 配置中添加套接字绑定。
  • 创建密钥存储或 PEM 文件,以使用 TLS/SSL 加密配置安全域。

    数据网格服务器也可以在启动时生成密钥存储。

  • 调配安全域配置所依赖的资源或服务。
    例如,如果添加令牌域,则需要置备 OAuth 服务。

此流程演示了如何配置多个属性域。开始之前,您需要创建添加用户的属性文件并使用命令行接口(CLI)分配权限。使用用户 创建命令,如下所示:

user create <username> -p <changeme> -g <role> \
     --users-file=application-users.properties \
     --groups-file=application-groups.properties

user create <username> -p <changeme> -g <role> \
     --users-file=management-users.properties \
     --groups-file=management-groups.properties
提示

如需示例和更多信息,运行 user create --help

注意

使用 CLI 将凭证添加到 properties realm 中,只能在您连接的服务器实例上创建用户。您必须手动将 properties 域中的凭证同步到集群中的每个节点。

流程

  1. 打开 Data Grid Server 配置进行编辑。
  2. 使用安全配置中的 security -realms 元素来包含多个安全域。
  3. 添加具有 security-realm 元素的安全域,并为它指定具有 name 属性的唯一名称。

    要遵循该示例,请创建一个名为 application-realm 的安全域,以及另一个名为 management-realm 的安全域:

  4. 提供 Data Grid Server 的 TLS/SSL,可根据需要配置服务器 识别元素并配置密钥存储。
  5. 通过添加以下元素或字段来指定安全域类型:

    • properties-realm
    • ldap-realm
    • token-realm
    • truststore-realm
  6. 根据情况指定您要配置的安全域类型的属性。

    要跟踪示例,请使用 user-propertiesgroup-properties 元素或字段上的 path 属性指定通过 CLI 创建的 *.properties 文件。

  7. 如果您在配置中添加多种不同类型的安全域,请包括 distributed-realm 元素或字段,以便 Data Grid 服务器将 realm 与彼此结合使用。
  8. 配置 Data Grid Server 端点,将安全域与 security-realm 属性搭配使用。
  9. 保存对您的配置的更改。

多个属性域

XML

<server xmlns="urn:infinispan:server:14.0">
  <security>
    <security-realms>
      <security-realm name="application-realm">
        <properties-realm groups-attribute="Roles">
          <user-properties path="application-users.properties"/>
          <group-properties path="application-groups.properties"/>
        </properties-realm>
      </security-realm>
      <security-realm name="management-realm">
        <properties-realm groups-attribute="Roles">
          <user-properties path="management-users.properties"/>
          <group-properties path="management-groups.properties"/>
        </properties-realm>
      </security-realm>
    </security-realms>
  </security>
</server>

JSON

{
  "server": {
    "security": {
      "security-realms": [{
        "name": "management-realm",
        "properties-realm": {
          "groups-attribute": "Roles",
          "user-properties": {
            "digest-realm-name": "management-realm",
            "path": "management-users.properties"
          },
          "group-properties": {
            "path": "management-groups.properties"
          }
        }
      }, {
        "name": "application-realm",
        "properties-realm": {
          "groups-attribute": "Roles",
          "user-properties": {
            "digest-realm-name": "application-realm",
            "path": "application-users.properties"
          },
          "group-properties": {
            "path": "application-groups.properties"
          }
        }
      }]
    }
  }
}

YAML

server:
  security:
    securityRealms:
      - name: "management-realm"
        propertiesRealm:
          groupsAttribute: "Roles"
          userProperties:
            digestRealmName: "management-realm"
            path: "management-users.properties"
          groupProperties:
            path: "management-groups.properties"
      - name: "application-realm"
        propertiesRealm:
          groupsAttribute: "Roles"
          userProperties:
            digestRealmName: "application-realm"
            path: "application-users.properties"
          groupProperties:
            path: "application-groups.properties"

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.