第2章 セキュリティーレルム
セキュリティーレルムは、ユーザー ID にアクセスおよび検証する環境内のネットワークプロトコルおよびインフラストラクチャーと Data Grid Server デプロイメントを統合します。
2.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 を使用してプロパティーレルムに認証情報を追加すると、接続しているサーバーインスタンスにのみユーザーが作成されます。プロパティーレルムの認証情報をクラスター内の各ノードに手動で同期する必要があります。
手順
- Data Grid Server 設定を開いて編集します。
-
複数のセキュリティーレルムの作成を含めるには、
security設定のsecurity-realms要素を使用します。 security-realm要素でセキュリティーレルムを追加し、name属性の一意の名前を付けます。重要ハイフン (
-) やアンパサンド (&) などの特殊文字をセキュリティーレルム名に追加しないでください。セキュリティーレルム名に特殊文字が含まれていると、Data Grid Server エンドポイントに到達できなくなる可能性があります。この例に従うには、
ApplicationRealmという名前のセキュリティーレルムと、ManagementRealmという名前の 1 つのセキュリティーレルムを作成します。-
Data Grid Server の TLS/SSL 識別に
server-identities要素を指定して、必要に応じてキーストアを設定します。 以下の要素またはフィールド 1 つを追加して、セキュリティーレルムのタイプを指定します。
-
properties-realm -
ldap-realm -
token-realm -
truststore-realm
-
必要に応じて、設定するセキュリティーレルムタイプのプロパティーを指定します。
例に従うには、
user-propertiesおよびgroup-properties要素またはフィールドのpath属性を使用して、CLI で作成した*.propertiesファイルを指定します。-
複数の異なるタイプのセキュリティーレルムを設定に追加する場合は、
distributed-realm要素またはフィールドを含めて、Data Grid Server がレルムを相互に組み合わせて使用できるようにします。 -
security-realm属性でセキュリティーレルムを使用するように Data Grid Server エンドポイントを設定します。 - 変更を設定に保存します。
複数のプロパティーレルム
次の設定は、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"