Hyperledger Fabric 网络配置问题

如何解决Hyperledger Fabric 网络配置问题

关于 Hyperledger Fabric 中的 SAN 和 SNI,我想澄清两件事:

a) 启用双向 TLS(具有客户端身份验证的 TLS)时,客户端证书中的通用名称 (CN) 或主题备用名称 (SAN) 是否由服务器验证? (例如,通过解析 DNS 名称并将连续的 IP 地址与客户端的 IP 地址(TCP/IP 连接源)进行比较)?

我们已经测试了这个场景,发现无论是否启用客户端身份验证,作为服务器的对等方都会验证 TLS 证书哈希。以下是支持我们结论的对等日志示例:

2021-02-16 08:54:17.491 UTC [common.deliver] Handle -> DEBU 660f7 Attempting to read seek info message from 10.250.26.32:46320
2021-02-16 08:54:17.491 UTC [common.deliver] deliverBlocks -> WARN 660f8 error parsing envelope from 10.250.26.32:46320: **claimed TLS cert hash is** [235 124 10 219 135 57 10 64 94 166 44 162 123 25 91 195 202 31 164 34 51 5 12 238 77 39 197 171 135 246 12 244] **but actual TLS cert hash is** [185 32 246 230 116 37 63 240 4 9 236 246 210 42 59 45 198 22 209 194 183 117 64 137 153 68 27 56 143 39 211 118]
2021-02-16 08:54:17.492 UTC [orderer.common.server] func1 -> DEBU 660f9 Closing Deliver stream
2021-02-16 08:54:17.492 UTC [comm.grpc.server] 1 -> INFO 660fa streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Deliver grpc.peer_address=10.250.26.32:46320 grpc.peer_subject="CN=proxy,OU=peer,O=Hyperledger,ST=North Carolina,C=US" grpc.code=OK grpc.call_duration=239.612µs

我们还在 github 上发现了一个据称对这种行为负责的源代码 (https://github.com/hyperledger/fabric/blob/master/internal/pkg/comm/util.go):

// mutualTLSBinding enforces the client to send its TLS cert hash in the message,// and then compares it to the computed hash that is derived
// from the gRPC context.
// In case they don't match,or the cert hash is missing from the request or
// there is no TLS certificate to be excavated from the gRPC context,// an error is returned.
func mutualTLSBinding(ctx context.Context,claimedTLScertHash []byte) error {
if len(claimedTLScertHash) == 0 {
return errors.Errorf("client didn't include its TLS cert hash")
}
actualTLScertHash := ExtractCertificateHashFromContext(ctx)
if len(actualTLScertHash) == 0 {
return errors.Errorf("client didn't send a TLS certificate")
}
if !bytes.Equal(actualTLScertHash,claimedTLScertHash) {
return errors.Errorf("claimed TLS cert hash is %v but actual TLS cert hash is %v",claimedTLScertHash,actualTLScertHash)
}
return nil
}

是否可以关闭此验证?您对我们如何在组织之间使用 gRPC 反向代理配置 HLF 网络(用于传入连接)有任何建议。在我们的测试中,我们假设代理作为客户端使用由 HLF 组织(对等组织)的 CA 颁发的自己的证书?

b) 1.4.1 版上的结构对等点是否支持 SNI(服务器名称指示器)?问题是是否可以使用代理在单个 IP 上托管多个 https 服务器?

我们已经使用 nginx 代理对此进行了测试,这部分通信似乎有效。但问题是,作为客户端的对等方是否会将 SNI 发送到服务器(在我们的例子中是 nginx 代理)以通知它它的目标是什么 DNS?多亏了它,我们可以仅使用 IP 地址在代理上运行许多虚拟服务器。

解决方法

a) 当然不是,当客户端到达时,服务器不会验证客户端证书 SAN 或 CN。

您收到的错误是从应用层 (Fabric) 内部调用的,因此这意味着您实际上通过了 TLS 握手。

返回此错误可能是因为:

  1. 双向 TLS(客户端身份验证)已在对等本地配置中打开。当双向 TLS 被打开时,Fabric 客户端在它发送给对等方的请求中发送其 TLS 证书哈希,对等方检查 TLS 哈希是否与它从流中检测到的 TLS 证书的哈希匹配。这样做是为了防止重放攻击,该攻击将使恶意对等方重复使用相同的请求来向对等方请求块,而恶意对等方没有资格接收这些块。
  2. 您的对等方位于 TLS 终止代理之后。在这种情况下,对等方会收到来自代理而非客户端的 TLS 握手,并且代理具有不同的 TLS 证书,因此会拒绝该证书。

您对我们如何在组织之间使用 gRPC 反向代理配置 HLF 网络(用于传入连接)有任何建议。

您需要您的代理在“直通模式”下工作(使用您最喜欢的代理在谷歌上搜索 TLS 直通会产生结果)。

b)

1.4.1 版本上的结构对等点是否支持 SNI(服务器名称指示器)?问题是是否可以使用代理在单个 IP 上托管多个 https 服务器?

如果你的反向代理支持,你可以这样做,它与 Fabric 无关。您所需要的只是您的代理能够读取 TLS 握手的客户端问候中的 SNI,并在不终止 TLS 会话的情况下路由到正确的端口/主机。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-