summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorStefan <57448158+root360-StefanHeitmueller@users.noreply.github.com>2021-01-30 20:57:31 +0100
committerGitHub <noreply@github.com>2021-01-30 21:57:31 +0200
commit7dddf2186ba05ba1260da4fa4873034d3362164c (patch)
tree9ebb869b43b1da12d31a8300864414c417e72fa9 /modules
parent446c06b81794a7f71d2890812d0d9ff8b044395e (diff)
downloadgitea-7dddf2186ba05ba1260da4fa4873034d3362164c.tar.gz
gitea-7dddf2186ba05ba1260da4fa4873034d3362164c.zip
configure internal ssh server w/ macs and ciphers, backport of #14523 (#14530)
Diffstat (limited to 'modules')
-rw-r--r--modules/ssh/ssh.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go
index 7a449dd41b..13e69a0f3d 100644
--- a/modules/ssh/ssh.go
+++ b/modules/ssh/ssh.go
@@ -196,13 +196,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 {