Mongo: how to configure TLS/SSL for mongod

Created on 6 Mar 2018  路  2Comments  路  Source: docker-library/mongo

Is there a documentation on configuring TLS/SSL for mongod?

I found this doc
https://docs.mongodb.com/manual/tutorial/configure-ssl/

but I could not find the instruction for Mongo docker image

Most helpful comment

It will be the same as the doc from MongoDB goes through:

  • generate the cert and create the pem file

    • just follow their documentation

  • then run monogd with the cert
$ # their example
$ mongod --sslMode requireSSL --sslPEMKeyFile /etc/ssl/mongodb.pem <additional options>

$ # translate that to use the the docker image:
$ # mount in the pem (or use something like docker secrets to add it to the container)
$ # add mongd flags after the image name and they will be passed along (or mount in a config file and tell mongo where it is)
$ docker run -d -v /path/to/pem/:/etc/ssl/ mongo:3.6 --sslMode requireSSL --sslPEMKeyFile /etc/ssl/mongodb.pem <additional options>

All 2 comments

It will be the same as the doc from MongoDB goes through:

  • generate the cert and create the pem file

    • just follow their documentation

  • then run monogd with the cert
$ # their example
$ mongod --sslMode requireSSL --sslPEMKeyFile /etc/ssl/mongodb.pem <additional options>

$ # translate that to use the the docker image:
$ # mount in the pem (or use something like docker secrets to add it to the container)
$ # add mongd flags after the image name and they will be passed along (or mount in a config file and tell mongo where it is)
$ docker run -d -v /path/to/pem/:/etc/ssl/ mongo:3.6 --sslMode requireSSL --sslPEMKeyFile /etc/ssl/mongodb.pem <additional options>

This works, thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jqmtor picture jqmtor  路  8Comments

jamesongithub picture jamesongithub  路  6Comments

wayneiny picture wayneiny  路  4Comments

jjelev picture jjelev  路  5Comments

davStar picture davStar  路  3Comments