Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: cap max X11 forwarding ports and evict old#18561

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
spikecurtis wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromspike/18263-cap-x11-forwarding-ports
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletionsagent/agentssh/agentssh.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,9 +130,10 @@ type Server struct {
// a lock on mu but protected by closing.
wg sync.WaitGroup

Execer agentexec.Execer
logger slog.Logger
srv *ssh.Server
Execer agentexec.Execer
logger slog.Logger
srv *ssh.Server
x11Forwarder *x11Forwarder

config *Config

Expand DownExpand Up@@ -188,6 +189,14 @@ func NewServer(ctx context.Context, logger slog.Logger, prometheusRegistry *prom
config: config,

metrics: metrics,
x11Forwarder: &x11Forwarder{
logger: logger,
x11HandlerErrors: metrics.x11HandlerErrors,
fs: fs,
displayOffset: *config.X11DisplayOffset,
sessions: make(map[*x11Session]struct{}),
connections: make(map[net.Conn]struct{}),
},
}

srv := &ssh.Server{
Expand DownExpand Up@@ -455,7 +464,7 @@ func (s *Server) sessionHandler(session ssh.Session) {

x11, hasX11 := session.X11()
if hasX11 {
display, handled := s.x11Handler(ctx,x11)
display, handled := s.x11Forwarder.x11Handler(ctx,session)
if !handled {
logger.Error(ctx, "x11 handler failed")
closeCause("x11 handler failed")
Expand DownExpand Up@@ -1114,6 +1123,9 @@ func (s *Server) Close() error {

s.mu.Unlock()

s.logger.Debug(ctx, "closing X11 forwarding")
_ = s.x11Forwarder.Close()

s.logger.Debug(ctx, "waiting for all goroutines to exit")
s.wg.Wait() // Wait for all goroutines to exit.

Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp