HostKeyFile returns a functional option that adds HostSigners to the server from a PEM file at filepath.
(filepath string)
| 25 | // HostKeyFile returns a functional option that adds HostSigners to the server |
| 26 | // from a PEM file at filepath. |
| 27 | func HostKeyFile(filepath string) Option { |
| 28 | return func(srv *Server) error { |
| 29 | pemBytes, err := os.ReadFile(filepath) |
| 30 | if err != nil { |
| 31 | return err |
| 32 | } |
| 33 | |
| 34 | signer, err := gossh.ParsePrivateKey(pemBytes) |
| 35 | if err != nil { |
| 36 | return err |
| 37 | } |
| 38 | |
| 39 | srv.AddHostKey(signer) |
| 40 | |
| 41 | return nil |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | func KeyboardInteractiveAuth(fn KeyboardInteractiveHandler) Option { |
| 46 | return func(srv *Server) error { |
searching dependent graphs…