Skip to content

Commit 7dddf21

Browse files
configure internal ssh server w/ macs and ciphers, backport of #14523 (#14530)
1 parent 446c06b commit 7dddf21

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: modules/ssh/ssh.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,17 @@ func publicKeyHandler(ctx ssh.Context, key ssh.PublicKey) bool {
196196

197197
// Listen starts a SSH server listens on given port.
198198
func Listen(host string, port int, ciphers []string, keyExchanges []string, macs []string) {
199-
// TODO: Handle ciphers, keyExchanges, and macs
200-
201199
srv := ssh.Server{
202200
Addr: fmt.Sprintf("%s:%d", host, port),
203201
PublicKeyHandler: publicKeyHandler,
204202
Handler: sessionHandler,
205-
203+
ServerConfigCallback: func(ctx ssh.Context) *gossh.ServerConfig {
204+
config := &gossh.ServerConfig{}
205+
config.KeyExchanges = keyExchanges
206+
config.MACs = macs
207+
config.Ciphers = ciphers
208+
return config
209+
},
206210
// We need to explicitly disable the PtyCallback so text displays
207211
// properly.
208212
PtyCallback: func(ctx ssh.Context, pty ssh.Pty) bool {

0 commit comments

Comments
 (0)