Skip to content

Commit cfa7d4c

Browse files
configure internal ssh server w/ macs and ciphers, refs #14518
1 parent 0536581 commit cfa7d4c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/ssh/ssh.go

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

242242
// Listen starts a SSH server listens on given port.
243243
func Listen(host string, port int, ciphers []string, keyExchanges []string, macs []string) {
244-
// TODO: Handle ciphers, keyExchanges, and macs
245-
246244
srv := ssh.Server{
247245
Addr: fmt.Sprintf("%s:%d", host, port),
248246
PublicKeyHandler: publicKeyHandler,
249247
Handler: sessionHandler,
250-
248+
ServerConfigCallback: func(ctx ssh.Context) *gossh.ServerConfig {
249+
config := &gossh.ServerConfig{}
250+
config.KeyExchanges = keyExchanges
251+
config.MACs = macs
252+
config.Ciphers = ciphers
253+
return config
254+
},
251255
// We need to explicitly disable the PtyCallback so text displays
252256
// properly.
253257
PtyCallback: func(ctx ssh.Context, pty ssh.Pty) bool {

0 commit comments

Comments
 (0)