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

Adding missing audit logs to forward SSH server #52900

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eriktate
Copy link
Contributor

@eriktate eriktate commented Mar 8, 2025

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.

@github-actions github-actions bot requested review from r0mant and tcsc March 8, 2025 00:05
@@ -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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same suggestion as above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants