- Mastering MongoDB 3.x
- Alex Giamas
- 211字
- 2021-08-20 10:10:57
Encrypting communication using TLS/SSL
Communication between the mongod or mongos server and the client mongo shell or applications should be encrypted. This is supported in most MongoDB distributions from 3.0 and onwards but we need to take care that we download the proper version with SSL support.
After that, we need to get a signed certificate from a trusted certificate authority or sign our own. Using self-signed certificates is fine for pre-production systems but in production it will mean that mongo servers won't be able to verify our identity, leaving us susceptible to man-in-the-middle attacks; thus using a proper certificate is highly recommended.
To start our MongoDB server with SSL we need the following:
$ mongod --sslMode requireSSL --sslPEMKeyFile <pem> --sslCAFile <ca>
Where <pem> is our .pem signed certificate file and <ca> is the .pem root certificate from the certificate authority that contains the root certificate chain.
These options can also be defined in our configuration file mongod.conf or mongos.conf in a YAML file format:
net:
ssl:
mode: requireSSL
PEMKeyFile: /etc/ssl/mongodb.pem
CAFile: /etc/ssl/ca.pem
disabledProtocols: TLS1_0,TLS1_1,TLS1_2
Here, we specified a PEMKeyFile, a CAFile, and also that we won't allow the server to start with certificates that follow the TLS1_0, TLS1_1 or TLS1_2 versions. These are the available versions for disabledProtocols at this time.
- 機器學(xué)習(xí)及應(yīng)用(在線實驗+在線自測)
- 腦動力:C語言函數(shù)速查效率手冊
- WOW!Illustrator CS6完全自學(xué)寶典
- ROS機器人編程與SLAM算法解析指南
- PostgreSQL Administration Essentials
- 工業(yè)機器人現(xiàn)場編程(FANUC)
- AWS Administration Cookbook
- 大型數(shù)據(jù)庫管理系統(tǒng)技術(shù)、應(yīng)用與實例分析:SQL Server 2005
- 中國戰(zhàn)略性新興產(chǎn)業(yè)研究與發(fā)展·智能制造
- 完全掌握AutoCAD 2008中文版:機械篇
- The Python Workshop
- Learning Azure Cosmos DB
- 軟件構(gòu)件技術(shù)
- Introduction to R for Business Intelligence
- Puppet 3 Beginner’s Guide