mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 16:44:26 +00:00
Internal ssh server respect Ciphers, MACs and KeyExchanges settings (#14523)
This commit is contained in:
parent
5e20fd6dbf
commit
eea4197cd9
@ -241,13 +241,17 @@ func publicKeyHandler(ctx ssh.Context, key ssh.PublicKey) bool {
|
|||||||
|
|
||||||
// Listen starts a SSH server listens on given port.
|
// Listen starts a SSH server listens on given port.
|
||||||
func Listen(host string, port int, ciphers []string, keyExchanges []string, macs []string) {
|
func Listen(host string, port int, ciphers []string, keyExchanges []string, macs []string) {
|
||||||
// TODO: Handle ciphers, keyExchanges, and macs
|
|
||||||
|
|
||||||
srv := ssh.Server{
|
srv := ssh.Server{
|
||||||
Addr: fmt.Sprintf("%s:%d", host, port),
|
Addr: fmt.Sprintf("%s:%d", host, port),
|
||||||
PublicKeyHandler: publicKeyHandler,
|
PublicKeyHandler: publicKeyHandler,
|
||||||
Handler: sessionHandler,
|
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
|
// We need to explicitly disable the PtyCallback so text displays
|
||||||
// properly.
|
// properly.
|
||||||
PtyCallback: func(ctx ssh.Context, pty ssh.Pty) bool {
|
PtyCallback: func(ctx ssh.Context, pty ssh.Pty) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user