Skip to content

faq006_enabling_ssl

Johannes Brachem edited this page Apr 29, 2019 · 1 revision

How can I use SSL to encrypt data transmission to my MongoDB?

Basically, this is a three-step process, of course with some smaller steps in the middle. The big ones are:

  1. Create your own SSL certificates
  2. Configure your MongoDB to use SSL
  3. Use the SSL certificates in the connection from Alfred to your MongoDB

We moved the creation of your own SSL certificates into a separate article to keep this one short and concise.

Configure your MongoDB to use SSL

We recommend that you follow the instructions from the official MongoDB documentation, found here: https://docs.mongodb.com/manual/tutorial/configure-ssl/. Please make shure to also enable authentication.

The essence is that you switch to SSL mode in the mongod.conf file, tell it where to find your SSL certificate and restart your MongoDB. The # network interfaces section of your mongod.conf will look something like this:

# network interfaces
net:
  ssl:
    mode: requireSSL
    PEMKeyFile: /etc/ssl/mongodb_client_keypair.pem

When running on Debian, you can then restart your MongoDB with

sudo service mongod restart

and your MongoDB should be good to go.

Use the SSL certificates in the connection from Alfred to your MongoDB

When using a commercial SSL certificate

In Alfred, you simply need to open the config.conf of your experiment set the flag use_ssl = true in your mongo_saving_agent section.

When using a self-signed SSL certificate

In Alfred, you simply need to open the config.conf of your experiment set the flag use_ssl = true and specify the filepaths to the public CA file in your mongo_saving_agent section.

[mongo_saving_agent]
use_ssl = true
ca_file_path = <path>/CA_server_public.pem