AI 에이전트의 경우: 문서 인덱스 https://www.mongodb.com/ko-kr/docs/llms.txt에서 확인할 수 있습니다 — 모든 URL 경로에 .md를 추가하면 모든 페이지의 마크다운 버전을 사용할 수 있습니다.
Make the MongoDB docs better! We value your opinion. Share your feedback for a chance to win $100.
MongoDB Branding Shape
Click here >
Docs Menu

단일 클러스터 LDAP 인증 구성

MongoDB Enterprise 는 다음을 지원합니다.

  • 인증 요청을 LDAP(Lightweight Directory Access Protocol) 서비스로 프록시합니다.

  • LDAP 서버에 대한 단순 및 SASL 바인딩. MongoDB Enterprise는 saslauthd 또는 운영 체제 라이브러리를 통해 LDAP 서버에 바인딩할 수 있습니다.

자세한 내용은 MongoDB Server 설명서의 LDAP 프록시 인증LDAP 권한 부여 섹션을 참조하세요.

Kubernetes 연산자를 사용하여 MongoDB 배포에 연결하는 클라이언트 애플리케이션을 인증하도록 LDAP를 구성할 수 있습니다. 이 가이드에서는 클라이언트 애플리케이션에서 MongoDB 배포로 LDAP 인증을 구성하는 방법을 설명합니다.

참고

Kubernetes cluster에서 MongoDB의 독립형 인스턴스를 보호할 수 없습니다.

MongoDB deployment에 대한 LDAP 인증을 구성하기 전에 다음 작업을 완료하세요.

  • MongoDB Enterprise 데이터베이스 리소스를 배포해야 합니다. MongoDB Community 데이터베이스는 LDAP 인증을 지원하지 않습니다.

  • 복제본 세트 를 배포하거나 LDAP 로 보호하려는 클라이언트 인증이 속한 cluster 를 배포합니다.

1

원하는 복제본 세트 구성과 일치하도록 이 YAML파일의 설정을 변경합니다.

1---
2apiVersion: mongodb.com/v1
3kind: MongoDB
4metadata:
5 name: <my-replica-set>
6spec:
7 members: 3
8 version: "8.0.0"
9 opsManager:
10 configMapRef:
11 # Must match metadata.name in ConfigMap file
12 name: <configMap.metadata.name>
13 credentials: <mycredentials>
14 type: ReplicaSet
15 persistent: true
16 security:
17 tls:
18 ca: <custom-ca>
19 certsSecretPrefix: <prefix>
20...
2

원하는 텍스트 편집기를 열고 섹션의 리소스 파일 끝에 객체 사양을 붙여넣습니다. spec

3

배포에서 LDAP 를 활성화하려면 Kubernetes 객체에서 다음 설정을 구성합니다.

유형 및 필요성
설명
예시

부울, 필수

LDAP 인증을 사용하려면 true 로 설정합니다.

true

문자열, 필수

LDAP 서버에 연결할 때 MongoDB가 바인딩할 LDAP 고유 이름을 지정합니다.

cn=admin,dc=example,dc=org

문자열, 필수

LDAP 서버 에 연결할 때 MongoDB 바인딩하는 LDAP 바인딩 고유 이름의 비밀번호가 포함된 시크릿 의 이름을 지정합니다.

<secret-name>

문자열,
선택 사항

배포서버의 TLS인증서에 서명하는 데 사용한 사용자 지정 CA를 저장하는 ConfigMap 의 이름을 추가합니다.

<configmap-name>

문자열,
선택 사항

LDAP 서버의 TLS 인증서의 유효성을 검사하는 CA 를 저장하는 필드 이름을 추가합니다.

<configmap-key>

문자열 배열 , 필수

하나 이상의 LDAP 서버의 hostname:port 조합 목록을 지정합니다. 각 서버에 대해 별도의 줄을 사용합니다.

<example.com:636>

문자열,
선택 사항

LDAPS( TLS 를 통한 LDAP )를 사용하려면 tls 로 설정합니다. LDAP 서버가 TLS를 허용하지 않는 경우 비워 둡니다. 이 설정을 사용하려면 데이터베이스 리소스를 배포할 때 TLS를 사용하도록 설정해야 합니다.

tls

문자열, 필수

인증을 위해 mongod 또는 mongos 에 제공된 사용자 이름을 LDAP DN(고유 이름)에 매핑하는 매핑을 지정합니다.

자세한 학습 은 MongoDB Server 설명서의 security.ldap.userToDNMappingLDAP 쿼리 템플릿 을 참조하세요.

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

문자열, 필수

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 연산자 MongoDB 리소스 사양의 보안 설정 을 참조하세요. LDAP 지원 Kubernetes 연산자 배포에서 MongoDB 에이전트 사용자에 대한 spec.security.authentication.agents.automationUserName 설정도 참조하세요.

4

Kubernetes 연산자 MongoDB 리소스 사양에서 Agent 관련 보안 설정 으로 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(watch) 플래그 설정이 적용된 경우, 구성이 변경되면 상태 단계가 Running 상태를 달성할 때까지 출력이 즉시 새로 고침 됩니다. 리소스 배포 상태에 대해 자세히 알아보려면 Kubernetes Operator 문제 해결을 참조하세요.

1

원하는 샤드 클러스터구성과 일치하도록 이 YAML 파일의 설정을 변경합니다.

1---
2apiVersion: mongodb.com/v1
3kind: MongoDB
4metadata:
5 name: <my-sharded-cluster>
6spec:
7 shardCount: 2
8 mongodsPerShardCount: 3
9 mongosCount: 2
10 configServerCount: 3
11 version: "8.0.0"
12 opsManager:
13 configMapRef:
14 name: <configMap.metadata.name>
15 # Must match metadata.name in ConfigMap file
16 credentials: <mycredentials>
17 type: ShardedCluster
18 persistent: true
19 security:
20 tls:
21 ca: <custom-ca>
22 certsSecretPrefix: <prefix>
23...
2

원하는 텍스트 편집기를 열고 섹션의 리소스 파일 끝에 객체 사양을 붙여넣습니다. spec

3

배포에서 LDAP 를 활성화하려면 Kubernetes 객체에서 다음 설정을 구성합니다.

유형 및 필요성
설명
예시

부울, 필수

LDAP 인증을 사용하려면 true 로 설정합니다.

true

문자열, 필수

LDAP 서버에 연결할 때 MongoDB가 바인딩할 LDAP 고유 이름을 지정합니다.

cn=admin,dc=example,dc=org

문자열, 필수

LDAP 서버 에 연결할 때 MongoDB 바인딩하는 LDAP 바인딩 고유 이름의 비밀번호가 포함된 시크릿 의 이름을 지정합니다.

<secret-name>

문자열,
선택 사항

배포서버의 TLS인증서에 서명하는 데 사용한 사용자 지정 CA를 저장하는 ConfigMap 의 이름을 추가합니다.

<configmap-name>

문자열,
선택 사항

LDAP 서버의 TLS 인증서의 유효성을 검사하는 CA 를 저장하는 필드 이름을 추가합니다.

<configmap-key>

문자열 배열 , 필수

하나 이상의 LDAP 서버의 hostname:port 조합 목록을 지정합니다. 각 서버에 대해 별도의 줄을 사용합니다.

<example.com:636>

문자열,
선택 사항

LDAPS( TLS 를 통한 LDAP )를 사용하려면 tls 로 설정합니다. LDAP 서버가 TLS를 허용하지 않는 경우 비워 둡니다. 이 설정을 사용하려면 데이터베이스 리소스를 배포할 때 TLS를 사용하도록 설정해야 합니다.

tls

문자열, 필수

인증을 위해 mongod 또는 mongos 에 제공된 사용자 이름을 LDAP DN(고유 이름)에 매핑하는 매핑을 지정합니다.

자세한 학습 은 MongoDB Server 설명서의 security.ldap.userToDNMappingLDAP 쿼리 템플릿 을 참조하세요.

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

문자열, 필수

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 연산자 MongoDB 리소스 사양의 보안 설정 을 참조하세요. LDAP 지원 Kubernetes 연산자 배포에서 MongoDB 에이전트 사용자에 대한 spec.security.authentication.agents.automationUserName 설정도 참조하세요.

4

Kubernetes 연산자 MongoDB 리소스 사양에서 Agent 관련 보안 설정 으로 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(watch) 플래그 설정이 적용된 경우, 구성이 변경되면 상태 단계가 Running 상태를 달성할 때까지 출력이 즉시 새로 고침 됩니다. 리소스 배포 상태에 대해 자세히 알아보려면 Kubernetes Operator 문제 해결을 참조하세요.