How can I specify canonical server name in composer connection profile?

259 views Asked by At

We need to run "composer" command outside of docker container's network. When I specify orderer and peer host name (e.g. peer0.org1.example.com) in /etc/hosts file, "composer" command seems to work.

However, if I specify server's IP address, it does not work. Here is sample.

$ composer network list -p hlfv1 -n info-share-bc -i PeerAdmin -s secret

✖ List business network info-share-bc
Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed

Command succeeded

This is a command example when I specify host name in /etc/hosts.

$ composer network list -p hlfv1 -n info-share-bc -i PeerAdmin -s secret

✔ List business network info-share-bc
name:       info-share-bc
models: 
  - org.hyperledger.composer.system
  - bc.share.info
 <snip>

I believe when the server name can not be resolved, we will specify the option called "ssl-target-name-override", hyperledger node.js SDK as described here.

https://jimthematrix.github.io/Remote.html

- ssl-target-name-override {string} Used in test environment only, 
when the server certificate's hostname (in the 'CN' field) does not
match the actual host endpoint that the server process runs at, 
the application can work around the client TLS verify failure by 
setting this property to the value of the server certificate's hostname 

Is there any option to specify host name in connection profile (connection.json) ?

1

There are 1 answers

0
ibmamnt On

Found a work around: hostnameOverride option in connection profile resolved the connection issue.

 "eventURL": "grpcs://<target-host>:17053", 
 "hostnameOverride": "peer0.org1.example.com",