Compare commits

...

2 Commits

Author SHA1 Message Date
Christoph Haas
cc2d1f53c4 improve logging of LDAP login process even more (#529)
Some checks failed
Docker / Build and Push (push) Has been cancelled
github-pages / deploy (push) Has been cancelled
Docker / release (push) Has been cancelled
2025-09-24 18:39:45 +02:00
Christoph Haas
b122e1ae60 add tzdata to docker image (#531)
Some checks failed
Docker / Build and Push (push) Has been cancelled
github-pages / deploy (push) Has been cancelled
Docker / release (push) Has been cancelled
2025-09-22 18:45:41 +02:00
3 changed files with 11 additions and 5 deletions

View File

@@ -52,7 +52,7 @@ COPY --from=builder /build/dist/wg-portal /
###### ######
FROM alpine:3.22 FROM alpine:3.22
# Install OS-level dependencies # Install OS-level dependencies
RUN apk add --no-cache bash curl iptables nftables openresolv wireguard-tools RUN apk add --no-cache bash curl iptables nftables openresolv wireguard-tools tzdata
# Setup timezone # Setup timezone
ENV TZ=UTC ENV TZ=UTC
# Copy binaries # Copy binaries

View File

@@ -374,13 +374,15 @@ func (a *Authenticator) passwordAuthentication(
rawUserInfo, err := ldapAuth.GetUserInfo(context.Background(), identifier) rawUserInfo, err := ldapAuth.GetUserInfo(context.Background(), identifier)
if err != nil { if err != nil {
if !errors.Is(err, domain.ErrNotFound) { if !errors.Is(err, domain.ErrNotFound) {
slog.Warn("failed to fetch ldap user info", "identifier", identifier, "error", err) slog.Warn("failed to fetch ldap user info",
"source", ldapAuth.GetName(), "identifier", identifier, "error", err)
} }
continue // user not found / other ldap error continue // user not found / other ldap error
} }
ldapUserInfo, err = ldapAuth.ParseUserInfo(rawUserInfo) ldapUserInfo, err = ldapAuth.ParseUserInfo(rawUserInfo)
if err != nil { if err != nil {
slog.Error("failed to parse ldap user info", "identifier", identifier, "error", err) slog.Error("failed to parse ldap user info",
"source", ldapAuth.GetName(), "identifier", identifier, "error", err)
continue continue
} }
@@ -393,13 +395,14 @@ func (a *Authenticator) passwordAuthentication(
} }
if userSource == "" { if userSource == "" {
slog.Warn("no user source found for user", "identifier", identifier, "ldapProviderCount", a.ldapAuthenticators) slog.Warn("no user source found for user",
"identifier", identifier, "ldapProviderCount", len(a.ldapAuthenticators), "inDb", userInDatabase)
return nil, errors.New("user not found") return nil, errors.New("user not found")
} }
if userSource == domain.UserSourceLdap && ldapProvider == nil { if userSource == domain.UserSourceLdap && ldapProvider == nil {
slog.Warn("no ldap provider found for user", slog.Warn("no ldap provider found for user",
"identifier", identifier, "ldapProviderCount", a.ldapAuthenticators) "identifier", identifier, "ldapProviderCount", len(a.ldapAuthenticators), "inDb", userInDatabase)
return nil, errors.New("ldap provider not found") return nil, errors.New("ldap provider not found")
} }

View File

@@ -113,10 +113,13 @@ func (l LdapAuthenticator) GetUserInfo(_ context.Context, userId domain.UserIden
} }
if len(sr.Entries) == 0 { if len(sr.Entries) == 0 {
slog.Debug("LDAP user not found", "source", l.GetName(), "userId", userId, "filter", loginFilter)
return nil, domain.ErrNotFound return nil, domain.ErrNotFound
} }
if len(sr.Entries) > 1 { if len(sr.Entries) > 1 {
slog.Debug("LDAP user not unique",
"source", l.GetName(), "userId", userId, "filter", loginFilter, "entries", len(sr.Entries))
return nil, domain.ErrNotUnique return nil, domain.ErrNotUnique
} }