title: How to fix SSL error "CSSMERR_TP_VERIFY_ACTION_FAILED" in mongo?
body: <p>I'm seeing this error message whenever I attempt to connect with SSL flags <code>--ssl</code>, <code>--sslAllowInvalidHostnames</code>, and <code>--sslCAFile</code>:</p>
  
  <pre><code>MongoDB shell version v4.0.10
  connecting to: mongodb://&lt;redacted&gt;
  2019-07-01T14:47:17.420-0700 D NETWORK  [js] creating new connection to:&lt;redacted&gt;
  2019-07-01T14:47:17.687-0700 E NETWORK  [js] SSL peer certificate validation failed: Certificate trust failure: CSSMERR_TP_VERIFY_ACTION_FAILED; connection rejected
  2019-07-01T14:47:17.687-0700 D -        [js] User Assertion: SSLHandshakeFailed: SSL peer certificate validation failed: Certificate trust failure: CSSMERR_TP_VERIFY_ACTION_FAILED; connection rejected src/mongo/transport/session_asio.h 242
  2019-07-01T14:47:17.687-0700 D -        [js] User Assertion: InternalError: couldn't connect to server &lt;redacted&gt;, connection attempt failed: SSLHandshakeFailed: SSL peer certificate validation failed: Certificate trust failure: CSSMERR_TP_VERIFY_ACTION_FAILED; connection rejected src/mongo/scripting/mozjs/mongo.cpp 757
  2019-07-01T14:47:17.687-0700 E QUERY    [js] Error: couldn't connect to server &lt;redacted&gt;, connection attempt failed: SSLHandshakeFailed: SSL peer certificate validation failed: Certificate trust failure: CSSMERR_TP_VERIFY_ACTION_FAILED; connection rejected :
  connect@src/mongo/shell/mongo.js:344:17
  @(connect):2:6
  2019-07-01T14:47:17.687-0700 D -        [js] User Assertion: Location12513: connect failed src/mongo/shell/shell_utils.cpp 344
  2019-07-01T14:47:17.687-0700 I QUERY    [js] MozJS GC prologue heap stats -  total: 3664180 limit: 0
  2019-07-01T14:47:17.689-0700 I QUERY    [js] MozJS GC epilogue heap stats -  total: 2620 limit: 0
  2019-07-01T14:47:17.689-0700 I QUERY    [js] MozJS GC prologue heap stats -  total: 4916 limit: 0
  2019-07-01T14:47:17.689-0700 I QUERY    [js] MozJS GC epilogue heap stats -  total: 12 limit: 0
  2019-07-01T14:47:17.690-0700 D -        [main] User Assertion: Location12513: connect failed src/mongo/scripting/mozjs/proxyscope.cpp 302
  exception: connect failed
  </code></pre>
  
  <p>I have verified the following:</p>
  
  <ul>
  <li>My SSL cert is up-to-date and confirmed to be correct</li>
  <li>My SSL version is 1.0.2s</li>
  <li>My mongo version is updated to v4.0.10</li>
  <li>I'm using MacOS X 10.14.5</li>
  </ul>
  
  <p>This seems to be a very Apple related issue as the only reference about the failure message was listed in <a href="https://developer.apple.com/documentation/security/1396762-cmsdecodercopysignerstatus?language=objc" rel="nofollow noreferrer">https://developer.apple.com/documentation/security/1396762-cmsdecodercopysignerstatus?language=objc</a></p>
  
  <p>What else can I check to fix this issue on <code>CSSMERR_TP_VERIFY_ACTION_FAILED</code>?</p>
  
  <p>Expected to connect to the database with SSL cert.</p>