Skip to content

Commit

Permalink
more accurate logging when trying to run password-based auth when dis…
Browse files Browse the repository at this point in the history
…abled
  • Loading branch information
francoismichel committed Dec 17, 2023
1 parent 1b0f872 commit 0171ddf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion unix_server/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

func HandleAuths(ctx context.Context, enablePasswordLogin bool, defaultMaxPacketSize uint64, handlerFunc ssh3.AuthenticatedHandlerFunc) (http.HandlerFunc, error) {
if runtime.GOOS != "linux" && enablePasswordLogin {
return nil, fmt.Errorf("password login not supported on non-Linux Unix platforms")
return nil, fmt.Errorf("password login not supported on %s/%s systems", runtime.GOOS, runtime.GOARCH)
}
return func(w http.ResponseWriter, r *http.Request) {
defer w.(http.Flusher).Flush()
Expand Down
6 changes: 4 additions & 2 deletions util/unix_util/non_password_auth_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
package unix_util

import (
"runtime"
"strconv"

"github.com/rs/zerolog/log"
"fmt"
osuser "os/user"

"github.com/rs/zerolog/log"
)


Expand Down Expand Up @@ -43,5 +45,5 @@ func getUser(username string) (*User, error) {
* server. May return a UserNotFound error when the user does not exist.
*/
func userPasswordAuthentication(username, password string) (bool, error) {
return false, fmt.Errorf("password-based authentication is not implemented on non-Linux Unix platforms")
return false, fmt.Errorf("password-based authentication is not implemented on %s/%s systems", runtime.GOOS, runtime.GOARCH)
}

0 comments on commit 0171ddf

Please sign in to comment.