title: peers not joining channel and error with TLS connection (IP SANs error)
body: <p>I was trying below architecture in fabric where one peer is on another machine rest of the network set up in first machine(server/system),</p>
  
  <p><a href="https://i.stack.imgur.com/peYkY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/peYkY.png" alt="enter image description here"></a></p>
  
  <p>after creating channel while adding each peer to the channel shows a log as below which was not the case when i tried sample network, the log used to say peer joined to channel, also when i check the logs of peer it says : </p>
  
  <blockquote>
    <p>2018-02-28 06:51:23.916 UTC [ConnProducer] NewConnection -> ERRO 36b
    Failed connecting to 138.68.138.161:7050 , error: x509: cannot
    validate certificate for 138.68.138.161 because it doesn't contain any
    IP SANs</p>
  </blockquote>
  
  <p>The network is tls enabled , tls certificates are provided and environment variables were set.</p>
  
  <p>Channel-setup.sh</p>
  
  <pre><code>    # Channel creation
  echo "========== Creating channel: "$CHANNEL_NAME" =========="
  #peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt$
  
  # peer0.org1 channel join
  echo "========== Joining peer0.org1.example.com to channel mychannel =========="
  export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.e$
  export CORE_PEER_ADDRESS=peer0.org1.example.com:7051
  export CORE_PEER_LOCALMSPID="Org1MSP"
  export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.or$
  peer channel join -b ${CHANNEL_NAME}.block
  peer channel update -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS$
  
  # peer1.org1 channel join
  echo "========== Joining peer1.org1.example.com to channel mychannel =========="
  export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.e$
  export CORE_PEER_ADDRESS=peer1.org1.example.com:7051
  export CORE_PEER_LOCALMSPID="Org1MSP"
  export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer1.or$
  peer channel join -b ${CHANNEL_NAME}.block
  
  # peer0.org2 channel join
  echo "========== Joining peer0.org2.example.com to channel mychannel =========="
  export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.e$
  export CORE_PEER_ADDRESS=peer0.org2.example.com:7051
  export CORE_PEER_LOCALMSPID="Org2MSP"
  export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.or$
  peer channel join -b ${CHANNEL_NAME}.block
  peer channel update -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS$
  
  # peer1.org2 channel join
  echo "========== Joining peer1.org2.example.com to channel mychannel =========="
  export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.e$
  export CORE_PEER_ADDRESS=peer1.org2.example.com:7051
  export CORE_PEER_LOCALMSPID="Org2MSP"
  export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.or$
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/9vClM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9vClM.png" alt="enter image description here"></a></p>