Hyperledger Fabric 加入一个具有 1.4.4 对等本地 msp 的通道

JSK*_*KIM 0 hyperledger hyperledger-fabric

AFAIK,hyperledger fabric 1.4.4 通过config.yaml在 msp 目录中创建一个文件来允许“NodeOUs” 。

我正在尝试使用本地对等 msp 加入网络。但网络总是返回低于错误。 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
Run Code Online (Sandbox Code Playgroud)

内容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
Run Code Online (Sandbox Code Playgroud)

我的猜测是 NodeOUs 有效,因为在没有 admincerts 的情况下启动对等方没有问题。所以我想我需要配置频道加入策略,但我找不到任何策略参考。

Tri*_*yan 5

检查您的 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')"
Run Code Online (Sandbox Code Playgroud)

现在因为 orderer 的策略是通用的,所以创世块的创建效果很好。但是当对等方尝试加入频道时问题就开始了,因为对等组织的策略特定于管理员、对等方或客户端的用户类型。

因此,要解决此问题,您必须将OU作为管理员、同级、客户端或订购者传递给您的证书,同时将它们注册到 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
Run Code Online (Sandbox Code Playgroud)