title: Running dev env with mongo + ssl
body: <p><strong>Background</strong>
  I'm trying to run mongo locally in the same way that production will run, with full ssl verification enabled.  Mongo is complaining about the certs being self-signed, but I'm specifying a ca.crt file, that I think should be treated as a root cert to validate against.  If that's reasonable, then I think either my mongo config, or the cert generation is not correct.  </p>
  
  <p><strong>SSL keys/certs/pem</strong>
  To create the ssl stuff I'm running the following</p>
  
  <pre><code>#!/bin/sh
  
  # Generate self signed root CA cert
  openssl req -nodes -x509 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj "/emailAddress=dev@gmail.com"
  
  
  # Generate server cert to be signed
  openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj "/emailAddress=dev@gmail.com"
  
  # Sign the server cert
  openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt
  
  # Create server PEM file
  cat server.key server.crt &gt; server.pem
  
  
  # Generate client cert to be signed
  openssl req -nodes -newkey rsa:2048 -keyout client.key -out client.csr -subj "/emailAddress=dev@gmail.com"
  
  # Sign the client cert
  openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAserial ca.srl -out client.crt
  
  # Create client PEM file
  cat client.key client.crt &gt; client.pem
  </code></pre>
  
  <p><strong>Mongo DB config</strong>
  The mongo config I'm then running with (inside docker), is the following.  (Where /data/mongo is the location generated to above).</p>
  
  <pre><code>net:
    port: 27017
    ssl:
      mode: requireSSL
      CAFile: /data/mongo/ca.crt
      PEMKeyFile: /data/mongo/server.pem
      allowInvalidHostnames: true
  setParameter:
     enableLocalhostAuthBypass: true
  </code></pre>
  
  <p>and running via</p>
  
  <pre><code>mongo --config config/location
  </code></pre>
  
  <p><strong>Connecting to mongo</strong>
  I then try to connect to the server using the mongo command line as follows.</p>
  
  <pre><code>mongo --ssl --sslPEMKeyFile /data/mongo/client.pem --sslCAFile /data/mongo/ca.crt
  </code></pre>
  
  <p>And get the following output</p>
  
  <pre><code>MongoDB shell version: 3.2.14
  connecting to: test
  2017-07-19T20:12:31.456+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:60516 #1 (1 connection now open)
  2017-07-19T20:12:31.461+0000 E NETWORK  [conn1] SSL peer certificate validation failed: self signed certificate
  2017-07-19T20:12:31.461+0000 I NETWORK  [conn1] end connection 127.0.0.1:60516 (0 connections now open)
  2017-07-19T20:12:31.461+0000 E NETWORK  [thread1] SSL peer certificate validation failed: self signed certificate
  2017-07-19T20:12:31.461+0000 E QUERY    [thread1] Error: socket exception [CONNECT_ERROR] for SSL peer certificate validation failed: self signed certificate :
  connect@src/mongo/shell/mongo.js:229:14
  @(connect):1:6
  
  exception: connect failed
  </code></pre>