Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop logging EOFs and exit(1)s in ssh handler #20476

Merged
merged 10 commits into from
Jul 28, 2022
7 changes: 5 additions & 2 deletions modules/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"errors"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -142,10 +143,12 @@ func sessionHandler(session ssh.Session) {
// Wait for the command to exit and log any errors we get
err = cmd.Wait()
if err != nil {
log.Error("SSH: Wait: %v", err)
if _, ok := err.(*exec.ExitError); !ok {
zeripath marked this conversation as resolved.
Show resolved Hide resolved
log.Error("SSH: Wait: %v", err)
}
}

if err := session.Exit(getExitStatusFromError(err)); err != nil {
if err := session.Exit(getExitStatusFromError(err)); err != nil && !errors.Is(err, io.EOF) {
log.Error("Session failed to exit. %s", err)
}
}
Expand Down