diff --git a/grpcurl.go b/grpcurl.go index e627988..c0a6753 100644 --- a/grpcurl.go +++ b/grpcurl.go @@ -542,6 +542,14 @@ func ClientTransportCredentials(insecureSkipVerify bool, cacertFile, clientCertF tlsConf.RootCAs = certPool } + if os.Getenv("SSLKEYLOGFILE") != "" { + w, err := os.OpenFile(os.Getenv("SSLKEYLOGFILE"), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0600) + if err != nil { + return nil, fmt.Errorf("could not open SSLKEYLOGFILE: %v", err) + } + tlsConf.KeyLogWriter = w + } + return credentials.NewTLS(&tlsConf), nil }