使用 CA affiliation v2.2 设置通道策略

问题描述

我们有一个基本的商业网络,除了拥有管理员、节点和客户端之外,我们还需要拥有在网络上进行交易的用户(个人公民)。问题是我们需要给用户一个不是客户端的角色,因为这不是一个可扩展的解决方案,也不会成为未来添加的可持续基础设施。出于各种原因,我们需要实现这一点,其中之一是用户应该只能调用代码,而不能访问其他资源,例如事件注册

由于 Fabric 不允许自定义节点 OU,因此我们有 2 个选项:

  1. 创建 2 个中级 CA 以区分 2 个部门/附属机构:成员和用户
  2. 在 CA 内部使用从属关系并在 config.yaml 中设置组织单位

问题:

  1. 您将如何处理这个问题?有第三种方式吗?
  2. 我们如何实施第二个选项?关于如何实现这一点的文档有限。我将介绍我尝试过但不起作用的方法

关于 CA 配置:

affiliations:
   org1:
      - USERS
      - MEMBERS

在 config.yaml 上:


OrganizationalUnitIdentifiers:
  - Certificate: cacerts/cacert.pem
    OrganizationalUnitIdentifier: USERS
  - Certificate: cacerts/cacert.pem
    OrganizationalUnitIdentifier: MEMBERS  

NodeOUs:
    Enable: true
    ClientOUIdentifier:
        # Certificate: cacerts/cacert.pem
        OrganizationalUnitIdentifier: client
    PeerOUIdentifier:
        # Certificate: cacerts/cacert.pem
        OrganizationalUnitIdentifier: peer
    AdminOUIdentifier:
        # Certificate: cacerts/cacert.pem
        OrganizationalUnitIdentifier: admin
    OrdererOUIdentifier:
        # Certificate: cacerts/cacert.pem
        OrganizationalUnitIdentifier: orderer

在 configtx.yaml 上:


- Org1 
     ... 
       Readers:
                Type: Signature
                # If your MSP is configured with the new NodeOUs,you might
                # want to use a more specific rule like the following:
                Rule: "OR('Org1MSP.MEMBERS.admin','Org1MSP.MEMBERS.peer','Org1MSP.MEMBERS.client')"    
        Invokers:
                Type: Signature
                Rule: "OR('Org1MSP.USERS.client','Org1MSP.MEMBERS.client','Org1MSP.MEMBERS.admin')"

...
Policies:
        Invokers:
            Type: ImplicitMeta
            Rule: "ANY Invokers"
ACLS:
        # ACL policy for invoking chaincodes on peer
        peer/Propose: /Channel/Application/Invokers

        # ACL policy for chaincode to chaincode invocation
        peer/Chaincodetochaincode: /Channel/Application/Invokers

即使我注册了隶属于 USERS 的用户,他们也会在 Org1MSP 而不是 Org1MSP.USERS 下进行验证,并且被归类为 Org1.client,因此他们可以注册以阻止仅属于 READERS 的事件

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)