Skip to content

Commit

Permalink
Fix not logging certain errors
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniomika committed Jun 24, 2022
1 parent 90f7b8f commit 2d16c2d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sshmuxer/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func handleRemoteForward(newRequest *ssh.Request, sshConn *utils.SSHConnection,

tmpfile, err := ioutil.TempFile("", sshConn.SSHConn.RemoteAddr().String()+":"+stringPort)
if err != nil {
log.Println("Error creating temporary file:", err)

err = newRequest.Reply(false, nil)
if err != nil {
log.Println("Error replying to socket request:", err)
Expand All @@ -103,6 +105,8 @@ func handleRemoteForward(newRequest *ssh.Request, sshConn *utils.SSHConnection,

chanListener, err := net.Listen("unix", listenAddr)
if err != nil {
log.Println("Error listening on unix socket:", err)

err = newRequest.Reply(false, nil)
if err != nil {
log.Println("Error replying to socket request:", err)
Expand Down Expand Up @@ -152,6 +156,8 @@ func handleRemoteForward(newRequest *ssh.Request, sshConn *utils.SSHConnection,
case utils.HTTPListener:
pH, serverURL, requestMessages, err := handleHTTPListener(check, stringPort, mainRequestMessages, listenerHolder, state, sshConn)
if err != nil {
log.Println("Error setting up HTTPListener:", err)

err = newRequest.Reply(false, nil)
if err != nil {
log.Println("Error replying to socket request:", err)
Expand Down Expand Up @@ -183,6 +189,8 @@ func handleRemoteForward(newRequest *ssh.Request, sshConn *utils.SSHConnection,
case utils.AliasListener:
aH, serverURL, validAlias, requestMessages, err := handleAliasListener(check, stringPort, mainRequestMessages, listenerHolder, state, sshConn)
if err != nil {
log.Println("Error setting up AliasListener:", err)

err = newRequest.Reply(false, nil)
if err != nil {
log.Println("Error replying to socket request:", err)
Expand Down Expand Up @@ -210,6 +218,8 @@ func handleRemoteForward(newRequest *ssh.Request, sshConn *utils.SSHConnection,
case utils.TCPListener:
tH, balancer, balancerName, serverURL, tcpAddr, requestMessages, err := handleTCPListener(check, bindPort, mainRequestMessages, listenerHolder, state, sshConn, sniProxyForced)
if err != nil {
log.Println("Error setting up TCPListener:", err)

err = newRequest.Reply(false, nil)
if err != nil {
log.Println("Error replying to socket request:", err)
Expand Down

0 comments on commit 2d16c2d

Please sign in to comment.