diff --git a/proxy/server/target.go b/proxy/server/target.go index d3cfa39f..2ebeafa7 100644 --- a/proxy/server/target.go +++ b/proxy/server/target.go @@ -275,7 +275,9 @@ func (s *TargetStream) Run(nonce uint32, replyChan chan *pb.ProxyReply) { } streamPeerInfo := s.PeerAuthInfo() authinput.Host = &rpcauth.HostAuthInput{ - Net: streamPeerInfo.Net, + Net: streamPeerInfo.Net, + Cert: streamPeerInfo.Cert, + Principal: streamPeerInfo.Principal, } // If authz fails, close immediately with an error diff --git a/telemetry/telemetry.go b/telemetry/telemetry.go index 5ec99f17..a61b6e4d 100644 --- a/telemetry/telemetry.go +++ b/telemetry/telemetry.go @@ -68,7 +68,6 @@ func StreamClientLogInterceptor(logger logr.Logger) grpc.StreamClientInterceptor } return &loggedClientStream{ ClientStream: stream, - ctx: logCtx, logger: l, }, nil } @@ -107,13 +106,15 @@ func passAlongMetadata(ctx context.Context) context.Context { type loggedClientStream struct { grpc.ClientStream - ctx context.Context logger logr.Logger } // See: grpc.ClientStream.Context() func (l *loggedClientStream) Context() context.Context { - return l.ctx + // Get the stream context and make sure our logger is attached. + ctx := l.ClientStream.Context() + ctx = logr.NewContext(ctx, l.logger) + return ctx } // See: grpc.ClientStream.SendMsg() @@ -184,7 +185,6 @@ func StreamServerLogInterceptor(logger logr.Logger) grpc.StreamServerInterceptor stream := &loggedStream{ ServerStream: ss, logger: l, - logCtx: logr.NewContext(ss.Context(), l), } err := handler(srv, stream) if err != nil { @@ -198,11 +198,13 @@ func StreamServerLogInterceptor(logger logr.Logger) grpc.StreamServerInterceptor type loggedStream struct { grpc.ServerStream logger logr.Logger - logCtx context.Context } func (l *loggedStream) Context() context.Context { - return l.logCtx + // Get the stream context and make sure our logger is attached. + ctx := l.ServerStream.Context() + ctx = logr.NewContext(ctx, l.logger) + return ctx } func (l *loggedStream) SendMsg(m interface{}) error {