为什么MongoDB(使用SSL)多次要求.pem密码?

时间:2017-05-23 16:56:51

标签: mongodb ssl

我使用以下命令启动MongoDB(我最终将其添加到脚本中):

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

之后,mongo会提示:

  

输入PEM密码

哪个好,但在输入正确的密码后,它会再次询问。然后再次。

Mongo连续五次要求输入PEM密码! 我知道我正确输入密码,因为如果我输错了一次,我就会收到失败的消息。

这是正常的吗?除了从pem文件中删除密码之外,有没有办法简化这个?

我的最终目标是让我的Spring启动应用程序启动本地MongoDB并使用SSL,如果它还没有运行,但是要求输入密码5次是荒谬的。

版本信息:

  • MongoDB shell版本v3.4.4
  • git版本:888390515874a9debd1b6c5d36559ca86b44babd
  • OpenSSL版本:OpenSSL 0.9.8zh 2016年1月14日
  • allocator:system
  • modules:none
  • 构建环境:
    • distarch:x86_64
    • target_arch:x86_64

1 个答案:

答案 0 :(得分:1)

您可能需要通过指定PEMKeyPassword

来禁用密码短语提示

要使用配置文件启动mongod,可以使用以下命令:

mongod --config /etc/mongod.conf

您需要在以下结构中指定 PEMKeyPassword

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>
相关问题