-
-
Notifications
You must be signed in to change notification settings - Fork 811
[client] Rewrite the SSH feature #4015
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
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 26fc32f.
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.
Pull Request Overview
This PR overhauls the SSH feature by extending the management API with new SSH flags, updating dependencies for SFTP support, and refactoring the client UI into a tabbed settings interface that includes SSH options.
- Added
enableSSHRoot
,enableSSHSFTP
,enableSSHLocalPortForwarding
, andenableSSHRemotePortForwarding
flags tomanagement.proto
. - Bumped Go module dependencies (including
github.com/pkg/sftp
) ingo.mod
. - Refactored
client/ui/client_ui.go
to use a tabbed settings form and integrated SSH settings. - Removed platform-specific
setWinSize
stubs inclient/ssh
.
Reviewed Changes
Copilot reviewed 77 out of 79 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
management/proto/management.proto | Added four new SSH-related boolean flags |
go.mod | Updated dependency versions and added SFTP package |
client/ui/client_ui.go | Refactored settings UI into tabs and added SSH form |
client/ssh/window_windows.go | Removed Windows PTY resize stub |
client/ssh/window_unix.go | Removed Unix PTY resize stub |
client/ssh/window_freebsd.go | Removed FreeBSD PTY resize stub |
Comments suppressed due to low confidence (3)
go.mod:195
- The
github.com/kr/fs
dependency is added but not referenced in the changes; consider removing this unused indirect dependency to keep the module clean.
github.com/kr/fs v0.1.0 // indirect
client/ui/client_ui.go:377
- [nitpick] The settings window height was reduced from 500 to 400, which may truncate the SSH tab content. Verify the new layout and adjust the window size as needed to prevent clipping.
s.wSettings.Resize(fyne.NewSize(600, 400))
Why do we have multiple lines?
|
What is the proper way to disable this feature and start using the original sshd configuration? |
func (s *Server) SetAllowRemotePortForwarding(allow bool) { | ||
s.mu.Lock() | ||
defer s.mu.Unlock() | ||
s.allowRemotePortForwarding = allow |
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.
Does allowRemotePortForwarding take effect after we run the Start() function? Is it modifiable at runtime?
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.
It's currently static but the field would take effect if changed
Will fix |
|
} | ||
|
||
// setupSessionIO connects session streams to local terminal | ||
func (c *Client) setupSessionIO(ctx context.Context, session *ssh.Session) { |
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.
Unused ctx
return e.Err | ||
} | ||
|
||
var ( |
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.
Const, vars preferred first, and after the types, functions in the source code
} | ||
|
||
// initializeServerState sets up server state after successful setup | ||
func (s *Server) initializeServerState(ln net.Listener, sshServer *ssh.Server) { |
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.
I do not see any reason for this function. Maybe it would be better to eliminate.
s.initializeServerState(ln, sshServer) | ||
log.Infof("SSH server started on %s", addrDesc) | ||
|
||
go s.serve(ln, sshServer) |
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 do you pass ln and sshServer as parameters if the serve function is not static?
} | ||
|
||
s.sshServer = nil | ||
s.listener = nil |
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.
Who closes the s.listener?
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.
if it is not required to close, then s.listener variable is unused
return errors.New("invalid local NetBird address") | ||
} | ||
|
||
if err := e.firewall.AddInboundDNAT(localAddr, firewallManager.ProtocolTCP, 22, 22022); err != nil { |
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.
Are these ports not configurable by command line?
Describe your changes
NetBird SSH Client
SSH Server
New Flags
Changes
known_hosts
setup with peer IPs and hostnamesIssue ticket number and link
Stack
Checklist