diff --git a/lib/client/api.go b/lib/client/api.go index 10e229a81a4b8..42e98001d1fed 100644 --- a/lib/client/api.go +++ b/lib/client/api.go @@ -1598,7 +1598,7 @@ func (tc *TeleportClient) ConnectToNode(ctx context.Context, clt *ClusterClient, // Only return the error from connecting with mfa if the error // originates from the mfa ceremony. If mfa is not required then // the error from the direct connection to the node must be returned. - if mfaErr != nil && !errors.Is(mfaErr, MFARequiredUnknownErr{}) && !errors.Is(mfaErr, services.ErrSessionMFANotRequired) { + if mfaErr != nil && !errors.Is(mfaErr, io.EOF) && !errors.Is(mfaErr, MFARequiredUnknownErr{}) && !errors.Is(mfaErr, services.ErrSessionMFANotRequired) { return nil, trace.Wrap(mfaErr) } diff --git a/lib/web/terminal.go b/lib/web/terminal.go index 959c167778faa..1c2b222e6f787 100644 --- a/lib/web/terminal.go +++ b/lib/web/terminal.go @@ -723,7 +723,7 @@ func (t *TerminalHandler) connectToHost(ctx context.Context, ws *websocket.Conn, // Only return the error from connecting with mfa if the error // originates from the mfa ceremony. If mfa is not required then // the error from the direct connection to the node must be returned. - if mfaErr != nil && !errors.Is(mfaErr, client.MFARequiredUnknownErr{}) && !errors.Is(mfaErr, services.ErrSessionMFANotRequired) { + if mfaErr != nil && !errors.Is(mfaErr, io.EOF) && !errors.Is(mfaErr, client.MFARequiredUnknownErr{}) && !errors.Is(mfaErr, services.ErrSessionMFANotRequired) { return nil, trace.Wrap(mfaErr) }