diff --git a/lib/client/api.go b/lib/client/api.go index 1c54c9dc72981..1c7cc3ddc16aa 100644 --- a/lib/client/api.go +++ b/lib/client/api.go @@ -2825,12 +2825,7 @@ func (tc *TeleportClient) ConnectToCluster(ctx context.Context) (*ClusterClient, cluster = connected } - cltConfig := pclt.ClientConfig(ctx, cluster) - cltConfig.DialOpts = append(cltConfig.DialOpts, - grpc.WithStreamInterceptor(utils.GRPCClientStreamErrorInterceptor), - grpc.WithUnaryInterceptor(utils.GRPCClientUnaryErrorInterceptor), - ) - aclt, err := auth.NewClient(cltConfig) + aclt, err := auth.NewClient(pclt.ClientConfig(ctx, cluster)) if err != nil { return nil, trace.NewAggregate(err, pclt.Close()) } diff --git a/lib/client/client.go b/lib/client/client.go index 678cc67b34f2c..a5c8f89ad53a7 100644 --- a/lib/client/client.go +++ b/lib/client/client.go @@ -31,6 +31,7 @@ import ( "time" "github.com/gravitational/trace" + "github.com/gravitational/trace/trail" "github.com/moby/term" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" @@ -566,11 +567,12 @@ func (proxy *ProxyClient) IssueUserCertsWithMFA(ctx context.Context, params Reis Init: initReq, }}) if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } resp, err := stream.Recv() if err != nil { + err = trail.FromGRPC(err) // Older versions will NOT reply with a MFARequired response in the // challenge and will terminate the stream with an auth.ErrNoMFADevices error. // In this case for all protocols other than SSH fall back to reissuing @@ -589,16 +591,16 @@ func (proxy *ProxyClient) IssueUserCertsWithMFA(ctx context.Context, params Reis } mfaResp, err := promptMFAChallenge(ctx, proxy.teleportClient.WebProxyAddr, mfaChal) if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } err = stream.Send(&proto.UserSingleUseCertsRequest{Request: &proto.UserSingleUseCertsRequest_MFAResponse{MFAResponse: mfaResp}}) if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } resp, err = stream.Recv() if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } certResp := resp.GetCert() if certResp == nil { diff --git a/lib/client/cluster_client.go b/lib/client/cluster_client.go index 134b6a485af66..fee7621dfea8f 100644 --- a/lib/client/cluster_client.go +++ b/lib/client/cluster_client.go @@ -18,17 +18,16 @@ import ( "context" "github.com/gravitational/trace" + "github.com/gravitational/trace/trail" "go.opentelemetry.io/otel/attribute" oteltrace "go.opentelemetry.io/otel/trace" "golang.org/x/crypto/ssh" - "google.golang.org/grpc" "github.com/gravitational/teleport/api/client/proto" proxyclient "github.com/gravitational/teleport/api/client/proxy" "github.com/gravitational/teleport/api/utils/keys" "github.com/gravitational/teleport/lib/auth" "github.com/gravitational/teleport/lib/services" - "github.com/gravitational/teleport/lib/utils" ) // ClusterClient facilitates communicating with both the @@ -87,13 +86,7 @@ func (c *ClusterClient) SessionSSHConfig(ctx context.Context, user string, targe mfaClt := c if target.Cluster != rootClusterName { - cltConfig := c.ProxyClient.ClientConfig(ctx, rootClusterName) - cltConfig.DialOpts = append(cltConfig.DialOpts, - grpc.WithStreamInterceptor(utils.GRPCClientStreamErrorInterceptor), - grpc.WithUnaryInterceptor(utils.GRPCClientUnaryErrorInterceptor), - ) - - aclt, err := auth.NewClient(cltConfig) + aclt, err := auth.NewClient(c.ProxyClient.ClientConfig(ctx, rootClusterName)) if err != nil { return nil, trace.Wrap(MFARequiredUnknown(err)) } @@ -277,12 +270,12 @@ func (c *ClusterClient) performMFACeremony(ctx context.Context, clt *ClusterClie Init: initReq, }}) if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } resp, err := stream.Recv() if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } mfaChal := resp.GetMFAChallenge() if mfaChal == nil { @@ -312,12 +305,12 @@ func (c *ClusterClient) performMFACeremony(ctx context.Context, clt *ClusterClie } err = stream.Send(&proto.UserSingleUseCertsRequest{Request: &proto.UserSingleUseCertsRequest_MFAResponse{MFAResponse: mfaResp}}) if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } resp, err = stream.Recv() if err != nil { - return nil, trace.Wrap(err) + return nil, trace.Wrap(trail.FromGRPC(err)) } certResp := resp.GetCert() if certResp == nil {