AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。

単一クラスター LDAP 認証の構成

MongoDB Enterpriseは以下をサポートします。

  • LDAP(Lightweight Directory Access Protocol)サービスへの認証リクエストをプロキシする。

  • LDAP サーバーへの簡易バインディングと SASL バインディング。 MongoDB Enterprise は、 saslauthdまたはオペレーティング システム ライブラリを介して LDAP サーバーにバインドできます。

詳細については、MongoDB Server ドキュメントの 「 LDAP プロキシ認証 」および 「 LDAP 認証 」セクションを参照してください。

Kubernetes Operator を使用して、MongoDB 配置に接続するクライアント アプリケーションを認証するための LDAP を構成できます。 このガイドでは、クライアント アプリケーションから MongoDB 配置への LDAP 認証を構成する方法について説明します。

注意

Kubernetes クラスターでは MongoDB のスタンドアロン インスタンスを保護することはできません。

MongoDB 配置の LDAP 認証を構成する前に、次のタスクを完了してください。

  • MongoDB Enterprise データベース リソースを配置することを確認します。 MongoDB Community データベースは LDAP 認証をサポートしていません。

  • レプリカセット を配置するか、 LDAP で保護するクライアント認証を持つシャーディングされ たクラスター を配置します。

1

このYAMLファイルの設定を、必要なレプリカセット構成に合わせて変更します。

---apiVersion: mongodb.com/v1kind: MongoDBmetadata: name: <my-replica-set>spec: members: 3 version: "8.0.0" opsManager: configMapRef: # Must match metadata.name in ConfigMap file name: <configMap.metadata.name> credentials: <mycredentials> type: ReplicaSet persistent: true
security: tls: ca: <custom-ca> certsSecretPrefix: <prefix>...
2

任意のテキスト エディターを開き、spec セクションのリソースファイルの末尾にオブジェクト仕様を貼り付けます。

3

配置でLDAPを有効にするには、Kubernetes オブジェクトで次の設定を構成します。

キー
の種類と必要性
説明
例

ブール値、
必須

LDAP 認証を有効にするには、 をtrueに設定します。

true

string,
required

LDAP サーバーに接続するときに MongoDB がバインドする LDAP 識別名を指定します。

cn=admin,dc=example,dc=org

string,
required

LDAPサーバーに接続するときにMongoDBがバインドする LDAP バインド識別名のパスワードを含むシークレットの名前を指定します。

<secret-name>

string、
任意

ConfigMap を追加する 配置の TLS 証明書に署名するために使用したカスタム CA を保存する の名前。

<configmap-name>

string、
任意

LDAP サーバーの TLS 証明書を検証する CA を保存するフィールド名を追加します。

<configmap-key>

文字列の配列、
必須

1 つ以上の LDAP サーバーのhostname:portの組み合わせのリストを指定します。 各サーバーには、個別の行を使用します。

<example.com:636>

string、
任意

LDAPS( TLS経由の LDAP )を使用するには、 をtlsに設定します。 LDAP サーバーが TLS を受け入れていない場合は、 を空白のままにします。 この設定を使用するには、データベース リソースを配置するときに TLS を有効にする必要があります。

tls

string,
required

認証用に指定されたユーザー名をmongodまたはmongosにマッピングするマッピングを指定しLDAP 。

詳しくは、 MongoDB Serverドキュメントの「security.ldap.userToDNMapping と LDAP クエリ テンプレート」を参照してください。

<match: "(.+)",substitution: "uid={0},ou=groups,dc=example,dc=org">

string,
required

LDAP による認証を有効にするには、 をLDAPに設定します。

LDAP

結果の構成は、次の例のようになります。

security: authentication: enabled: true # Enabled LDAP Authentication Mode modes: - "LDAP" - "SCRAM" # LDAP related configuration ldap: # Specify the hostname:port combination of one or # more LDAP servers servers: - "ldap1.example.com:636" - "ldap2.example.com:636" # Set to "tls" to use LDAP over TLS. Leave blank if # the LDAP server doesn't accept TLS. You must enable TLS when you deploy the database resource to use this setting. transportSecurity: "tls" # If TLS is enabled, add a reference to a ConfigMap that # contains a CA certificate that validates the LDAP server's # TLS certificate. caConfigMapRef: name: "<configmap-name>" key: "<configmap-entry-key>" # Specify the LDAP Distinguished Name to which # MongoDB binds when connecting to the LDAP server bindQueryUser: "cn=admin,dc=example,dc=org" # Specify the password with which MongoDB binds # when connecting to an LDAP server. This is a # reference to a Secret Kubernetes Object containing # one "password" key. bindQueryPasswordSecretRef: name: "<secret-name>"

LDAP 設定の完全なリストについては、 Kubernetes Operator MongoDB リソース仕様 のセキュリティ設定を参照してください。 また、LDAP 対応の Kubernetes Operator ユーザー配置で MongoDB Agent ユーザーのspec.security.authentication.agents.automationUserName設定も参照してください。

4

Kubernetes Operator MongoDB リソース仕様 から、エージェントに固有の セキュリティ設定 を使用し て MongoDB リソースを更新します 。結果の構成は、次の例のようになります。

security: authentication: agents: automationPasswordSecretRef: key: automationConfigPassword name: automation-config-password automationUserName: mms-automation-agent clientCertificateSecretRef: name: agent-client-cert mode: LDAP enabled: true ldap: bindQueryPasswordSecretRef: name: bind-query-password bindQueryUser: cn=admin,dc=example,dc=org servers: - openldap.namespace.svc.cluster.local:389 userToDNMapping: '[{match: "(.+)",substitution: "uid={0},ou=groups,dc=example,dc=org"}]' modes: - LDAP - SCRAM requireClientTLSAuthentication: false
5
6

レプリカセットを更新するには、次の Kubernetes コマンドを呼び出します。

kubectl apply -f <replica-set-conf>.yaml
7

MongoDBリソースのステータスを確認するには、次のコマンドを使用します。

kubectl get mdb <resource-name> -o yaml -w

-w (監視)フラグが設定されている場合、構成が変更されると、ステータスフェーズがRunning状態に達するまで出力が直ちに更新されます。 リソース配置ステータスの詳細については、 「 Kubernetes 演算子のトラブルシューティング 」を参照してください。

1

このYAMLファイルの設定を、シャーディングされたクラスターの構成に合わせて変更します。

---apiVersion: mongodb.com/v1kind: MongoDBmetadata: name: <my-sharded-cluster>spec: shardCount: 2 mongodsPerShardCount: 3 mongosCount: 2 configServerCount: 3 version: "8.0.0" opsManager: configMapRef: name: <configMap.metadata.name> # Must match metadata.name in ConfigMap file credentials: <mycredentials> type: ShardedCluster persistent: true
security: tls: ca: <custom-ca> certsSecretPrefix: <prefix>...
2

任意のテキスト エディターを開き、spec セクションのリソースファイルの末尾にオブジェクト仕様を貼り付けます。

3

配置でLDAPを有効にするには、Kubernetes オブジェクトで次の設定を構成します。

キー
の種類と必要性
説明
例

ブール値、
必須

LDAP 認証を有効にするには、 をtrueに設定します。

true

string,
required

LDAP サーバーに接続するときに MongoDB がバインドする LDAP 識別名を指定します。

cn=admin,dc=example,dc=org

string,
required

LDAPサーバーに接続するときにMongoDBがバインドする LDAP バインド識別名のパスワードを含むシークレットの名前を指定します。

<secret-name>

string、
任意

ConfigMap を追加する 配置の TLS 証明書に署名するために使用したカスタム CA を保存する の名前。

<configmap-name>

string、
任意

LDAP サーバーの TLS 証明書を検証する CA を保存するフィールド名を追加します。

<configmap-key>

文字列の配列、
必須

1 つ以上の LDAP サーバーのhostname:portの組み合わせのリストを指定します。 各サーバーには、個別の行を使用します。

<example.com:636>

string、
任意

LDAPS( TLS経由の LDAP )を使用するには、 をtlsに設定します。 LDAP サーバーが TLS を受け入れていない場合は、 を空白のままにします。 この設定を使用するには、データベース リソースを配置するときに TLS を有効にする必要があります。

tls

string,
required

認証用に指定されたユーザー名をmongodまたはmongosにマッピングするマッピングを指定しLDAP 。

詳しくは、 MongoDB Serverドキュメントの「security.ldap.userToDNMapping と LDAP クエリ テンプレート」を参照してください。

<match: "(.+)",substitution: "uid={0},ou=groups,dc=example,dc=org">

string,
required

LDAP による認証を有効にするには、 をLDAPに設定します。

LDAP

結果の構成は、次の例のようになります。

security: authentication: enabled: true # Enabled LDAP Authentication Mode modes: - "LDAP" - "SCRAM" # LDAP related configuration ldap: # Specify the hostname:port combination of one or # more LDAP servers servers: - "ldap1.example.com:636" - "ldap2.example.com:636" # Set to "tls" to use LDAP over TLS. Leave blank if # the LDAP server doesn't accept TLS. You must enable TLS when you deploy the database resource to use this setting. transportSecurity: "tls" # If TLS is enabled, add a reference to a ConfigMap that # contains a CA certificate that validates the LDAP server's # TLS certificate. caConfigMapRef: name: "<configmap-name>" key: "<configmap-entry-key>" # Specify the LDAP Distinguished Name to which # MongoDB binds when connecting to the LDAP server bindQueryUser: "cn=admin,dc=example,dc=org" # Specify the password with which MongoDB binds # when connecting to an LDAP server. This is a # reference to a Secret Kubernetes Object containing # one "password" key. bindQueryPasswordSecretRef: name: "<secret-name>"

LDAP 設定の完全なリストについては、 Kubernetes Operator MongoDB リソース仕様 のセキュリティ設定を参照してください。 また、LDAP 対応の Kubernetes Operator ユーザー配置で MongoDB Agent ユーザーのspec.security.authentication.agents.automationUserName設定も参照してください。

4

Kubernetes Operator MongoDB リソース仕様 から、エージェントに固有の セキュリティ設定 を使用し て MongoDB リソースを更新します 。結果の構成は、次の例のようになります。

security: authentication: agents: automationPasswordSecretRef: key: automationConfigPassword name: automation-config-password automationUserName: mms-automation-agent clientCertificateSecretRef: name: agent-client-cert mode: LDAP enabled: true ldap: bindQueryPasswordSecretRef: name: bind-query-password bindQueryUser: cn=admin,dc=example,dc=org servers: - openldap.namespace.svc.cluster.local:389 userToDNMapping: '[{match: "(.+)",substitution: "uid={0},ou=groups,dc=example,dc=org"}]' modes: - LDAP - SCRAM requireClientTLSAuthentication: false
5
6

次の Kubernetes コマンドを呼び出して、シャーディングされたクラスターを更新します。

kubectl apply -f <sharded-cluster-conf>.yaml
7

MongoDBリソースのステータスを確認するには、次のコマンドを使用します。

kubectl get mdb <resource-name> -o yaml -w

-w (監視)フラグが設定されている場合、構成が変更されると、ステータスフェーズがRunning状態に達するまで出力が直ちに更新されます。 リソース配置ステータスの詳細については、 「 Kubernetes 演算子のトラブルシューティング 」を参照してください。

このページを評価