2017-09-20 1 views
0

「Hyperlsger Fabricv1.0のFabric CAクライアントで登録および新規ピアを登録するときにtls caを作成する方法」についてはわかりません。Hyperledger Fabricv1.0のFabric CAクライアントで新規ピアを登録して登録するときにtls caを作成する方法

1. I start up a 2 org 4 peers and 2 ca network 
2. Enroll admin at CA, register new peer2 for org1, then get peer2's cacerts, keystore and signcerts 
3. Ctrl-c the network, edit docker-compose.yaml to add peer2 in org1 
4. Put the peer2's cacerts, keystore and signcerts in the crypto-config/peerOrganizations/org1.example.com/peers/peer2.org1.example.com/msp folder 
5. I have no idea how to create tls ca, so I just copy crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls folder to crypto-config/peerOrganizations/org1.example.com/peers/peer2.org1.example.com 
6. Besides, I also copy admincerts & tlscacerts folder from peer0 to peer2 
7. Start network with peer2.org1.example.com and other peers successfully. 
8. Try to join peer2.org1.example.com into existing mychannel but fail like bellow 

[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CHANNEL_NAME=mychannel 
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp CORE_PEER_ADDRESS=peer2.org1.example.com:7051 CORE_PEER_LOCALMSPID="Org1MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt peer channel join -b mychannel.block 
2017-09-20 07:14:11.786 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 
2017-09-20 07:14:11.786 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 
Error: Error getting endorser client channel: PER:404 - Error trying to connect to local peer 
/opt/gopath/src/github.com/hyperledger/fabric/peer/common/common.go:116 github.com/hyperledger/fabric/peer/common.GetEndorserClient 
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:149 github.com/hyperledger/fabric/peer/channel.InitCmdFactory 
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:138 github.com/hyperledger/fabric/peer/channel.join 
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:42 github.com/hyperledger/fabric/peer/channel.joinCmd.func1 
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute 
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC 
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute 
/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 main.main 
/opt/go/src/runtime/proc.go:192 runtime.main 
/opt/go/src/runtime/asm_amd64.s:2087 runtime.goexit 
Caused by: x509: certificate is valid for peer0.org1.example.com, peer0, not peer2.org1.example.com 

アドバイスありがとうございました!

答えて

0

このエラーは、CORE_PEER_TLS_CERT_FILEによって参照されるサーバーのTLS証明書が、別のホスト名を持つ別のサーバー用であることを意味します。

次に、fabric-ca-clientを使用してピアのTLS証明書と鍵を取得する方法を示します。

# To enroll the peer to get a TLS cert: 
fabric-ca-client enroll -d --enrollment.profile tls -u $ENROLLMENT_URL -M /tmp/tls --csr.hosts $PEER_HOST 

# Copy the TLS key and cert to the appropriate place 
TLSDIR=$PEER_HOME/tls 
mkdir -p $TLSDIR 
cp /tmp/tls/signcerts/* $CORE_PEER_TLS_CERT_FILE 
cp /tmp/tls/keystore/* $CORE_PEER_TLS_KEY_FILE 
rm -rf /tmp/tls` 

ところで、これ以上のことをするが、まだマージされていない完全なサンプルがあります。現在、このサンプルを実行するために

:ここ

はhyperledger /ファブリックサンプルリポジトリにあるサンプルに設定変更でありますhyperledger /ファブリックリポジトリの

関連する問題