| 77 | } |
| 78 | |
| 79 | func createPasswordHandler(localPassword string) ssh.PasswordHandler { |
| 80 | return func(ctx ssh.Context, pass string) bool { |
| 81 | passed := pass == localPassword |
| 82 | if passed { |
| 83 | log.Printf("Successful authentication with password from %s@%s", ctx.User(), ctx.RemoteAddr().String()) |
| 84 | } else { |
| 85 | log.Printf("Invalid password from %s@%s", ctx.User(), ctx.RemoteAddr().String()) |
| 86 | } |
| 87 | return passed |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | func createPublicKeyHandler(authorizedKey string) ssh.PublicKeyHandler { |
| 92 | if authorizedKey == "" { |