【问题标题】:Hyperledger fabric join a channel with 1.4.4 peer local mspHyperledger 结构加入具有 1.4.4 对等本地 msp 的通道
【发布时间】:2019-12-04 18:33:02
【问题描述】:

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

我正在尝试使用本地对等 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

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 是有效的,因为在没有 admincerts 的情况下启动对等点没有问题。所以我想我需要配置频道加入政策,但我找不到任何政策参考。

【问题讨论】:

    标签: hyperledger-fabric hyperledger


    【解决方案1】:

    在您的 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')"
    

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

    因此,要解决此问题,您必须在向 Fabric-CA 注册证书时将 OU 作为 admin、peer、client 或 orderer 传递给您的证书。然后只有证书对使用这些证书进行特定操作有效。以下是生成管理员证书的示例:

    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 不会更改 OU 值。我的 fabric-ca-client 版本是 1.4.4,注册时无法更改 OU 值。
    【解决方案2】:

    检查您使用的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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-15
      • 2022-08-09
      • 2018-04-29
      • 2018-01-25
      • 1970-01-01
      • 2019-04-01
      • 1970-01-01
      相关资源
      最近更新 更多