第5章 セキュリティーレルム

セキュリティーレルムは、ユーザー ID にアクセスおよび検証する環境内のネットワークプロトコルおよびインフラストラクチャーと Data Grid Server デプロイメントを統合します。

5.1. セキュリティーレルムの作成

セキュリティーレルムを Data Grid Server 設定に追加し、デプロイメントへのアクセスを制御します。設定に 1 つ以上のセキュリティーレルムを追加できます。

注記

設定にセキュリティーレルムを追加すると、Data Grid Server は Hot Rod および REST エンドポイントの一致する認証メカニズムを自動的に有効にします。

前提条件

  • 必要に応じて、ソケットバインディングを Data Grid Server 設定に追加します。
  • キーストアを作成するか、PEM ファイルがあり、TLS/SSL 暗号化でセキュリティーレルムを設定します。

    Data Grid Server は起動時にキーストアを生成することもできます。

  • セキュリティーレルム設定に依存するリソースまたはサービスをプロビジョニングします。
    たとえば、トークンレルムを追加する場合は、OAuth サービスをプロビジョニングする必要があります。

この手順では、複数のプロパティーレルムを設定する方法を説明します。開始する前に、ユーザーを追加し、コマンドラインインターフェイス (CLI) でパーミッションを割り当てるプロパティーファイルを作成する必要があります。user create コマンドを使用します。

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 を使用してプロパティーレルムに認証情報を追加すると、接続しているサーバーインスタンスにのみユーザーが作成されます。プロパティーレルムの認証情報をクラスター内の各ノードに手動で同期する必要があります。

手順

  1. Data Grid Server 設定を開いて編集します。
  2. 複数のセキュリティーレルムの作成を含めるには、security 設定の security-realms 要素を使用します。
  3. security-realm 要素でセキュリティーレルムを追加し、name 属性の一意の名前を付けます。

    重要

    ハイフン (-) やアンパサンド (&) などの特殊文字をセキュリティーレルム名に追加しないでください。セキュリティーレルム名に特殊文字が含まれていると、Data Grid Server エンドポイントに到達できなくなる可能性があります。

    この例に従うには、ApplicationRealm という名前のセキュリティーレルムと、ManagementRealm という名前の 1 つのセキュリティーレルムを作成します。

  4. Data Grid Server の TLS/SSL 識別に server-identities 要素を指定して、必要に応じてキーストアを設定します。
  5. 以下の要素またはフィールド 1 つを追加して、セキュリティーレルムのタイプを指定します。

    • properties-realm
    • ldap-realm
    • token-realm
    • truststore-realm
  6. 必要に応じて、設定するセキュリティーレルムタイプのプロパティーを指定します。

    例に従うには、user-properties および group-properties 要素またはフィールドの path 属性を使用して、CLI で作成した *.properties ファイルを指定します。

  7. 複数の異なるタイプのセキュリティーレルムを設定に追加する場合は、distributed-realm 要素またはフィールドを含めて、Data Grid Server がレルムを相互に組み合わせて使用できるようにします。
  8. security-realm 属性でセキュリティーレルムを使用するように Data Grid Server エンドポイントを設定します。
  9. 変更を設定に保存します。

複数のプロパティーレルム

次の設定は、XML、JSON、または YAML 形式で複数のセキュリティーレルムを設定する方法を示しています。

XML

<server xmlns="urn:infinispan:server:13.0">
  <security>
    <security-realms>
      <security-realm name="ApplicationRealm">
        <properties-realm groups-attribute="Roles">
          <user-properties path="application-users.properties"/>
          <group-properties path="application-groups.properties"/>
        </properties-realm>
      </security-realm>
      <security-realm name="ManagementRealm">
        <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": "ManagementRealm",
        "properties-realm": {
          "groups-attribute": "Roles",
          "user-properties": {
            "digest-realm-name": "ManagementRealm",
            "path": "management-users.properties"
          },
          "group-properties": {
            "path": "management-groups.properties"
          }
        }
      }, {
        "name": "ApplicationRealm",
        "properties-realm": {
          "groups-attribute": "Roles",
          "user-properties": {
            "digest-realm-name": "ApplicationRealm",
            "path": "application-users.properties"
          },
          "group-properties": {
            "path": "application-groups.properties"
          }
        }
      }]
    }
  }
}

YAML

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