인증서 발급 전 구성파일 내 디렉토리를 생성한다.
## comppose yml파일과 conf파일이 있는 곳으로 이동
# cd /drives/c/mongodata_shard
# mkdir -p ./data/config1 ./data/config2 ./data/config3
# mkdir -p ./data/shard1_a ./data/shard1_b ./data/shard1_c
# mkdir -p ./logs/config1 ./logs/config2 ./logs/config3
# mkdir -p ./logs/shard1_a ./logs/shard1_b ./logs/shard1_c
# mkdir certs
# cd /drives/c/mongodata_shard/certs
# openssl genrsa -out ca_sharded.key 2048
# openssl req -x509 -new -nodes -key ca_sharded.key -sha256 -days 3650 -out ca_sharded.pem -subj "/C=KR/ST=Seoul/L=Seoul/O=MyCompany/OU=MyDept/CN=MongoDBShardedCA"
--mongodb_sharded.key
# openssl genrsa -out mongodb_sharded.key 2048
클러스터의 모든 mongod 및 mongos 인스턴스에서 개인키로 사용
--mongodb_sharded.csr
# openssl req -new -key mongodb_sharded.key -out mongodb_sharded.csr -config san_replica_shard.cnf -extensions v3_req -subj "/C=KR/ST=Seoul/L=Seoul/O=MyCompany/OU=MyDept/CN=mongodb_sharded_c"
--mongodb_sharded.crt + ca_sharded.srl
# openssl x509 -req -in mongodb_sharded.csr -CA ca_sharded.pem -CAkey ca_sharded.key -CAcreateserial -out mongodb_sharded.crt -days 3650 -sha256 -extfile san_replica_shard.cnf -extensions v3_req
# cat mongodb_sharded.key mongodb_sharded.crt > mongodb_sharded.pem
MongoDB는 하나의 파일에 개인키와 인증서가 모두 포함된 .pem 형식을 certificateKeyFile로 사용