# LDAP内の接続データを格納

## `guacConfigGroup` オブジェクトクラスを定義 <a href="#id-.storingconnectiondatawithinldapv2.x-definingtheguacconfiggroupobjectclass" id="id-.storingconnectiondatawithinldapv2.x-definingtheguacconfiggroupobjectclass"></a>

接続データがLDAPディレクトリ内に格納されている場合、各接続は特殊なタイプのLDAPグループとして表現され、Keeperコネクションマネージャーの接続に関連する権限は、これらのグループへのユーザーのメンバーシップに基づいてLDAPで直接管理できます。この方法では、`guacConfigGroup` という新しいオブジェクトクラスを追加するスキーマ変更が必要となります。

スキーマ変更をOpenLDAPと互換性のある形式で定義したLDIFファイルが、`kcm-guacamole-auth-ldap` パッケージの中で `/opt/keeper/share/guacamole-auth-ldap/schema/guacConfigGroup.ldif` に提供されています。このファイルは、`ldapadd` コマンドを使用してOpenLDAPサーバーに適用できます。

{% code overflow="wrap" %}

```
$ sudo ldapadd -Q -Y EXTERNAL -H ldapi:/// -f /opt/keeper/share/guacamole-auth-ldap/schema/guacConfigGroup.ldif
```

{% endcode %}

このコマンドを実行すると、LDAPディレクトリ内に新しい `guacConfigGroup` オブジェクトを作成して、接続を定義できます。各 `guacConfigGroup` は、接続に関連付けられたプロトコルを定義する単一の`guacConfigProtocol` 属性と、それぞれが接続パラメータの名前と値のペアを定義する、任意の数の `guacConfigParameter` 属性を受け入れます。接続を利用する必要のあるユーザーは、`member` 属性を使用して `guacConfigGroup` のメンバーとして追加されなければなりません。

たとえば、VNCを使用し、パスワード「secret」でlocalhostのポート5900に接続する2人のユーザーがアクセスできる接続は、以下のLDIFファイルで定義できます。

```
dn: cn=Example Connection,ou=groups,dc=example,dc=net
objectClass: guacConfigGroup
objectClass: groupOfNames
cn:Example Connection
guacConfigProtocol: vnc
guacConfigParameter: hostname=localhost
guacConfigParameter: port=5900
guacConfigParameter: password=secret
member: cn=user1,ou=people,dc=example,dc=net
member: cn=user2,ou=people,dc=example,dc=net
```

## LDAPからの接続を読み取るようにKCMを設定 <a href="#id-.storingconnectiondatawithinldapv2.x-configuringguacamoletoreadconnectionsfromldap" id="id-.storingconnectiondatawithinldapv2.x-configuringguacamoletoreadconnectionsfromldap"></a>

#### Docker自動インストールおよびDocker Composeインストール

LDAPからの接続データを読み取るには、`/etc/kcm-setup/docker-compose.yml` ファイルを変更します。

LDAP内で定義されているすべての接続のベースDNは、`LDAP_CONFIG_BASE_DN` プロパティを使用して指定します。このベースDNは、そのサブツリーにLDAP経由でアクセス可能なすべてのKeeper接続を含むLDAPディレクトリの一部であるDNでなければなりません。このベースDNのサブツリー内で定義された接続のみが表示されます。

`EXTENSION_PRIORITY` [プロパティ](https://docs.keeper.io/jp/keeper-connection-manager/installation/docker-compose-install/keeper-guacamole)では、拡張機能がロードされる順序を指定します。以下の例では、`other-extensions` がLDAPより先にロードされるようになります。

```
   guacamole:
        image: keeper/guacamole:2
        environment:
            ACCEPT_EULA:"Y"
            GUACD_HOSTNAME: "guacd"
            MYSQL_HOSTNAME: "db"
            MYSQL_DATABASE: "guacamole_db"
            MYSQL_USERNAME: "guacamole_user"
            MYSQL_PASSWORD: "xxxxxxx"
            
            # LDAP Connection
            LDAP_HOSTNAME: "localhost"
            LDAP_PORT:389
            LDAP_ENCRYPTION_METHOD: "none"
            ADDITIONAL_GUACAMOLE_PROPERTIES: "extension-priority: *, ldap"
            
            ## Optional Settings ##
            # Read Connections from LDAP
            LDAP_CONFIG_BASE_DN: "ou=connections,dc=example,dc=net"
```

### グループメンバーシップを使用したアクセス制御 <a href="#id-.storingconnectiondatawithinldapv2.x-controllingaccessusinggroupmembership" id="id-.storingconnectiondatawithinldapv2.x-controllingaccessusinggroupmembership"></a>

#### Docker自動インストールおよびDocker Composeインストール

LDAPを使用してグループメンバーシップを管理するには、`/etc/kcm-setup/docker-compose.yml`ファイルを変更します。

`seeAlso` 属性を使用して、グループ全体に接続へのアクセス権を付与することもできます。この属性は、標準のLDAP属性であり、`LDAP_GROUP_BASE_DN`プロパティが定義されている場合、Keeperによって参照されます。このプロパティは、LDAPを使用して認証されたKeeperコネクションマネージャーユーザーに適用可能なすべてのグループを含むサブツリーのルートを定義します。

```
  guacamole:
        image: keeper/guacamole:2
        environment:
            ACCEPT_EULA:"Y"
            GUACD_HOSTNAME: "guacd"
            MYSQL_HOSTNAME: "db"
            MYSQL_DATABASE: "guacamole_db"
            MYSQL_USERNAME: "guacamole_user"
            MYSQL_PASSWORD: "xxxxxxx"
            
            # LDAP Connection
            LDAP_HOSTNAME: "localhost"
            LDAP_PORT:389
            LDAP_ENCRYPTION_METHOD: "none"
            ADDITIONAL_GUACAMOLE_PROPERTIES: "extension-priority: *, ldap"
            
            ## Optional Settings ##
            # Mapping Guacamole groups to LDAP DN's
            LDAP_GROUP_BASE_DN: "ou=groups,dc=example,dc=net"
            LDAP_GROUP_NAME_ATTRIBUTE: "cn"
```

### インストールを実行 <a href="#id-.storingconnectiondatawithinldapv2.x-completinginstallation" id="id-.storingconnectiondatawithinldapv2.x-completinginstallation"></a>

#### Dockerの自動インストールメソッド

```
sudo ./kcm-setup.run stop
sudo ./kcm-setup.run upgrade
```

#### Docker Composeのインストールメソッド

```
docker-compose stop
docker-compose up -d
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/jp/keeper-connection-manager/authentication/authenticating-users-with-ldap/storing-connection-data-within-ldap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
