mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-27 06:49:07 +01:00
[client] Report a missing OS user in the SSH login error message
The session handler mapped a failed user lookup to the generic "User authentication failed", which reads as a rejected SSO login even though the JWT was accepted. Name the missing user instead.
This commit is contained in:
@@ -119,8 +119,12 @@ func (s *Server) handlePrivError(logger *log.Entry, session ssh.Session, err err
|
|||||||
// buildUserLookupErrorMessage creates appropriate user-facing error messages based on error type
|
// buildUserLookupErrorMessage creates appropriate user-facing error messages based on error type
|
||||||
func (s *Server) buildUserLookupErrorMessage(err error) string {
|
func (s *Server) buildUserLookupErrorMessage(err error) string {
|
||||||
var privilegedErr *PrivilegedUserError
|
var privilegedErr *PrivilegedUserError
|
||||||
|
var notFoundErr *UserNotFoundError
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
case errors.As(err, ¬FoundErr):
|
||||||
|
return fmt.Sprintf("user %q does not exist on this host\n", notFoundErr.Username)
|
||||||
|
|
||||||
case errors.As(err, &privilegedErr):
|
case errors.As(err, &privilegedErr):
|
||||||
if privilegedErr.Username == "root" {
|
if privilegedErr.Username == "root" {
|
||||||
return "root login is disabled on this SSH server\n"
|
return "root login is disabled on this SSH server\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user