Skip to content

Multiple custom user attribute outputs from LDAP provider #4971

Description

@zphd

Describe the bug
After upgrading to 2023.3.0 querying the user database via LDAP generates the same custom user attribute 2 or 3 times into the result which makes client authentication process crash (Dovecot auth-worker dies).

To Reproduce
Steps to reproduce the behavior:

  1. Create a new User in Authentik
  2. Create custom attributes for it, eg.: { attr1: value1, attr2: value2 }
  3. Query the user via LDAP outpost and provider
  4. You can see the custom attributes multiple times in the answer like: attr1: value1, attr2: value2, attr1: value1, attr1: value1, attr2: value2

Expected behavior
all custom user attributes exist only one time in the LDAP result.

Screenshots
If applicable, add screenshots to help explain your problem.

Logs
INF baseDN=ou=users,dc=auth,dc=example,dc=com bindDN=cn=ldap,dc=auth,dc=example,dc=com client=x.x.x.x event=Search request filter=(&(objectClass=user)(memberOf=cn=MAIL,ou=groups,dc=auth,dc=example,dc=com)(mailbox=user@example.com)) requestId=4fede29c-7627-4fee-8a83-462297e79ad2 scope=Whole Subtree timestamp=2023-03-16T09:26:44Z took-ms=0

Version and Deployment (please complete the following information):

  • authentik version: 2023.3.0
  • Deployment: docker-compose

Additional context

Dovecot log:
auth-worker(10399): Error: conn unix:auth-worker (pid=3179,uid=0): auth-worker<2>: ldap(user@example.com,x.x.x.x,<ZPz1IQH3sshZhWBu>): LDAP search returned multiple entries imap-login: Info: Disconnected: Aborted login by logging out (auth service reported temporary failure): user=<user@example.com>, method=PLAIN, rip=x.x.x.x, lip=y.y.y.y, TLS, session=<ZPz1IQH3sshZhWBu>

ldapsearch relevant output:
`# extended LDIF
#
# LDAPv3
# base <DC=auth,DC=example,DC=com> with scope subtree
# filter: (&(objectClass=user)(memberOf=cn=MAIL,ou=groups,dc=auth,dc=example,dc=com)(ak-active=true))
# requesting: ALL
#

# user, users, auth.example.com
dn: cn=user,ou=users,dc=auth,dc=example,dc=com
attr1: val1
attr2: val2
attr1: val1
attr2: val2
attr2: val2
ak-superuser: false
sAMAccountName: user
uidNumber: 2009
goauthentik.io/ldap/superuser: false
ak-active: true
name: User Name
objectClass: user
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: goauthentik.io/ldap/user
goauthentik.io/ldap/active: true
gidNumber: 2009
homeDirectory: /home/user
sn: User Name
mail: user@example.com
memberOf: cn=MAIL,ou=groups,dc=auth,dc=example,dc=com
memberOf: cn=PORTAINER,ou=groups,dc=auth,dc=example,dc=com
cn: user
uid: 5776113a045611d96ba6fcd0a985c912b67f329ac04f20806be8d4fc0c7801d2
displayName: User Name`

postmap output:
postmap -q user@example.com ldap:/etc/postfix/ldap/virtual_mailbox_maps.cf example.com/user@example.com/,example.com/user@example.com/

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions