当提交请求的身份(由 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