AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

BI Connector용 TLS 구성

BI Connector가 데이터를 안전하게 전송하려면 MongoDB 인스턴스, mongosqld 인스턴스 및 BI 도구에서 TLS(전송 계층 보안) 암호화를 활성화해야 합니다. TLS 구성에 대한 전체 설명은 이 문서의 범위를 벗어나지만, 이 튜토리얼에서는 테스트 목적으로 자체 TLS 인증서를 만들고 TLS 가 활성화된 상태에서 MongoDB 구성 요소를 시작하는 프로세스를 간략하게 설명합니다.

중요

이 절차는 테스트 목적으로만 사용하세요. 프로덕션 환경은 공인된 CA(인증 기관)에서 발급한 TLS 인증서를 사용해야 합니다.

To ensure read availability for your MongoDB replica sets and sharded clusters while BI Connector enables TLS, use a rolling upgrade procedure. While the replica set primary upgrades, applications must wait until after failover and election cycle completes.

This tutorial contains instructions on creating several files which allow a mongosqld process to accept OpenSSL encrypted connections from an SQL client, such as the MySQL shell, and make an encrypted connection with a mongod instance. We create two .pem files. Each file contains an encryption key and a self-signed TLS certificate.

1
  1. Windows cmd 프롬프트를 사용하여 인증서를 저장할 디렉토리를 만듭니다. 이 튜토리얼에서는 C:\opt\certs 을(를) 사용합니다.

    mkdir C:\opt\certs
    cd C:\opt\certs
  2. 이 튜토리얼에서는 OpenSSL 디렉토리가 C:\OpenSSL 에 있다고 가정합니다. 시스템의 다른 곳에 있는 경우 명령을 적절히 편집하거나 디렉토리를 C:\OpenSSL 로 이동합니다.

    C:\OpenSSL\bin 디렉토리에 openssl.cfg 라는 이름의 구성 파일이 없으면 새로 만듭니다.

    예시

    다음은 예시 구성 파일입니다.

    #
    # OpenSSL configuration file.
    #
    # Establish working directory.
    dir = .
    [ ca ]
    default_ca = CA_default
    [ CA_default ]
    serial = $dir/serial
    database = $dir/certindex.txt
    new_certs_dir = $dir/certs
    certificate = $dir/cacert.pem
    private_key = $dir/private/cakey.pem
    default_days = 365
    default_md = md5
    preserve = no
    email_in_dn = no
    nameopt = default_ca
    certopt = default_ca
    policy = policy_match
    [ policy_match ]
    countryName = match
    stateOrProvinceName = match
    organizationName = match
    organizationalUnitName = optional
    commonName = supplied
    emailAddress = optional
    [ req ]
    default_bits = 1024
    default_keyfile = key.pem
    default_md = md5
    string_mask = nombstr
    distinguished_name = req_distinguished_name
    req_extensions = v3_req
    [ req_distinguished_name ]
    # Variable name Prompt string
    #--------------------------- ----------------------------------
    0.organizationName = Organization Name (company)
    organizationalUnitName = Organizational Unit Name (department, division)
    emailAddress = Email Address
    emailAddress_max = 40
    localityName = Locality Name (city, district)
    stateOrProvinceName = State or Province Name (full name)
    countryName = Country Name (2 letter code)
    countryName_min = 2
    countryName_max = 2
    commonName = Common Name (hostname, IP, or your name)
    commonName_max = 64
    # Default values for the above, for consistency and less typing.
    # Variable name Value
    #--------------------------- ------------------------------
    0.organizationName_default = My Company
    localityName_default = My Town
    stateOrProvinceName_default = State or Providence
    countryName_default = US
    [ v3_ca ]
    basicConstraints = CA:TRUE
    subjectKeyIdentifier = hash
    authorityKeyIdentifier = keyid:always,issuer:always
    [ v3_req ]
    basicConstraints = CA:FALSE
    subjectKeyIdentifier = hash
  3. 나중에 사용할 수 있도록 환경 변수를 설정합니다.

    set OPENSSL_CONF=C:\OpenSSL\bin\openssl.cfg
2
  1. 디렉토리를 C:\opt\certs 로 변경합니다.

    cd C:\opt\certs
  2. OpenSSL 애플리케이션을 시작합니다.

    C:\OpenSSL\bin\openssl.exe
    C:\Users\username>cd C:\opt\certs
    C:\Users\username>C:\OpenSSL\bin\openssl.exe
    OpenSSL>
  3. 다음 명령은 비공개 키를 생성하고 mdbprivate.key 에 출력합니다.

    genrsa -out C:\opt\certs\mdbprivate.key -aes256 \
    -passout pass:password
  4. 다음 명령은 인증 기관 파일을 생성하고 mdbca.crt 에 출력합니다.

    다음 명령은 사용자에게 인증서 요청에 통합된 몇 가지 정보를 입력하라는 메시지를 표시합니다. 필드 중 하나의 이름은 FQDN(정규화된 도메인 이름)인 Common Name 입니다. 튜토리얼의 이 단계에서 생성된 인증서의 Common Name 항목은 3단계와 9단계에서 생성된 인증서의 Common Name 항목과 달라야 합니다.

    req -x509 -new -key C:\opt\certs\mdbprivate.key -days 1000 -out C:\opt\certs\mdbca.crt -passin pass:password

이제 mdbca.crt 인증 기관 파일과 해당 요청에 서명하는 데 사용된 mdbprivate.key 키라는 두 개의 파일이 있습니다.

3

The following command generates a key for the mongod process TLS use and a CSR. For this step, the Common Name response must be the FQDN of the server where your mongod instance TLS such as www.example.com.

OpenSSL 프롬프트에 다음 명령을 입력합니다.

req -new -nodes -newkey rsa:2048 -keyout .\mdb.key -out .\mdb.csr
4

OpenSSL 프롬프트에 다음 명령을 입력합니다.

x509 -CA .\mdbca.crt -CAkey .\mdbprivate.key -CAcreateserial -req -days 1000 -in .\mdb.csr -out .\mdb.crt -passin pass:password
5

.pem 파일은 함께 연결된 키와 인증서로 구성됩니다. MongoDB 인스턴스에서 사용할 .pem 파일을 만들려면 OpenSSL 프롬프트를 종료하고 C:\opt\certs 디렉토리의 cmd 프롬프트에 다음 명령을 입력합니다.

copy .\mdb.key + .\mdb.crt mdb.pem

이제 인증서 디렉토리에 다음 파일이 있어야 합니다.

mdb.crt
mdb.csr
mdb.key
mdb.pem
mdbca.crt
mdbprivate.key

누락된 항목이 있는 경우 이전 단계로 Go 오류가 있는지 확인합니다.

6

To configure mongod to require TLS for incoming connections, modify your configuration file as follows. Your values may vary, depending on where you created your TLS files.

옵션

requireSSL

C:\opt\certs\mdb.pem

C:\opt\certs\mdbca.crt

C:\opt\certs\mdb.pem

x509

예시

다음 구성 파일 TLS 연결 및 x.509 인증 대한 지시문이 포함되어 있습니다.

구성 파일에는 추가 또는 다른 옵션이 필요할 수 있습니다.

systemLog:
destination: file
path: 'C:\data\mongod.log'
logAppend: true
net:
bindIp: <step-3-FQDN>
port: 27017
ssl:
mode: requireSSL
PEMKeyFile: 'C:\opt\certs\mdb.pem'
CAFile: 'C:\opt\certs\mdbca.crt'
clusterFile: 'C:\opt\certs\mdb.pem'
security:
clusterAuthMode: x509
storage:
dbPath: 'C:\data\db'

If you prefer to start mongod with command-line options instead of a configuration file, see mongosqld for equivalent options.

7
mongod.exe --config C:\path\to\mongod.conf
8

Connect to your server with the mongo shell to test your TLS connection. Your mongo command needs the following TLS options:

옵션

none

C:\opt\certs\mdbca.crt (2d단계에서 생성된 파일)

C:\opt\certs\mdb.pem (5단계에서 생성된 파일)

.\mongo.exe --ssl --host <step3-common-name> ^
--sslCAFile "C:\opt\certs\mdbca.crt" ^
--sslPEMKeyFile "C:\opt\certs\mdb.pem"

옵션을 적절히 편집합니다.

9

The Common Name entry for this CSR should match the FQDN of the server where you run mongosqld.

참고

CSR의 Common Name 항목은 2단계에서 생성한 첫 번째 CSR의 Common Name 항목과 달라야 합니다.

OpenSSL 애플리케이션을 시작하고 OpenSSL 프롬프트에 다음 명령을 입력합니다.

req -new -nodes -newkey rsa:2048 -keyout .\bi.key -out .\bi.csr
10

OpenSSL 프롬프트에 다음 명령을 입력합니다.

x509 -CA .\mdbca.crt -CAkey .\mdbprivate.key -CAcreateserial -req -days 1000 -in .\bi.csr -out .\bi.crt -passin pass:password
11

OpenSSL 애플리케이션을 종료하고 cmd 프롬프트에 다음 명령을 입력합니다.

copy .\bi.key + .\bi.crt bi.pem
12

Your mongosqld configuration file requires several TLS-specific options. Your values may vary, depending on where you created your TLS certificates and .pem files.

옵션

true

C:\opt\certs\mdb.pem

C:\opt\certs\mdbca.crt

requireSSL

C:\opt\certs\bi.pem

C:\opt\certs\mdbca.crt

다음 예제 구성 파일C:\opt\certs 디렉토리에 있는 파일을 사용합니다. 를 실행하고 데이터베이스에서 읽을 mongosqld 수 있는 충분한 권한 을 가진 MongoDB 사용자에 해당하는 사용자 이름과 비밀번호를 test 지정합니다.

systemLog:
logAppend: false
path: 'C:\logs\mongosqld.log'
verbosity: 2
security:
enabled: true
mongodb:
net:
uri: <step-3-FQDN>
auth:
username: <username>
password: <password>
ssl:
enabled: true
PEMKeyFile: 'C:\opt\certs\mdb.pem'
CAFile: 'C:\opt\certs\mdbca.crt'
net:
bindIp: localhost
port: 3307
ssl:
mode: 'requireSSL'
PEMKeyFile: 'C:\opt\certs\bi.pem'
CAFile: 'C:\opt\certs\mdbca.crt'
schema:
sample:
namespaces: 'test.*'

mongosqld --config 구성 파일을 사용하려면 옵션으로 를 시작합니다.

.\mongosqld --config C:\path\to\mongosqld.conf
13

TLS 를 통해 연결되는 ODBC DSN 을 만들려면 DSN 튜토리얼 의 지침에 따라 TLS 인증서 경로 정보로 새 DSN 을 구성합니다.

DSN 구성 화면 스크린샷

참고

SSL Certificate 필드에 인증서 경로를 입력할 필요가 없습니다.

DSN 구성 화면의 Connection 탭에서 Enable Cleartext Authentication 이라고 표시된 상자를 선택합니다.

DSN 구성 화면 스크린샷

ODBC 연결을 테스트하려면 Test 버튼을 클릭합니다.

DSN 을 설정한 후에는 이를 사용하여 Power BI 또는 Qlik Sense와 같은 여러 BI 도구에 연결할 수 있습니다.

1

Create a directory to hold your certificates. This tutorial uses /opt/certs. Your certificate directory must be readable by the system user which runs the mongod and mongosqld programs.

mkdir /opt/certs
cd /opt/certs
2
  1. 다음 명령은 비공개 키를 생성하고 mdbprivate.key 에 출력합니다.

    openssl genrsa -out /opt/certs/mdbprivate.key -aes256 \
    -passout pass:password
  2. 다음 명령은 인증 기관 파일을 생성하고 mdbca.crt 에 출력합니다.

    다음 명령은 사용자에게 인증서 요청에 통합된 몇 가지 정보를 입력하라는 메시지를 표시합니다. 필드 중 하나의 이름은 FQDN(정규화된 도메인 이름)인 Common Name 입니다. 튜토리얼의 이 단계에서 생성된 인증서의 Common Name 항목은 3단계와 9단계에서 생성된 인증서의 Common Name 항목과 달라야 합니다.

    openssl req -x509 -new -key /opt/certs/mdbprivate.key \
    -days 1000 -out /opt/certs/mdbca.crt \
    -passin pass:password

이제 mdbca.crt 인증 기관 파일과 해당 요청에 서명하는 데 사용된 mdbprivate.key 키라는 두 개의 파일이 있습니다.

3

The following command generates a key for the mongod process to use and a Certificate Signing Request (CSR). The Common Name response must be the Fully Qualified Domain Name (FQDN) of the host where your mongod instance runs such as www.example.com. To determine the FQDN of your server, use hostname -f at the command prompt.

Extra Attribute 요소에 대한 과제 비밀번호를 입력하라는 메시지가 표시될 수 있습니다. 이 튜토리얼에서는 이 요소를 비워 둘 수 있습니다.

openssl req -new -nodes -newkey rsa:2048 -keyout /opt/certs/mdb.key \
-out /opt/certs/mdb.csr
4
openssl x509 -CA /opt/certs/mdbca.crt
-CAkey /opt/certs/mdbprivate.key \
-CAcreateserial -req -days 1000 \
-in /opt/certs/mdb.csr -out /opt/certs/mdb.crt \
-passin pass:password
5

.pem 파일 은 함께 연결된 키와 인증서로 구성됩니다. MongoDB 인스턴스 에서 사용할 .pem 파일 을 만들려면 /opt/certs/ 디렉토리 에 다음 명령을 입력합니다.

cat /opt/certs/mdb.key /opt/certs/mdb.crt > /opt/certs/mdb.pem

이제 인증서 디렉토리에 다음 파일이 있어야 합니다.

mdb.crt
mdb.csr
mdb.key
mdb.pem
mdbca.crt
mdbprivate.key

누락된 항목이 있는 경우 이전 단계로 Go 오류가 있는지 확인합니다.

6

To configure mongod to require TLS for incoming connections, modify your configuration file as follows. Your values may vary, depending on where you created your TLS files.

옵션

requireSSL

/opt/certs/mdb.pem

/opt/certs/mdbca.crt

/opt/certs/mdb.pem

security.clusterAuthmode

x509

예시

The following configuration file contains directives for TLS connections and x.509 authentication.

구성 파일에는 추가 또는 다른 옵션이 필요할 수 있습니다.

systemLog:
destination: file
path: '/data/mongod.log'
logAppend: true
processManagement:
fork: true
pidFilePath: '/data/mongod.pid'
net:
bindIp: localhost
port: 27017
ssl:
mode: requireSSL
PEMKeyFile: '/opt/certs/mdb.pem'
CAFile: '/opt/certs/mdbca.crt'
clusterFile: '/opt/certs/mdb.pem'
security:
clusterAuthMode: x509
storage:
dbPath: '/data'

If you prefer to start mongod with command-line options instead of a configuration file, see mongosqld for equivalent options.

7
mongod --config /path/to/mongod.conf
8

Connect to your server with the mongo shell to test your TLS connection. Your mongo command needs the following TLS options:

옵션

none

/opt/certs/mdbca.crt ( 2.2 단계에서 생성된 파일 )

/opt/certs/mdb.pem (5단계에서 생성된 파일)

mongo --tls --host <step3-common-name> \
--tlsCAFile /opt/certs/mdbca.crt \
--tlsPEMKeyFile /opt/certs/mdb.pem

옵션을 적절히 편집합니다.

9

The Common Name entry for this CSR should match the FQDN of the host where you run mongosqld. To determine the FQDN of your host, use hostname -f at the command prompt.

Extra Attribute 요소에 대한 과제 비밀번호를 입력하라는 메시지가 표시될 수 있습니다. 이 튜토리얼에서는 이 요소를 비워 둘 수 있습니다.

참고

CSR의 Common Name 항목은 2단계에서 생성한 첫 번째 CSR의 Common Name 항목과 달라야 합니다.

openssl req -new -nodes -newkey rsa:2048 \
-keyout /opt/certs/bi.key \
-out /opt/certs/bi.csr
10
openssl x509 -CA /opt/certs/mdbca.crt \
-CAkey /opt/certs/mdbprivate.key \
-CAcreateserial -req -days 1000 \
-in /opt/certs/bi.csr -out /opt/certs/bi.crt \
-passin pass:password
11
cat /opt/certs/bi.key /opt/certs/bi.crt > /opt/certs/bi.pem
12

mongosqld 구성 파일 에는 몇 가지 TLS관련 옵션이 필요합니다. 이 값은 TLS 파일을 생성한 위치에 따라 달라질 수 있습니다.

옵션

true

/opt/certs/mdb.pem

/opt/certs/mdbca.crt

requireSSL

/opt/certs/bi.pem

/opt/certs/mdbca.crt

예시

다음 구성 파일/opt/certs/ 디렉토리 에 있는 파일을 사용합니다. 를 실행 하고 데이터베이스 에서 읽을 mongosqld 수 있는 충분한 권한 을 가진 MongoDB 사용자에 해당하는 사용자 이름 과 비밀번호를 test 지정합니다.

systemLog:
logAppend: false
path: './logs/mongosqld.log'
verbosity: 2
security:
enabled: true
mongodb:
net:
uri: <step9-common-name>
auth:
username: <username>
password: <password>
ssl:
enabled: true
PEMKeyFile: '/opt/certs/mdb.pem'
CAFile: '/opt/certs/mdbca.crt'
net:
bindIp: localhost
port: 3307
ssl:
mode: 'requireSSL'
PEMKeyFile: '/opt/certs/bi.pem'
CAFile: '/opt/certs/mdbca.crt'
schema:
sample:
namespaces: 'test.*'

mongosqld --config 구성 파일을 사용하려면 옵션으로 를 시작합니다.

mongosqld --config /path/to/mongosqld.conf
13

mongosqld 인스턴스 에 연결하려면 다음 명령줄 옵션을 사용하여 MySQL shell 을 시작합니다.

mysql --ssl-mode REQUIRED --ssl-ca=/opt/certs/mdbca.crt \
--enable-cleartext-plugin --port 3307 -u <username> -p