Skip to content

Commit

Permalink
Tweaks to address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
espadolini committed Dec 3, 2024
1 parent 9a75d0e commit 8cf38de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/auth/transport_credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,11 @@ func TestTransportCredentials_ServerHandshake(t *testing.T) {
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, conn.Close()) })

// this would be done by the grpc TransportCredential in the client
// this would be done by the grpc TransportCredential in the grpc
// client, but we're going to fake it with just a tls.Client, so we
// have to add the http2 next proto ourselves (enforced by grpc-go
// starting from v1.67, and required by the http2 spec when speaking
// http2 in TLS)
clientTLSConf := test.clientTLSConf
if !slices.Contains(clientTLSConf.NextProtos, "h2") {
clientTLSConf = clientTLSConf.Clone()
Expand Down
1 change: 0 additions & 1 deletion lib/teleterm/grpccredentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func createClientTLSConfig(clientKeyPair tls.Certificate, serverCertPath string)

return &tls.Config{
Certificates: []tls.Certificate{clientKeyPair},
NextProtos: []string{"h2"},
RootCAs: certPool,
}, nil
}
Expand Down
9 changes: 9 additions & 0 deletions lib/teleterm/teleterm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"net"
"os"
"path/filepath"
"slices"
"testing"
"time"

Expand Down Expand Up @@ -226,5 +227,13 @@ func createValidClientTLSConfig(t *testing.T, certsDir string) *tls.Config {
tlsConfig, err := createClientTLSConfig(clientCert, serverCertPath)
require.NoError(t, err)

// this would be done by the grpc TransportCredential in the grpc client,
// but we're going to fake it with just a tls.Client, so we have to add the
// http2 next proto ourselves (enforced by grpc-go starting from v1.67, and
// required by the http2 spec when speaking http2 in TLS)
if !slices.Contains(tlsConfig.NextProtos, "h2") {
tlsConfig.NextProtos = append(tlsConfig.NextProtos, "h2")
}

return tlsConfig
}

0 comments on commit 8cf38de

Please sign in to comment.