grpc/grpc-java

Support SslMasterKeyHandler in NettyServerBuilder

Open

#7,199 建立於 2020年7月10日

在 GitHub 查看
 (15 留言) (1 反應) (0 負責人)Java (3,742 fork)batch import
enhancementgood first issue

倉庫指標

Star
 (11,124 star)
PR 合併指標
 (平均合併 23天 22小時) (30 天內合併 43 個 PR)

描述

I have a problem with adding SslMasterKeyHandler#newWireSharkSslMasterKeyHandler on the server side. I tried to do this with channelFactory:

builder.channelFactory(() -> {
          final ServerChannel ch = GrpcUtil.getDefaultServerChannelFactory().newChannel();
          final ChannelPipeline pipeline = ch.pipeline();
          pipeline.addLast(SslMasterKeyHandler.newWireSharkSslMasterKeyHandler());
          return ch;
        })

and later with ProtocolNegotiator:

final SslContext sslContext = GrpcSslContexts.configure(sslClientContextBuilder).build();
final io.grpc.netty.ProtocolNegotiator negotiator = ProtocolNegotiators.serverTls(sslContext);
builder.protocolNegotiator(tlsNegotiator(negotiator);

In the first case, the setting had no effect. In the second case, the server worked incorrectly (it stopped accepting connections, even without a handler, just with a negotiator wrapper).

What should be the proper implementation?

貢獻者指南