There is very limited information regarding MongoDB and SSL encryption for the transport between replica sets and drivers (java clients). Anyone have any experience setting this up? Looking to have traffic (queries and replica information) between nodes encrypted without having to use stunnel or some other SSL proxy method.
First, let me say that the MongoDB SSL docs are being worked on, most of the information here will be included there eventually, but until then.....
The Java driver, which I believe spring uses, does support SSL. In terms of getting mongoDB running with SSL, there are currently two options. First, you can become a subscriber and use the subscriber edition - that has SSL (and SNMP) support built in:
As of writing this, it is very much a new offering and is only available for Amazon Linux and Ubuntu.
The second option, thanks to the fact that MongoDB is open source, is to build yourself a copy of mongoDB with SSL support. To do so, first I would recommend following the general build instructions until you succeed with a non-SSL build:
Then build with the --ssl flag passed to scons to enable SSL. You will also likely have to install the required openssl libraries or the configure will fail dependencies check (generally libssl and libssl-dev).
Once you complete that step, you should be good to go. When running MongoDB with SSL enabled bear in mind that you have to connect with SSL for everything. All clients, the shell, the driver and MMS will all have to connect via SSL or fail. In order to start mongod with SSL you will need a cert, a key, the password and something like these options (in addition to any other options you want to pass):
You may also specify these option in a config file (usually /etc/mongodb.conf) like so:
For the shell simply use
Finally, you mentioned using Java, here is an example "sslApp.java" class file: