在Hyperledger Fabric v1.2中实现ACL

时间:2018-08-03 10:38:21

标签: hyperledger-fabric acl hyperledger ibm-blockchain

我正在尝试在Hyperledger Fabric中实现ACL。我已经尝试过使用peer/proposal的自定义策略,并且效果很好。

我的问题是,如果我想防止peer chaincode installpeer chaincode instantiatepeer channel create和所有其他命令使用什么资源。

ACL默认值如下:

# ACL policy for lscc's "getid" function
        lscc/ChaincodeExists: /Channel/Application/Readers


        # ACL policy for lscc's "getdepspec" function
        lscc/GetDeploymentSpec: /Channel/Application/Readers

        # ACL policy for lscc's "getccdata" function
        lscc/GetChaincodeData: /Channel/Application/Readers

        # ACL Policy for lscc's "getchaincodes" function
        lscc/GetInstantiatedChaincodes: /Channel/Application/Readers


        #---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

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

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

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

        #---Configuration System Chaincode (cscc) function to policy mapping for access control---#

        # ACL policy for cscc's "GetConfigBlock" function
        cscc/GetConfigBlock: /Channel/Application/Readers

        # ACL policy for cscc's "GetConfigTree" function
        cscc/GetConfigTree: /Channel/Application/Readers

        # ACL policy for cscc's "SimulateConfigTreeUpdate" function
        cscc/SimulateConfigTreeUpdate: /Channel/Application/Readers

        #---Miscellanesous peer function to policy mapping for access control---#

        # ACL policy for invoking chaincodes on peer
        peer/Propose: /Channel/CustomPolicy

        # ACL policy for chaincode to chaincode invocation
        peer/ChaincodeToChaincode: /Channel/Application/Readers

        #---Events resource to policy mapping for access control###---#

        # ACL policy for sending block events
        event/Block: /Channel/Application/Readers

        # ACL policy for sending filtered block events
        event/FilteredBlock: /Channel/Application/Readers

有什么方法可以实现这种功能?

任何帮助/建议将不胜感激。

谢谢

2 个答案:

答案 0 :(得分:1)

诸如peer chaincode installpeer chaincode instantiatepeer channel create之类的

命令是管理任务,只有组织的管理员才能使用它们。除admin之外的其他成员均不允许使用。 ACL不能处理此类命令,因为这些命令仅限于admin。

因此,答案是否定的。您无法使用ACL控制这些命令。

答案 1 :(得分:0)

当前,ACL与生命周期系统链码或LSCC(这是系统链码处理用户链码的部署,升级和终止事务),配置系统链码或CSCC(管理系统链码处理配置请求)的链码包有关。更改通道的一个方面),客户端事件和对等项(链码包,而不是CLI工具)。下面的图表显示了与每个网络组件有关的资源。

我们可以使用components类别来引用每个资源,然后使用/(斜杠)将两者分开,例如, event / FilteredBlock

>

我们可以使用它来指定在客户获得阻止信息之前必须满足的要求。

ACL