Hyperledger fabric 使用 1.4.4 peer local msp 加入通道
Hyperledger fabric join a channel with 1.4.4 peer local msp
AFAIK,hyperledger fabric 1.4.4 允许 "NodeOUs" 通过在 msp 目录中创建 config.yaml
文件。
我正在尝试使用本地对等 msp 加入网络。但是网络总是return下面报错。
Error: proposal failed (err: bad proposal response 500: access denied for [JoinChain][myorg]: [Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [The identity is not an admin under this MSP [MYORG]: The identity does not contain OU [ADMIN], MSP: [MYORG]]])
我对端的本地 msp 目录的结构也有
msp
`- admincerts
`- cacerts
`- ca-cert.pem
`- signcerts
`- signcert.pem
`- keystore
`- secret
`- config.yaml
msp/config.yaml
的内容如下。
NodeOUs:
Enable: true
ClientOUIdentifier:
Certificate: cacerts/ca-cert.pem
OrganizationalUnitIdentifier: client
PeerOUIdentifier:
Certificate: cacerts/ca-cert.pem
OrganizationalUnitIdentifier: peer
AdminOUIdentifier:
Certificate: cacerts/ca-cert.pem
OrganizationalUnitIdentifier: admin
OrdererOUIdentifier:
Certificate: cacerts/ca-cert.pem
OrganizationalUnitIdentifier: orderer
我的猜测是 NodeOUs 是有效的,因为在没有管理员证书的情况下启动对等点没有问题。所以我想我需要配置频道加入策略,但我找不到任何策略参考。
检查您使用的 configtx.yaml
是否有(至少):
Capabilities:
Channel: &ChannelCapabilities
V1_4_3: true
V1_1: true
在您用于加入对等方的客户端中,运行(检查证书路径):
openssl x509 -text -noout -in $CORE_PEER_MSPCONFIGPATH/signcerts/signcert.pem
检查 OU
是否包括 admin
。
您还可以检查证书是否由 myorg
的 CA 签署:
openssl verify -CAfile path-to-myorg-msp-as-specified-in-configtx-yaml/cacerts/ca-cert.pem $CORE_PEER_MSPCONFIGPATH/signcerts/signcert.pem
这里有更多信息:https://hyperledger-fabric.readthedocs.io/en/release-1.4/msp.html#identity-classification
检查您的 configtx.yaml 中的组织政策,这与此非常相似:
1. For orderer:
Readers:
Type: Signature
Rule: "OR('ordererMSP.member')"
Writers:
Type: Signature
Rule: "OR('ordererMSP.member')"
Admins:
Type: Signature
Rule: "OR('ordererMSP.member')"
2. For MYORG:
Readers:
Type: Signature
Rule: "OR('MYORGMsp.admin', 'MYORGMsp.peer', 'MYORGMsp.client')"
Writers:
Type: Signature
Rule: "OR('MYORGMsp.admin', 'MYORGMsp.client')"
Admins:
Type: Signature
Rule: "OR('MYORGMsp.admin','MYORGMsp.client')"
现在因为排序者的策略是通用的,所以创世块的创建工作得很好。但是当同级尝试加入频道时问题就开始了,因为同级组织的策略特定于管理员、同级或客户端的用户类型。
因此,要解决此问题,您必须将 OU 作为 admin、peer、client 或 orderer 传递给您的证书,同时使用Fabric-CA。然后只有证书对使用这些证书执行特定操作有效。以下是生成管理员证书的示例:
fabric-ca-client enroll --caname ca.example.com --csr.names C=SG,ST=Singapore,L=Singapore,O=$ORG_NAME,OU=admin -m admin -u http://admin:adminpw@localhost:$PORT
AFAIK,hyperledger fabric 1.4.4 允许 "NodeOUs" 通过在 msp 目录中创建 config.yaml
文件。
我正在尝试使用本地对等 msp 加入网络。但是网络总是return下面报错。
Error: proposal failed (err: bad proposal response 500: access denied for [JoinChain][myorg]: [Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [The identity is not an admin under this MSP [MYORG]: The identity does not contain OU [ADMIN], MSP: [MYORG]]])
我对端的本地 msp 目录的结构也有
msp
`- admincerts
`- cacerts
`- ca-cert.pem
`- signcerts
`- signcert.pem
`- keystore
`- secret
`- config.yaml
msp/config.yaml
的内容如下。
NodeOUs:
Enable: true
ClientOUIdentifier:
Certificate: cacerts/ca-cert.pem
OrganizationalUnitIdentifier: client
PeerOUIdentifier:
Certificate: cacerts/ca-cert.pem
OrganizationalUnitIdentifier: peer
AdminOUIdentifier:
Certificate: cacerts/ca-cert.pem
OrganizationalUnitIdentifier: admin
OrdererOUIdentifier:
Certificate: cacerts/ca-cert.pem
OrganizationalUnitIdentifier: orderer
我的猜测是 NodeOUs 是有效的,因为在没有管理员证书的情况下启动对等点没有问题。所以我想我需要配置频道加入策略,但我找不到任何策略参考。
检查您使用的 configtx.yaml
是否有(至少):
Capabilities:
Channel: &ChannelCapabilities
V1_4_3: true
V1_1: true
在您用于加入对等方的客户端中,运行(检查证书路径):
openssl x509 -text -noout -in $CORE_PEER_MSPCONFIGPATH/signcerts/signcert.pem
检查 OU
是否包括 admin
。
您还可以检查证书是否由 myorg
的 CA 签署:
openssl verify -CAfile path-to-myorg-msp-as-specified-in-configtx-yaml/cacerts/ca-cert.pem $CORE_PEER_MSPCONFIGPATH/signcerts/signcert.pem
这里有更多信息:https://hyperledger-fabric.readthedocs.io/en/release-1.4/msp.html#identity-classification
检查您的 configtx.yaml 中的组织政策,这与此非常相似:
1. For orderer:
Readers:
Type: Signature
Rule: "OR('ordererMSP.member')"
Writers:
Type: Signature
Rule: "OR('ordererMSP.member')"
Admins:
Type: Signature
Rule: "OR('ordererMSP.member')"
2. For MYORG:
Readers:
Type: Signature
Rule: "OR('MYORGMsp.admin', 'MYORGMsp.peer', 'MYORGMsp.client')"
Writers:
Type: Signature
Rule: "OR('MYORGMsp.admin', 'MYORGMsp.client')"
Admins:
Type: Signature
Rule: "OR('MYORGMsp.admin','MYORGMsp.client')"
现在因为排序者的策略是通用的,所以创世块的创建工作得很好。但是当同级尝试加入频道时问题就开始了,因为同级组织的策略特定于管理员、同级或客户端的用户类型。
因此,要解决此问题,您必须将 OU 作为 admin、peer、client 或 orderer 传递给您的证书,同时使用Fabric-CA。然后只有证书对使用这些证书执行特定操作有效。以下是生成管理员证书的示例:
fabric-ca-client enroll --caname ca.example.com --csr.names C=SG,ST=Singapore,L=Singapore,O=$ORG_NAME,OU=admin -m admin -u http://admin:adminpw@localhost:$PORT