【发布时间】:2020-08-21 20:15:52
【问题描述】:
我正在尝试 Fabric v2.2,但由于某些政策问题(我猜),一直未能加入对等通道。为了获得 orderer 和 peer 的 MSP,我使用了 orderer 组织和 peer 组织的 CA(有一个 peer 组织)。
fabric-ca-client register -d --id.name ${PEERS[$i]} --id.secret ${PEER_ADMIN_PWS[$i]} --id.type peer -u https://$CA_NODE:7054
…
fabric-ca-client register -d --id.name $ORG_ADMIN_ID --id.secret $ORG_ADMIN_PW --id.type admin -u https://$CA_NODE:7054
….
fabric-ca-client register -d --id.name ${ORDERERS[$i]} --id.secret ${ORDERER_ADMIN_PWS[$i]} --id.type orderer -u https://$CA_NODE:7054
…
fabric-ca-client enroll -d -u https://${NODES[$i]}:${NODE_ADMIN_PWS[$i]}@$CA_NODE:7054
我认为 MSP 没问题,因为网络运行良好。
然后,我启动了一个 CLI 容器并创建了一个名为 identitych 的频道。我认为它工作得很好,因为我检查了identitych 目录已在所有订购者的chains 目录下创建。
之后,当我提出使用以下命令将节点加入通道时,由于权限被拒绝,orderer 无法向 peer 交付块,并且由于 FORBIDDEN,peer 无法从 orderer 中检索块问题。
peer channel join -b /channel-artifacts/identitych.block
我的configtx.yaml 文件如下所示:
Organizations:
- &BPLOrdererOrg
Name: BPLOrdererMSP
ID: BPLOrdererMSP
MSPDir: ./orderers/org-msp
Policies:
Readers:
Type: Signature
Rule: "OR('BPLOrdererMSP.member')"
Writers:
Type: Signature
Rule: "OR('BPLOrdererMSP.member')"
Admins:
Type: Signature
Rule: "OR('BPLOrdererMSP.admin')"
OrdererEndpoints:
- orderer0.common.bpl:7050
- &BPLOrg
Name: BPLMSP
ID: BPLMSP
MSPDir: ./peers/org-msp
Policies:
Readers:
Type: Signature
Rule: "OR('BPLMSP.admin', 'BPLMSP.peer', 'BPLMSP.client')"
Writers:
Type: Signature
Rule: "OR('BPLMSP.admin', 'BPLMSP.client')"
Admins:
Type: Signature
Rule: "OR('BPLMSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('BPLMSP.peer')"
NodeOUs 是通过将config.yaml 放在每个 orderer 和 peer 的 msp 目录中来启用的。
# config.yaml
NodeOUs:
Enable: true
ClientOUIdentifier:
Certificate: "cacerts/cacert.pem"
OrganizationalUnitIdentifier: "client"
AdminOUIdentifier:
Certificate: "cacerts/cacert.pem"
OrganizationalUnitIdentifier: "admin"
PeerOUIdentifier:
Certificate: "cacerts/cacert.pem"
OrganizationalUnitIdentifier: "peer"
OrdererOUIdentifier:
Certificate: "cacerts/cacert.pem"
OrganizationalUnitIdentifier: "orderer"
订购者反复打印以下警告:
2020-08-20 11:35:08.041 UTC [comm.grpc.server] 1 -> INFO 0c3 streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Deliver grpc.peer_address=172.24.0.11:42642 grpc.code=OK grpc.call_duration=792.5µs
2020-08-20 11:35:15.176 UTC [common.deliver] deliverBlocks -> WARN 0c4 [channel: identitych] Client 172.24.0.8:60236 is not authorized: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Readers' sub-policies to be satisfied: permission denied
同时,一个对等点也重复打印以下警告:
2020-08-20 11:34:28.604 UTC [peer.blocksprovider] DeliverBlocks -> WARN 02b Got error while attempting to receive blocks: received bad status FORBIDDEN from orderer channel=identitych orderer-address=orderer0.common.bpl:7050
2020-08-20 11:34:28.604 UTC [peer.blocksprovider] func1 -> WARN 02c Encountered an error reading from deliver stream: EOF channel=identitych orderer-address=orderer0.common.bpl:7050
我发现了一个类似的问题和答案 (link),我很好奇以下引用:
检查您在 configtx.yaml 中定义的读取器策略,此错误是由于策略不匹配而生成的。您在 Reader 策略中定义了一些特定的用户类型(admin、peer、client),但此特定用户类型不会传递到您为 peer 生成的证书中。
我同意我的问题是因为政策不匹配,但我不明白以下提及:
但此特定用户类型不会传递到您为同行生成的证书中。
如何解决我的问题?提前谢谢。
【问题讨论】:
标签: hyperledger-fabric hyperledger