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). For security reasons, it is recommended to secure this port against external connections.
From Update 9 and above, it is possible to secure the connection with a certificate and have high level security. But even before Update 9, securing the servers' port that runs mongoDB ensures very good security.
This document explains how to do this.
The procedure is the following:
In a cluster configuration, mongoDB servers must access each other. The recommended configuration is to setup the firewalls to allow port 27017 to relevant servers only.
Direct access to mongoDB from third party applications is not recommended. All data stored in mongoDB should be available through REST web services from Web server. This method guarantees services stability and user rights compliance.
In release 9, the installation procedure of MongoDB can be done with certificates. In this case, using a tool like robomongo
requires a dedicated setup that is summarized here:
conf
sub-directory of the installation directory), a set of files related to certificates. The only file that you have to copy on the server that runs 'robomongo' is called client.pem
. This file can be renamed.client.pem
file previously copied/renamed.