MongoDB Enterpriseは以下をサポートします。
LDAP(Lightweight Directory Access Protocol)サービスへの認証リクエストをプロキシする。
LDAP サーバーへの簡易バインディングと SASL バインディング。 MongoDB Enterprise は、
saslauthdまたはオペレーティング システム ライブラリを介して LDAP サーバーにバインドできます。
詳細については、MongoDB Server ドキュメントの 「 LDAP プロキシ認証 」および 「 LDAP 認証 」セクションを参照してください。
Kubernetes Operator を使用して、マルチ Kubernetes クラスター MongoDB 配置に接続するクライアント アプリケーションを認証するためのLDAPを構成できます。 このガイドでは、クライアント アプリケーションからマルチ Kubernetes クラスター MongoDB 配置へのLDAP認証を構成する方法について説明します。
Considerations
CustomResourceDefinitions で LDAP を構成するには、 Kubernetes Operator MongoDBリソース仕様の の下のパラメーターとMongoDB Agent に固有のその他のセキュリティ
spec.security.authentication.ldapLDAP 設定を使用します。このセクションの手順では、必要な設定について説明し、LDAP 構成の例を示します。セキュリティを向上させるには、 TLS で暗号化されたマルチクラスターのデプロイを検討してください。 TLS による暗号化は任意です。デフォルトでは 、LDAP トラフィックはプレーン テキストとして送信されます。つまり、ユーザー名とパスワードがネットワークの攻撃に公開されます。 Microsoft Active Directory などの多くの最新のディレクトリサービスでは、暗号化された接続が必要です。 Kubernetes Operator MongoDB配置で認証リクエストを暗号化するために、TLS 経由で LDAP を使用することを検討してください。
前提条件
TLS暗号化を使用してマルチ Kubernetes クラスター MongoDB 配置を保護する前に、次のタスクを完了してください。
マルチ Kubernetes クラスター レプリカセットに対する LDAP クライアント認証の構成
MongoDBMultiClusterLDAP 認証を有効にするには、 リソースを更新します。
Kubernetes Operator MongoDB MultiCluster リソース仕様 のセキュリティ設定を使用し て MongoDB MultiCluster カスタム リソースを更新します 。
配置でLDAPを有効にするには、Kubernetes オブジェクトで次の設定を構成します。
キー | の種類と必要性 | 説明 | 例 |
|---|---|---|---|
| ブール値、必須 | LDAP 認証を有効にするには、 を |
|
| string(必須) | LDAP サーバーに接続するときに MongoDB がバインドする LDAP 識別名を指定します。 |
|
| string(必須) |
| |
| string(任意) | 配置の TLS 証明書に署名するために使用したカスタム CA を保存する ConfigMap の名前を追加します。 |
|
| string(任意) | LDAP サーバーの TLS 証明書を検証する CA を保存するフィールド名を追加します。 |
|
| 文字列の配列(必須) | 1 つ以上の LDAP サーバーの |
|
| string(任意) | LDAPS( TLS経由の LDAP )を使用するには、 を |
|
| string(必須) | 認証用に指定されたユーザー名を 詳しくは、 security.ldap.userToDNMappingを参照してください。 MongoDB Server ドキュメントの「 およびLDAP クエリ テンプレート」。 |
|
| string(必須) | 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 multi-cluster 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 MultiCluster リソース仕様の セキュリティ設定 を参照してください。 また、LDAP 対応の Kubernetes Operator ユーザー配置で MongoDB Agent ユーザーのspec.security.authentication.agents.automationUserName設定も参照してください。
MongoDBMultiClusterリソースが を実行中いることを確認します。
ノードクラスターの場合は、次のコマンドを実行して、MongoDB ポッドが実行状態であることを確認します。
kubectl get pods \ --context=$MDB_CLUSTER_1_FULL_NAME \ --namespace mongodb kubectl get pods \ --context=$MDB_CLUSTER_2_FULL_NAME \ --namespace mongodb kubectl get pods \ --context=$MDB_CLUSTER_3_FULL_NAME \ --namespace mongodb 演算子クラスターで次のコマンドを実行し、
MongoDBMultiClusterリソースが実行中状態であることを確認します。kubectl --context=$MDB_CENTRAL_CLUSTER_FULL_NAME \ --namespace mongodb \ get mdbmc multi-replica-set -o yaml -w