Search code examples
hyperledger-fabrichyperledgerhyperledger-composeribm-blockchain

ssl_transport_security.cc:599] Could not load any root certificate


I try to create my own network with hyperledger compposer/fabric (v0.19.0) The network build seems to be good but when I do a composer network install ... I got this error : Composer Install.... ⠹ Installing business network. This may take a minute...E0405 10:16:40.355332702 7660 ssl_transport_security.cc:599] Could not load any root certificate. E0405 10:16:40.355402056 7660 ssl_transport_security.cc:1400] Cannot load server root certificates. E0405 10:16:40.355430951 7660 security_connector.cc:1025] Handshaker factory creation failed with TSI_INVALID_ARGUMENT. E0405 10:16:40.355453680 7660 secure_channel_create.cc:111] Failed to create secure subchannel for secure name '172.31.136.4:7051' E0405 10:16:40.355471629 7660 secure_channel_create.cc:142] Failed to create subchannel arguments during subchannel creation.

Can anyone help me ?

PS : I can provide code if needed.


Solution

  • OK, I think I can answer my own question. The fack is in the MultiOrg Hyperledger tuto they use this cmd to replace the certificates in the connection.json :

    awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
    

    I try to inject this cmd in my sed cmd but it failed because sed seems to replace '\n' by a real new line making the json corrupted. To replace the certificate in the json file, I used this cmd :

    export ORG1_CA_CERT=$(awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' composer/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt)    
    perl -p -i -e 's@INSERT_ORG1_CA_CERT@$ENV{ORG1_CA_CERT}@g' connection.json
    

    And it works because perl prints correctly the chars and doesn't interprets them.