【问题标题】:When I try to create a channel using Hyperledger Fabric, the request fails当我尝试使用 Hyperledger Fabric 创建通道时,请求失败
【发布时间】:2019-12-30 22:04:34
【问题描述】:

当我尝试使用 Hyperledger Fabric 创建通道时,请求失败并返回以下错误:

客户端日志:

错误:出现意外状态:BAD_REQUEST -- 验证新通道创建事务时出错 频道“testchannel”,无法成功地将更新应用到模板配置:错误 授权更新:验证 DeltaSet 时出错:[Group] /Channel/Application 的策略不是 满意:隐式策略评估失败 - 0 个子策略得到满足,但该策略 需要满足 1 个“管理员”子策略

【问题讨论】:

  • 我遇到了同样的错误。

标签: hyperledger-fabric


【解决方案1】:

UTC [orderer.common.broadcast] ProcessMessage -> WARN 009 [channel: orgchannel] 由于错误而拒绝从 172.20.20.22:45668 广播配置消息:为新通道“orgchannel”验证通道创建事务时出错,无法成功将更新应用于模板配置:授权更新错误:验证 DeltaSet 时出错:[Group] /Channel/Application 的策略不满足:隐式策略评估失败 - 满足 0 个子策略,但此策略需要 1 个“管理员”子-要满足的政策

如果您遇到上述错误,请检查您的 configtx 文件并验证以下提到的属性。复制粘贴以下部分并替换功能部分。

能力: # 通道功能适用于排序者和对等方,并且必须是 #两者都支持。 # 将能力的值设置为 true 以要求它。 频道:&ChannelCapabilities # V1.4.3 for Channel 是一个包罗万象的标志 # 确定在 v1.4.3 上运行的所有订购者和对等方都需要 # 级别,但与来自的排序者和对等方不兼容 # 以前的版本。 # 在启用 V1.4.3 通道功能之前,请确保所有 # 通道上的 orderers 和 peers 是 v1.4.3 或更高版本。 V1_4_3:真 # V1.3 for Channel 启用新的非向后兼容 # Fabric v1.3 的功能和修复 V1_3:错误 # V1.1 for Channel 启用新的非向后兼容 # Fabric v1.1 的特性和修复 V1_1:错误

# Orderer capabilities apply only to the orderers, and may be safely
# used with prior release peers.
# Set the value of the capability to true to require it.
Orderer: &OrdererCapabilities
    # V1.4.2 for Orderer is a catchall flag for behavior which has been
    # determined to be desired for all orderers running at the v1.4.2
    # level, but which would be incompatible with orderers from prior releases.
    # Prior to enabling V1.4.2 orderer capabilities, ensure that all
    # orderers on a channel are at v1.4.2 or later.
    V1_4_2: true
    # V1.1 for Orderer enables the new non-backwards compatible
    # features and fixes of fabric v1.1
    V1_1: false

# Application capabilities apply only to the peer network, and may be safely
# used with prior release orderers.
# Set the value of the capability to true to require it.
Application: &ApplicationCapabilities
    # V1.4.2 for Application enables the new non-backwards compatible
    # features and fixes of fabric v1.4.2.
    V1_4_2: true
    # V1.3 for Application enables the new non-backwards compatible
    # features and fixes of fabric v1.3.
    V1_3: false
    # V1.2 for Application enables the new non-backwards compatible
    # features and fixes of fabric v1.2 (note, this need not be set if
    # later version capabilities are set)
    V1_2: false
    # V1.1 for Application enables the new non-backwards compatible
    # features and fixes of fabric v1.1 (note, this need not be set if
    # later version capabilities are set).
    V1_1: false

还要检查您的频道名称

export SYS_CHANNEL=orgchannel#应该是你自己的系统频道名 export CHANNEL_NAME=org1orgchannel#应该是你自己的系统频道名 export CHANNEL_ID=org1orgchannel#应该是你自己的系统频道名

还要记住 SYS_CHANNEL 值应该与 CHANNEL_NAME 不同。 CHANNEL_NAME 和 CHANNEL_ID 应该相同。

如果仍有问题,请发送邮件至 actachieverepeat@gmail.com。

【讨论】:

    【解决方案2】:

    当提交请求的身份(由 MSP ID、证书和密钥组成)出现问题时,会发生此错误。如果您使用默认的 Fabric 配置策略,则需要由组织管理员创建通道。该错误是由于您的身份无法满足 /Channel/Application/Admins 路径上的默认策略而产生的。

    政策会拒绝您的身份有多种原因,包括使用无效或过期的证书。您可以通过查看您的订购者日志来了解有关请求失败原因的更多信息。 Ordering Service 是执行创建或更新渠道的策略的节点。

    当您检查您的订购者日志时,请查找与返回给您的客户的错误相似的错误。您可能会在策略错误(主体反序列化失败)之前的证书检查中发现错误。这意味着通道创建被拒绝,因为 MSP ID 未被识别为有效。

    订购服务日志:

    2019-08-06 15:31:43.589 UTC [cauthdsl] deduplicate -> ERRO 021 Principal deserialization failure
    (MSP SampleOrg is unknown) for identity 0
    2019-08-06 15:31:43.589 UTC [orderer.common.broadcast] ProcessMessage -> WARN 022 [channel:
    testchannel] Rejecting broadcast of config message from 172.27.0.7:34750 because of error: error
    validating channel creation transaction for new channel 'testchannel', could not succesfully apply
    update to template configuration: error authorizing update: error validating DeltaSet: policy for
    [Group]  /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies
    were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied
    

    策略警告之前的错误,ERRO 021 Principal deserialization failure (MSP SampleOrg is unknown) for identity 0,表示作为请求参数传递的 MSP ID 未被排序服务识别。这可能是由于将错误的 MSP ID 传递给命令造成的。此错误也可能表明您的组织尚未加入订购服务系统频道托管的联盟。如果您正在更新应用程序通道,如果您的组织还不是您尝试更新的通道的成员,则可能会发生此错误。

    如果身份的MSP ID有效,可能会遇到以下证书验证错误:

    订购服务日志:

    2019-08-06 15:34:45.730 UTC [cauthdsl] deduplicate -> ERRO 02d Principal deserialization failure
    (the supplied identity is not valid: x509: certificate signed by unknown authority) for identity 0
    2019-08-06 15:34:45.730 UTC [orderer.common.broadcast] ProcessMessage -> WARN 02e [channel:
    testchannel] Rejecting broadcast of config message from 172.27.0.7:36214 because of error: error
    validating channel creation transaction for new channel 'testchannel', could not succesfully apply
    update to template configuration: error authorizing update: error validating DeltaSet: policy for
    [Group]  /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies
    were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied
    

    在这种情况下,订购服务识别了您的 MSP ID,但无法验证您的证书是否由您组织的某个证书颁发机构颁发。如果您管理多个组织,则此错误可能是您使用不匹配的 MSP ID 和证书提交请求的结果。如果您的管理员证书已过期,也可能会发生此错误。如果这是一个最近启动的测试网络,您可能会从一个由证书颁发机构在您的网络的旧版本上创建的身份发出请求。

    更常见的情况是您的证书已通过验证检查,但无法满足频道创建策略。如果是这种情况,您的订购者日志中的错误将如下所示:

    订购服务日志:

    2019-08-06 15:36:52.307 UTC [orderer.common.broadcast] ProcessMessage -> WARN 032 [channel:
    testchannel] Rejecting broadcast of config message from 172.27.0.7:37236 because of error: error
    validating channel creation transaction for new channel 'testchannel', could not succesfully apply
    update to template configuration: error authorizing update: error validating DeltaSet: policy for
    [Group]  /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies
    were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied
    

    提交请求的身份是您组织的有效成员,并且您的组织被识别为系统通道或应用程序通道的成员。但是,该身份没有创建频道的权限。您可能使用了错误的身份提交请求,并且使用了不是您的组织管理员的身份。以您的管理员身份提交请求,或创建新管理员,并让频道管理员更新您的组织 MSP。

    如果您在创建频道以外的操作中遇到此错误,则您的证书可能未获得正确角色的授权。检查您的客户端证书和对等证书是否分别具有客户端和对等 OU。

    其他调试技术

    如果您需要更多帮助来调试与策略或证书相关的错误,您可以提高与这些组件相关的日志记录级别:

    FABRIC_LOGGING_SPEC=”WARN:cauthdsl=debug:policies=debug:msp=debug
    

    您还可以手动从应用程序或系统通道中提取您的组织根证书,并使用它们来验证您的客户端证书。使用以下命令从您的频道中提取最新的配置块。

    peer channel fetch config ./configupdate/config_block.pb -o <orderer_endpoint> -c <my_channel> --tls --cafile <PATH_TO_ORDERER_TLS_CERT>
    

    然后使用以下命令将配置块转换为 JSON。

    configtxlator proto_decode –type=common.Block --input=config_block.pb --output=config_block.json
    

    这允许您使用以下命令从块中提取根证书。替换为您组织的 MSP ID。

    jq -r .data.data[0].payload.data.config.channel_group.groups.Application.groups.<MSPID>\
    .values.MSP.value.config.root_certs[0] config_block.json | base64 –decode > root.pem
    

    如果您的 MSP 定义了多个根证书或使用中间证书,则需要调整上面的 jq 命令以正确提取它们。

    然后您可以使用 OpenSSL 等工具根据根证书验证您的客户端管理员证书。

    openssl verify -CAFile <root.pem> <admincert.pem>
    

    您还可以使用以下命令打开证书并以明文形式对其进行检查。这允许您检查到期日期、节点 OU 或颁发 CA 等字段。

    openssl x509 -in <admincert.pem> -text
    

    【讨论】:

    猜你喜欢
    • 2019-07-26
    • 2019-05-21
    • 1970-01-01
    • 2019-02-04
    • 2019-01-06
    • 2018-01-25
    • 2019-06-01
    • 2019-06-11
    • 1970-01-01
    相关资源
    最近更新 更多