Skip to content

LDAP "Admin Filter" stopped working #25985

@palto42

Description

@palto42

Description

After upgrading to Gitea 1.20.0 the LDAP Admin Filter stopped working and removed all LDAP based admin permissions.

The admin filter used is:

(memberOf=cn=git-admin,ou=group,o=company,ou=customers,dc=company,dc=net)

It worked in all previous Gitea versions and there hasn't been any change on the LDAP server used.

Gitea Version

1.20.0 - 1.20.4

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

nothing visible in the logs

Screenshots

No response

Git Version

2.40.1

Operating System

RHEL 7.9

How are you running Gitea?

Docker based Gitea.
Docker version 24.0.6

Database

MariaDB
mariadb Ver 15.1 Distrib 10.5.11-MariaDB,

Activity

cschuber

cschuber commented on Jul 19, 2023

@cschuber

I'm seeing ssh keys stopped working. I'm not sure if the issue reported here is specifically LDAP or a larger issue.

palto42

palto42 commented on Aug 15, 2023

@palto42
Author

I re-tested with latest 1.20.2, still the admin filter isn't working anymore.
Isn't there anyone else with this problem or can anyone confirm that it's working in 1.20.x ?

arcoast

arcoast commented on Aug 28, 2023

@arcoast

I re-tested with latest 1.20.2, still the admin filter isn't working anymore. Isn't there anyone else with this problem or can anyone confirm that it's working in 1.20.x ?

I've also lost admin access fwiw.

arcoast

arcoast commented on Aug 28, 2023

@arcoast

I'm not sure on reflection my issue is quite the same, my admin user is a local account and it was marked as inactive (this may have been user error as I rarely have to use it)

I did gain access again by creating a new admin user:

docker exec -it gitea bash
su git
gitea admin user create --username new_admin --email admin@server.com --admin --random-password
added
issue/criticalThis issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP
on Sep 6, 2023
self-assigned this
on Sep 7, 2023
CaiCandong

CaiCandong commented on Sep 7, 2023

@CaiCandong
Member

(memberOf=cn=git-admin,ou=group,o=company,ou=customers,dc=company,dc=net)

Although you said that your LDAP service has not been changed, I still want to confirm that your LDAP service starts the member of function.

palto42

palto42 commented on Sep 7, 2023

@palto42
Author

Although you said that your LDAP service has not been changed, I still want to confirm that your LDAP service starts the member of function.

@CaiCandong Not sure what you mean by "your LDAP service starts the memberOf function", but I can run this query on CLI using ldapsearch with the same search string.

CaiCandong

CaiCandong commented on Sep 12, 2023

@CaiCandong
Member

This is the user information I used for testing, and was able to successfully get administrator rights. Can you provide some data to help me replicate your test environment?


dn: uid=xiaomei,ou=north,dc=deldap,dc=com
cn: xiaomei
displayname: xiaomei
employeenumber: cn=git-admin,ou=north,dc=deldap,dc=com
givenname: xiaomei
mail: xiaomei@esgyn.local
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: top
ou: north
sn:: 5bCP576O
uid: xiaomei
userpassword: 123456
图片名称
CaiCandong

CaiCandong commented on Sep 13, 2023

@CaiCandong
Member

@palto42 Can you show us the LDAP configuration of your Gitea?

palto42

palto42 commented on Sep 18, 2023

@palto42
Author

@CaiCandong Please find below the sanitized Gitea LDAP config we used:
image

One difference I spotted in the user filter is that you used %[1]s while I have just %s. I tried with this change, but as expected it has no impact and the admin filer is still not working for me.

In my user record I have this entry which should be matched for the admin filter:

memberOf: cn=git-admin,ou=group,o=company,ou=customers,dc=company,dc=net

palto42

palto42 commented on Sep 18, 2023

@palto42
Author

I tried with (uid=palto42) as admin filter and it also doesn't work.
As I tried some other group filter, I got one user as admin, but this use was not even a member of the specified group!
No idea what's going on here, in previous releases all worked fine and our LDAP server works fine with other systems.

CaiCandong

CaiCandong commented on Sep 18, 2023

@CaiCandong
Member

Can you create a new user and hopefully the result will be that he'll be an administrator the first time he logs in?

I found bug #27051 while checking the related code, but I'm unsure if this relates to your question.

2 remaining items

CaiCandong

CaiCandong commented on Sep 18, 2023

@CaiCandong
Member

Do you think there is any difference for a new user vs, running a sync? In the past it was always working with the sync if I had to change any LDAP settings.

Yes, I found that issue with one that has to do with user synchronization... wait, did you not set up a user name selection rule?
image

CaiCandong

CaiCandong commented on Sep 18, 2023

@CaiCandong
Member

I would like to know more about this, can I contact you via Discord?

palto42

palto42 commented on Sep 18, 2023

@palto42
Author

I have set "Username Attribute" as uid, but also tried w/o setting it - no success either way.

removed their assignment
on Oct 3, 2023
gd197

gd197 commented on Oct 26, 2023

@gd197

hello, same issue here after upgrading from 1.19.x to 1.20.4. Admins who were already identified did not lost their admin privilege, but new ones did not get them.
Username attribute is not set in our configuration due to another issue with LDAP ( #20422 )

palto42

palto42 commented on Nov 15, 2023

@palto42
Author

still not working in release 1.21.0

Josue-T

Josue-T commented on Jan 24, 2024

@Josue-T

Maybe #18452 will fix the issue in some cases. cf YunoHost-Apps/gitea_ynh#76 (comment)

ShayArtzi

ShayArtzi commented on Apr 22, 2024

@ShayArtzi

FWIW, I'm also seeing an issue with the LDAP admin filter (using gitea 1.21.11).

It seems that the filter is being checked only upon user creation (first login). Then if the user is added to the admin group, they won't be promoted to admin and vice versa (if the user was an admin on first logon and then removed from the LDAP admin group, the admin privilege won't be revoked)

palto42

palto42 commented on May 27, 2024

@palto42
Author

I just upgraded to latest version 1.22.0 and the LDAP admin filter started working again :-)
Closing this issue as it is solved for me.

locked as resolved and limited conversation to collaborators on Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lunny@Josue-T@cschuber@ShayArtzi@palto42

        Issue actions

          LDAP "Admin Filter" stopped working · Issue #25985 · go-gitea/gitea