-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Closed
Labels
issue/criticalThis issue should be fixed ASAP. If it is a PR, the PR should be merged ASAPThis issue should be fixed ASAP. If it is a PR, the PR should be merged ASAPtopic/authenticationtype/bug
Description
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,
Metadata
Metadata
Assignees
Labels
issue/criticalThis issue should be fixed ASAP. If it is a PR, the PR should be merged ASAPThis issue should be fixed ASAP. If it is a PR, the PR should be merged ASAPtopic/authenticationtype/bug
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
cschuber commentedon Jul 19, 2023
I'm seeing ssh keys stopped working. I'm not sure if the issue reported here is specifically LDAP or a larger issue.
palto42 commentedon Aug 15, 2023
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 commentedon Aug 28, 2023
I've also lost admin access fwiw.
arcoast commentedon Aug 28, 2023
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
CaiCandong commentedon Sep 7, 2023
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 commentedon Sep 7, 2023
@CaiCandong Not sure what you mean by "your LDAP service starts the
memberOf
function", but I can run this query on CLI usingldapsearch
with the same search string.CaiCandong commentedon Sep 12, 2023
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?
CaiCandong commentedon Sep 13, 2023
@palto42 Can you show us the LDAP configuration of your Gitea?
palto42 commentedon Sep 18, 2023
@CaiCandong Please find below the sanitized Gitea LDAP config we used:

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 commentedon Sep 18, 2023
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 commentedon Sep 18, 2023
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 commentedon Sep 18, 2023
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?

CaiCandong commentedon Sep 18, 2023
I would like to know more about this, can I contact you via Discord?
palto42 commentedon Sep 18, 2023
I have set "Username Attribute" as
uid
, but also tried w/o setting it - no success either way.gd197 commentedon Oct 26, 2023
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 commentedon Nov 15, 2023
still not working in release 1.21.0
Josue-T commentedon Jan 24, 2024
Maybe #18452 will fix the issue in some cases. cf YunoHost-Apps/gitea_ynh#76 (comment)
ShayArtzi commentedon Apr 22, 2024
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 commentedon May 27, 2024
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.