-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Adding missing audit logs to forward SSH server #52900
base: master
Are you sure you want to change the base?
Conversation
… for regular SSH server
@@ -907,6 +951,7 @@ func (s *Server) handleForwardedTCPIPRequest(ctx context.Context, nch ssh.NewCha | |||
return trace.Wrap(err) | |||
} | |||
|
|||
s.logger.WarnContext(ctx, "remote TCPIP request", "req", req) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a warning? Is this a leftover from local debugging?
addr := scx.ConnectionContext.ServerConn.LocalAddr().String() | ||
host, _, err := sshutils.SplitHostPort(addr) | ||
if err != nil { | ||
s.logger.WarnContext(ctx, "Target host for port forwarding could not be determined for audit logging", "error", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe include the address that was unable to be parsed as an attribute?
@@ -1091,6 +1150,8 @@ func (s *Server) handleDirectTCPIPRequest(ctx context.Context, ch ssh.Channel, r | |||
} | |||
return | |||
} | |||
|
|||
s.logger.WarnContext(ctx, "local TCPIP request", "req", req) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above.
addr := scx.ConnectionContext.ServerConn.LocalAddr().String() | ||
host, _, err := sshutils.SplitHostPort(addr) | ||
if err != nil { | ||
s.logger.WarnContext(ctx, "Target host for port forwarding could not be determined for audit logging", "error", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same suggestion as above.
This PR adds missing audit logging to the forward SSH server, bringing it inline with what we added to the regular server. It also adjusts the
addr
value in the regular server to show the target address and port rather than always showing the loopback.