Allen
Allen

Reputation: 184

Why is MongoDB (with SSL) asking for the .pem passphrase multiple times?

I'm starting MongoDB with the following command (which I'll eventually add to a script):

mongod --sslMode requireSSL --sslPEMKeyFile ./certs/myCertAndKey.pem

After which, mongo will prompt:

Enter PEM passphrase

Which is fine, but upon entering the correct passphrase it will ask again. And again.

Mongo asks for the PEM password FIVE times in a row! I know I'm entering the password correctly because if I enter it wrong just once, I'll get a failure message.

Is this normal? Is there a way to simplify this other than removing the password from the pem file?

My end goal is to have my spring boot application start up the local MongoDB with SSL if it isn't already running, but asking for the password 5 times is ridiculous.

Version info:

Upvotes: 0

Views: 1450

Answers (1)

Sercan Ozdemir
Sercan Ozdemir

Reputation: 4692

You may need to disable promption of passphrase by specifying PEMKeyPassword

To start mongod with a configuration file, you can use below command:

mongod --config /etc/mongod.conf

And you need to specify PEMKeyPassword in the below structure:

net:
   port: <int>
   bindIp: <string>
   maxIncomingConnections: <int>
   wireObjectCheck: <boolean>
   ipv6: <boolean>
   unixDomainSocket:
      enabled: <boolean>
      pathPrefix: <string>
      filePermissions: <int>
   http:
      enabled: <boolean>
      JSONPEnabled: <boolean>
      RESTInterfaceEnabled: <boolean>
   ssl:
      sslOnNormalPorts: <boolean>  # deprecated since 2.6
      mode: <string>
      PEMKeyFile: <string>
      PEMKeyPassword: <string>
      clusterFile: <string>
      clusterPassword: <string>
      CAFile: <string>
      CRLFile: <string>
      allowConnectionsWithoutCertificates: <boolean>
      allowInvalidCertificates: <boolean>
      allowInvalidHostnames: <boolean>
      disabledProtocols: <string>
      FIPSMode: <boolean>
   compression:
      compressors: <string>

Upvotes: 1

Related Questions