当前位置:网站首页>Mongo SSL configuration practice
Mongo SSL configuration practice
2022-07-28 06:47:00 【opreator.ke】
【 Preface 】
ssl Configure process steps , You can deal with it in the following order .
1. Generate Certificate , Root certificate , Server certificate , Client certificate
2. Configure server ssl To configure , test shell visit ssl The service side , visit mongo
One 【openssl】
Server side ssl To configure .
1.1 Generate root certificate
#-x509: Used to generate self signed certificates , If it is not a self signed certificate, it is not required
#-days: The validity period of the certificate , The default is 365 God
# Direct input with parameters , Just enter the password directly
openssl req -out ca.pem -new -x509 -days 3650 -subj “/C=CN/ST=fujian/O=devops/CN=server1/CN=devops/[email protected]”
# The password can be configured by yourself ,passwd
1.2 Generate server certificate
Generate server private key
openssl genrsa -out server.key 2048
Generate server-side application file cat server.req
#CN=localhost yes mongo The domain name information of the node where the machine is running , If it is not right, it will report an error
openssl req -key server.key -new -out server.req -subj “/C=CN/ST=fujian/O=devops/CN=server1/CN=localhost/[email protected]”
Generate server-side certificates
openssl x509 -req -in server.req -CA ca.pem -CAkey privkey.pem -CAcreateserial -out server.crt -days 3650
Merge server-side private key and server-side certificate , Generate server.pem
cat server.key server.crt > server.pem
Verify the server side pem file
openssl verify -CAfile ca.pem server.pem
1.3 Generate client certificate
Generate client private key
openssl genrsa -out client.key 2048
Generate client application file
#CN=localhost yes mongo The domain address of the service , This needs to be modified according to your business
openssl req -key client.key -new -out client.req -subj “/C=CN/ST=fujian/O=devops/CN=server1/CN=localhost/[email protected]”
Generate client certificate
openssl x509 -req -in client.req -CA ca.pem -CAkey privkey.pem -CAserial ca.srl -out client.crt -days 3650
Merge client private key and client certificate , Generate client.pem
cat client.key client.crt > client.pem
Check client pem file
openssl verify -CAfile ca.pem client.pem
Two 【mongodb To configure ssl】
2.1 Modify the configuration file ,mongodb.conf
Add the following ssl To configure
sslOnNormalPorts = true
sslPEMKeyFile = /data/conf/server.pem
sslPEMKeyPassword = pass
sslCAFile = /data/conf/ca.pem
2.2 shell Client connection mode
mongo --sslAllowInvalidCertificates --sslAllowInvalidHostnames --ssl --sslPEMKeyFile /data/conf/client.pem --sslCAFile /data/conf/ca.pem --host 127.0.0.1
2.3 navicat Client connection configuration 
边栏推荐
- OJ 1507 删数问题
- 网络通信及TCP/IP协议
- Redis implementation of distributed lock and analysis of the main process of redismission distributed lock
- Leetcode skimming diary sword finger offer II 050. sum of downward path nodes
- AQS之semaphore源码分析
- AQS之ReentrantLock源码解析
- 图形管线基础(番外篇)
- Valgrind tool
- [pta-- use queues to solve the problem of monkeys choosing kings]
- Water rendering example
猜你喜欢
![[queue, simple application of stack ---- packaging machine]](/img/bc/617b1eb35558c4f948018f593a1de5.jpg)
[queue, simple application of stack ---- packaging machine]

archery数据库审核平台部署
![[C note] data type and storage](/img/3d/6b7a848dff5a8c0ccd0a54c19bce46.png)
[C note] data type and storage

Prometheus monitoring Nacos

NiO example

Graphic pipeline foundation (part outside)

Analysis of reentrantlock source code of AQS

Everything you don't know about time complexity is here

Leetcode brush question diary sword finger offer II 053. Medium order successor in binary search tree

Valgrind tool
随机推荐
图形管线基础(番外篇)
OJ 1253 ordering problem
InitializingBean接口及示例
OJ 1507 删数问题
New Selenium
OJ 1020 最小的回文数
Pyppeter drop-down selenium drop-down
Leetcode brush questions diary sword finger offer II 047. Binary tree pruning
Pyppeteer is recognized to bypass detection
准备开始写博客了
[C language] string library function introduction and simulation
代码整洁之道(一)
[pta-- use queues to solve the problem of monkeys choosing kings]
Initializingbean interface and examples
图形管线基础(二)
archery数据库审核平台部署
Redis implementation of distributed lock and analysis of the main process of redismission distributed lock
ZOJ Problem 1005 jugs
RayMarching realizes volume light rendering
MySQL index optimization