Skip to content

Commit 1593226

Browse files
Lemonnbelak
authored andcommitted
Fix: KeyboardInteractive Login
+ Include KeyboardInteractive in decision if NoClientAuth should be performed + Add option for KeyboardInteractive
1 parent fb34512 commit 1593226

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

options.go

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ func HostKeyFile(filepath string) Option {
4242
}
4343
}
4444

45+
func KeyboardInteractiveAuth(fn KeyboardInteractiveHandler) Option {
46+
return func(srv *Server) error {
47+
srv.KeyboardInteractiveHandler = fn
48+
return nil
49+
}
50+
}
51+
4552
// HostKeyPEM returns a functional option that adds HostSigners to the server
4653
// from a PEM file as bytes.
4754
func HostKeyPEM(bytes []byte) Option {

server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (srv *Server) config(ctx Context) *gossh.ServerConfig {
124124
for _, signer := range srv.HostSigners {
125125
config.AddHostKey(signer)
126126
}
127-
if srv.PasswordHandler == nil && srv.PublicKeyHandler == nil {
127+
if srv.PasswordHandler == nil && srv.PublicKeyHandler == nil && srv.KeyboardInteractiveHandler == nil {
128128
config.NoClientAuth = true
129129
}
130130
if srv.Version != "" {

0 commit comments

Comments
 (0)