From bd613c704c0d74352d427ab32369310a04f5b721 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 6 Nov 2021 07:23:32 +0100 Subject: Fix ipv6 parsing for builtin ssh server (#17561) --- modules/ssh/ssh.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/ssh/ssh.go') diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go index 909ed32c5e..5f19dd4a5c 100644 --- a/modules/ssh/ssh.go +++ b/modules/ssh/ssh.go @@ -17,6 +17,7 @@ import ( "os" "os/exec" "path/filepath" + "strconv" "strings" "sync" "syscall" @@ -264,7 +265,7 @@ func sshConnectionFailed(conn net.Conn, err error) { // Listen starts a SSH server listens on given port. func Listen(host string, port int, ciphers []string, keyExchanges []string, macs []string) { srv := ssh.Server{ - Addr: fmt.Sprintf("%s:%d", host, port), + Addr: net.JoinHostPort(host, strconv.Itoa(port)), PublicKeyHandler: publicKeyHandler, Handler: sessionHandler, ServerConfigCallback: func(ctx ssh.Context) *gossh.ServerConfig { -- cgit v1.2.3