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

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

之后mongo会提示:

Enter PEM passphrase

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

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

这正常吗?除了从 pem 文件中删除密码之外,还有其他方法可以简化这一过程吗?

我的最终目标是让我的 spring boot 应用程序使用 SSL 启动本地 MongoDB(如果它尚未运行),但要求密码 5 次是荒谬的。

版本信息:

  • MongoDB shell 版本 v3.4.4
  • git 版本:888390515874a9debd1b6c5d36559ca86b44babd
  • OpenSSL 版本:OpenSSL 0.9.8zh 2016 年 1 月 14 日
  • 分配器:系统
  • 模块:无
  • 构建环境:
    • 分机:x86_64
    • target_arch: x86_64

请您参考如下方法:

您可能需要通过指定 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> 


评论关闭
IT干货网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!