Hyperledger Fabric用户权限之间的差异

问题描述 投票:7回答:1

如果我有1个组织orgA,并且在这个组织下我有2个用户:user1user2,在orgA也有1个同伴,我们称之为peer0

现在想象一下,user1的证书是在orgA's msp/admincerts forlder,这使得user1管理员为orgA。另一方面,让我们说user2's证书是在peer0's msp/admincerts文件夹,这使user2管理员为peer0

我的问题是user1user2之间的特权差异是什么,我的意思是user1可以做什么以及user2不能做什么,反之亦然?

我也使用fabic canode sdk与网络互动。在我的例子中,当我从nod sdk注册fabric ca的bootstraped用户(admin / adminpw),然后创建创建通道请求时,它工作,但是当我进行加入通道请求时它失败了(因为这个用户没有权限)。当我试图理解为什么会发生这种情况时,我发现如果我向用户发出加入请求证明该证书不在对等的msp / admincerts文件夹中,那么这种用户就没有权限让对等者加入频道。所以唯一的方法是我必须将注册的管理员证书复制到peer0的msp / admincerts文件夹中,然后我认为它会起作用,但这是使其工作的唯一方法,还是有其他方法可以避免复制/粘贴到它从sdk,或创建新的配置更新事务?

另外我无法理解是什么让这个用户能够创建频道?来自fabric ca的bootsraped用户有哪些权限?

hyperledger-fabric
1个回答
0
投票

这是一个非常晚的回复,但希望有人可能会觉得这很有帮助。用户角色和权限没有直接关联,这是通过configtx.yaml中设置的策略完成的。

为每个组织和订货人定义策略,将每个成员和管理员标记为一组特定的策略子组,如ReadersWritersAdmins。这些是用于构建ImplicitMeta策略的基层策略,如用于chiancode查询和写入。

例如,组织定义了类似的策略

# Policies defines the set of policies at this level of the config tree
        # For organization policies, their canonical path is usually
        #   /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
        Policies: &org1Policies
            Readers:
                Type: Signature
                Rule: "OR('org1.example.com.member')"
                # If your MSP is configured with the new NodeOUs, you might
                # want to use a more specific rule like the following:
                # Rule: "OR('org1MSP.admin', 'org1MSP.peer')"
            Writers:
                Type: Signature
                Rule: "OR('org1.example.com.member')"
                # If your MSP is configured with the new NodeOUs, you might
                # want to use a more specific rule like the following:
                # Rule: "OR('org1MSP.admin', 'org1MSP.client'')"
            Admins:
                Type: Signature
                Rule: "OR('org1.example.com.admin')

联盟的政策定义如下:

Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"

这引用了之前定义的org和orderer策略。

现在在系统链码中可以有如下政策:

Application: &ApplicationDefaults
    ACLs: &ACLsDefault
        #This section provides defaults for policies for various resources
        #in the system.
    #---Query System Chaincode (qscc) function to policy mapping for access control---#

        #ACL policy for qscc's "GetChainInfo" function
        qscc/GetChainInfo: /Channel/Application/Readers

        #ACL policy for qscc's "GetBlockByNumber" function
        qscc/GetBlockByNumber: /Channel/Application/Readers

这里引用的政策指向联盟政策。

请阅读docs以获取更详细的指导。

© www.soinside.com 2019 - 2024. All rights reserved.