title: MongoDB Cluster internal authentication fails on for replicaset join - replSetHeartbeat requires authentication
body: <p>Getting below error when I am adding second node the existing replicaset :</p>
  
  <pre><code>    {
      "ok"=&gt;0.0, 
      "errmsg"=&gt;"Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: devshard1s1:27018; the following nodes did not respond affirmatively: devshard1s2:27018 failed with command replSetHeartbeat requires authentication", 
      "code"=&gt;74, 
      "codeName"=&gt;"NodeNotFound"
      }
  </code></pre>
  
  <p>failed with command replSetHeartbeat requires authentication</p>
  
  <p>I have SSL enabled , authorization enabled and cluster authentication is also enabled :
  snippet from /etc/mongodb.conf</p>
  
  <pre><code>  net:
      port: 27018
      bindIp: 0.0.0.0
      ssl:
        mode: requireSSL
        PEMKeyFile: "/etc/mongodb/ssl/cluster-cert.pem"
        CAFile: "/etc/mongodb/ssl/ca-cert.pem"
        clusterFile: "/etc/mongodb/ssl/cluster-cert.pem"
    security:
      clusterAuthMode: x509
      authorization: enabled
  </code></pre>
  
  <p>My CN name and SAN from devshard1s1 (first node) is :
  <code>Subject: CN=10.0.41.239, DC=dev
  X509v3 Subject Alternative Name: 
                  DNS:devshard1s1, IP Address:10.0.41.239, IP Address:127.0.0.1, DNS:localhost</code></p>
  
  <p>My CN name and SAN from devshard1s2 (second node) is :
  <code>Subject: CN=10.0.12.231, DC=dev
  X509v3 Subject Alternative Name: 
                  DNS:devshard1s2, IP Address:10.0.12.231, IP Address:127.0.0.1, DNS:localhost</code></p>
  
  <p>Also in PRIMARY node (devshard1s1) logs have this :</p>
  
  <pre><code>2019-01-29T13:57:57.639+0000 I NETWORK  [conn2131] can't authenticate to devshard1s2:27018 as internal user, error: Could not find user CN=10.0.41.239/DC=dev@$external
  </code></pre>
  
  <p>MongoDB Version :
  4.0</p>
  
  <p>Note :
  I am following below approch to install (using chef)
  1. Install 1st node from replicaset, since it is first, initialize replicaset so that it will become primary node.
  2. Add admin user on this node with root role.
  3. Install 2nd node from replicaset, since replicast already initialized, connect to PRIMARY, authenticate and reconfig replicaset with this node details.
  4. While reconfiguring replicset got above error :  <code>Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: devshard1s1:27018; the following nodes did not respond affirmatively: devshard1s2:27018 failed with command replSetHeartbeat requires authentication</code></p>