当前位置:网站首页>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 
边栏推荐
- 软件测试的生命周期(流程)
- Mongodb replica set and partitioned cluster
- 2021-11-10
- [pta-- use queues to solve the problem of monkeys choosing kings]
- Pyppeter drop-down selenium drop-down
- Leetcode 刷题日记 剑指 Offer II 053. 二叉搜索树中的中序后继
- 【二叉树基础知识】
- SSAO By Computer Shader(一)
- Rain Scene Effect (I)
- feignclient @RequestMapping参数设置及请求头简易方式设置
猜你喜欢
![Implementation of simple address book in [c language]](/img/75/8f2f4dd1c166808047cda6bea5a746.png)
Implementation of simple address book in [c language]

STM32的IAP跳转相关bug经历

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

下雨场景效果(一)

Leetcode 刷题日记 剑指 Offer II 050. 向下的路径节点之和

【无标题】

【动态规划--买卖股票的最佳时期系列】

2021-11-10
![[hash table basics]](/img/8f/54a4780a02f81e5de3d92c25248e1e.png)
[hash table basics]

redis实现分布式锁思路及redission分布式锁主流程分析
随机推荐
代码整洁之道(二)
OJ 1045 反转然后相加
Prometheus monitoring Nacos
Graphic pipeline foundation (II)
archery数据库审核平台部署
yapi漏洞挂马程序chongfu.sh处理
Redis implementation of distributed lock and analysis of the main process of redismission distributed lock
Analysis of the semaphore source code of AQS
ZOJ Problem 1005 jugs
设计测试用例的方法
NiO example
Bug experience related to IAP jump of stm32
redis实现分布式锁思路及redission分布式锁主流程分析
ZOJ Problem 1005 jugs
OJ 1253 ordering problem
关于时间复杂度,你不知道的都在这里
图形管线基础(番外篇)
从普通查询商品到高并发查询商品的优化思路
代码整洁之道(一)
Implementation of simple address book in [c language]