Fabric系列 - TLS身份验证

排序节点(Orderer)要启用TLS身份验证

在这里插入图片描述

对等节点(Peer)要启用TLS的身份验证

在这里插入图片描述

Gossip 消息传递

gossip 层使用 TLS 绑定来验证连接另一端的对等方的身份。

  1. 通过 Peer 节点 TLS 层来处理点对点消息的安全性,不需要使用签名。Peer 节点通过 CA 签发的证书来授权。尽管没有使用 TLS 证书,但在 gossip 层使用了经过授权的 Peer 节点证书。账本区块通过排序服务签名,然后被分发到通道上的主节点。
  2. 通过 Peer 节点的成员服务提供者来管理授权。==当 Peer 节点第一次连接到通道时,TLS 会话将与成员身份绑定。==这就利用网络和通道中成员的身份来验证了与 Peer 节点相连的节点的身份。

Channel策略

Policies in the channel configuration define various usage and administrative policies on a channel. For example, the policy for adding a peer organization to a channel is defined within the administrative domain of the peer organizations (known as the Application group). Similarly, adding ordering nodes in the consenter set of the channel is controlled by a policy inside the Orderer group. Actions that cross both the peer and orderer organizational domains are contained in the Channel group.

通道配置中的策略定义了通道上的各种使用和管理策略。例如,将同级组织添加到通道的策略是在同级组织的管理域(称为应用程序组)内定义的。类似地,在通道的同意者集中添加排序节点由 Orderer 组内的策略控制。跨越对等组织域和排序者组织域的操作包含在通道组中。

When a peer joins a channel, root CA certificate chains of the channel members are read from the config block of the channel and are added to the TLS client and server root CAs data structure. So, peer to peer communication, peer to orderer communication should work seamlessly.

当一个节点加入通道的时候,会从通道的配置区块中读取通道成员的根 CA 证书链并加入到 TLS 客户端和 服务端的根 CA 数据结构中。所以,peer 节点和 peer 节点之间的通信,peer 节点和排序节点的通信是无 缝连接的。

锚节点(Anchor Peer)

锚节点作为同一通道上的另一组织的节点的入口点,可以与目标锚节点所在组织中的每个节点通信。跨组织的 Gossip 通信必须包含在通道的范围内。

网络启动后锚节点地址存储在通道的配置块中。

将根证书上链的源码

peer:
func updateTrustedRoots(cm channelconfig.Resources) {
    
    

orderer:
func updateTrustedRoots(rootCASupport *comm.CredentialSupport, cm channelconfig.Resources, servers ...*comm.GRPCServer) 


UseTLS

root CAs
root certs

OrdererRootCAsByChainAndOrg[

grpc.WithTransportCredentials(creds)


if peerServer.TLSEnabled() {
    
    
		serverCert := peerServer.ServerCertificate()
		clientCert, err := peer.GetClientCertificate()
		if err != nil {
    
    
			return errors.Wrap(err, "failed obtaining client certificates")
		}
		certs = &gossipcommon.TLSCertificates{
    
    }
		certs.TLSServerCert.Store(&serverCert)
		certs.TLSClientCert.Store(&clientCert)
	}




secureOptions.ServerRootCAs = [][]byte{
    
    rootCert}

总结

所有组织(orderer组织与加入该channel的peer组织)的根证书都会被写入channel的创世块(确切的说是channel配置块)中(没配置开启TLS也会写入), 每个组织的锚节点地址也会被写入。故要增加、删除组织,修改锚节点地址等操作都需要修改创世块

参考:

https://developer.aliyun.com/article/738518


往期精彩回顾:
区块链知识系列
密码学系列
零知识证明系列
共识系列
公链调研系列
BTC系列
以太坊系列
EOS系列
Filecoin系列
联盟链系列
Fabric系列
智能合约系列
Token系列

猜你喜欢

转载自blog.csdn.net/wcc19840827/article/details/129698489