diff --git a/options.go b/options.go index af74898..303dcc3 100644 --- a/options.go +++ b/options.go @@ -42,6 +42,13 @@ func HostKeyFile(filepath string) Option { } } +func KeyboardInteractiveAuth(fn KeyboardInteractiveHandler) Option { + return func(srv *Server) error { + srv.KeyboardInteractiveHandler = fn + return nil + } +} + // HostKeyPEM returns a functional option that adds HostSigners to the server // from a PEM file as bytes. func HostKeyPEM(bytes []byte) Option { diff --git a/server.go b/server.go index 9528b6e..96b254d 100644 --- a/server.go +++ b/server.go @@ -124,7 +124,7 @@ func (srv *Server) config(ctx Context) *gossh.ServerConfig { for _, signer := range srv.HostSigners { config.AddHostKey(signer) } - if srv.PasswordHandler == nil && srv.PublicKeyHandler == nil { + if srv.PasswordHandler == nil && srv.PublicKeyHandler == nil && srv.KeyboardInteractiveHandler == nil { config.NoClientAuth = true } if srv.Version != "" {