How to secure mongoDB database
The mongoDB database can be accessed via different tools such as roboMongo
. The access is done on a given port (27017 by default), and for security reasons, it is recommended to secure this port against external connections.
From update 9, it is possible to secure the connection with a certificate and have a very strong security. But even before, securing the port on the servers that runs mongoDB ensures a very good security.
This document explains how to do this.
The procedure is the following:
In cluster configuration, mongodb servers must access each other. The recommended configuration is to setup the firewalls to allow port 27017 to relevant servers only.
We do not recommend direct access to mongodb from third party applications, every data stored in mongodb being available through REST web services from Webserver. This method guarantee services stability and user rights compliance.
In release 9, the installation procedure of MongoDB can be done with certificates. If this has been done, using a tool like robomongo
will require a dedicated set up, summarized here:
conf
sub-directory of the installation directory), a set of files related to certificates. The only file you have to be copy on the server that runs robomongo is the file called client.pem
. This file can be renamed.client.pem
file previously copied/renamed.