Browse Source

Internal ssh server respect Ciphers, MACs and KeyExchanges settings (#14523)

tags/v1.15.0-dev
Stefan GitHub 4 years ago
parent
commit
7c645ef749
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      modules/ssh/ssh.go

+ 7
- 3
modules/ssh/ssh.go View File

@@ -241,13 +241,17 @@ func publicKeyHandler(ctx ssh.Context, key ssh.PublicKey) bool {

// Listen starts a SSH server listens on given port.
func Listen(host string, port int, ciphers []string, keyExchanges []string, macs []string) {
// TODO: Handle ciphers, keyExchanges, and macs

srv := ssh.Server{
Addr: fmt.Sprintf("%s:%d", host, port),
PublicKeyHandler: publicKeyHandler,
Handler: sessionHandler,

ServerConfigCallback: func(ctx ssh.Context) *gossh.ServerConfig {
config := &gossh.ServerConfig{}
config.KeyExchanges = keyExchanges
config.MACs = macs
config.Ciphers = ciphers
return config
},
// We need to explicitly disable the PtyCallback so text displays
// properly.
PtyCallback: func(ctx ssh.Context, pty ssh.Pty) bool {


Loading…
Cancel
Save