diff options
author | Stefan <57448158+root360-StefanHeitmueller@users.noreply.github.com> | 2021-01-30 14:20:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-30 14:20:32 +0100 |
commit | eea4197cd93751414f46744ebf48650316d351e1 (patch) | |
tree | 9a8354356c871005f103edae9e458532c2e7f0d3 /modules/ssh | |
parent | 5e20fd6dbf52ede60ed9ac7944db0d3f6769cf86 (diff) | |
download | gitea-eea4197cd93751414f46744ebf48650316d351e1.tar.gz gitea-eea4197cd93751414f46744ebf48650316d351e1.zip |
Internal ssh server respect Ciphers, MACs and KeyExchanges settings (#14523)
Diffstat (limited to 'modules/ssh')
-rw-r--r-- | modules/ssh/ssh.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go index 2b7fd593b5..925f9615b4 100644 --- a/modules/ssh/ssh.go +++ b/modules/ssh/ssh.go @@ -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 { |