Skip to content

Commit

Permalink
configure internal ssh server w/ macs and ciphers, backport of go-git…
Browse files Browse the repository at this point in the history
  • Loading branch information
root360-StefanHeitmueller authored Jan 30, 2021
1 parent 446c06b commit 7dddf21
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7dddf21

Please sign in to comment.